Prestashop products inserted by db not showing
I'm making a script for Prestashop 1.7.2 which one auto insert feed of data taken by an api, I create the products, categories (linking them), but when I go to the back office is not showed, I think about a field in database with wrong value or empty, this is my first script for PS and I´m learning the structure of the database. Any clue is helpfull.
Here you have the insert code.
INSERT into ps_product (id_product, id_category_default, ean13, quantity, price, reference, width, height, depth, weight, id_supplier, id_shop_default, id_tax_rules_group, available_for_order, state)
VALUES (".$id_nova." ,'".$categoria."', '".$ean."', '".$cantidad."', '".$precio."', '".$referencia."', '".$ancho."', '".$altura."', '".$profundidad."', '".$peso."', '0', '1','1', '1', '1')
Also I insert this for the name and description.
INSERT into ps_product_lang ( id_product, id_shop, id_lang, description, description_short, link_rewrite, name )
VALUES ('".$id_nova."', '1', '".$x."', '".$contenido."', '".$contenido."', '".str_replace(" ","-",$nombre)."', '".$nombre."')"
php mysqli prestashop-1.7
add a comment |
I'm making a script for Prestashop 1.7.2 which one auto insert feed of data taken by an api, I create the products, categories (linking them), but when I go to the back office is not showed, I think about a field in database with wrong value or empty, this is my first script for PS and I´m learning the structure of the database. Any clue is helpfull.
Here you have the insert code.
INSERT into ps_product (id_product, id_category_default, ean13, quantity, price, reference, width, height, depth, weight, id_supplier, id_shop_default, id_tax_rules_group, available_for_order, state)
VALUES (".$id_nova." ,'".$categoria."', '".$ean."', '".$cantidad."', '".$precio."', '".$referencia."', '".$ancho."', '".$altura."', '".$profundidad."', '".$peso."', '0', '1','1', '1', '1')
Also I insert this for the name and description.
INSERT into ps_product_lang ( id_product, id_shop, id_lang, description, description_short, link_rewrite, name )
VALUES ('".$id_nova."', '1', '".$x."', '".$contenido."', '".$contenido."', '".str_replace(" ","-",$nombre)."', '".$nombre."')"
php mysqli prestashop-1.7
Do you have a table namedps_category_product
? In 1.6 it was here that the link between category and product was made, but I don't know for 1.7
– Fanie Void
Nov 21 '18 at 16:27
Can you have a look in your database ? Does your data is here ?
– Fanie Void
Nov 21 '18 at 16:32
add a comment |
I'm making a script for Prestashop 1.7.2 which one auto insert feed of data taken by an api, I create the products, categories (linking them), but when I go to the back office is not showed, I think about a field in database with wrong value or empty, this is my first script for PS and I´m learning the structure of the database. Any clue is helpfull.
Here you have the insert code.
INSERT into ps_product (id_product, id_category_default, ean13, quantity, price, reference, width, height, depth, weight, id_supplier, id_shop_default, id_tax_rules_group, available_for_order, state)
VALUES (".$id_nova." ,'".$categoria."', '".$ean."', '".$cantidad."', '".$precio."', '".$referencia."', '".$ancho."', '".$altura."', '".$profundidad."', '".$peso."', '0', '1','1', '1', '1')
Also I insert this for the name and description.
INSERT into ps_product_lang ( id_product, id_shop, id_lang, description, description_short, link_rewrite, name )
VALUES ('".$id_nova."', '1', '".$x."', '".$contenido."', '".$contenido."', '".str_replace(" ","-",$nombre)."', '".$nombre."')"
php mysqli prestashop-1.7
I'm making a script for Prestashop 1.7.2 which one auto insert feed of data taken by an api, I create the products, categories (linking them), but when I go to the back office is not showed, I think about a field in database with wrong value or empty, this is my first script for PS and I´m learning the structure of the database. Any clue is helpfull.
Here you have the insert code.
INSERT into ps_product (id_product, id_category_default, ean13, quantity, price, reference, width, height, depth, weight, id_supplier, id_shop_default, id_tax_rules_group, available_for_order, state)
VALUES (".$id_nova." ,'".$categoria."', '".$ean."', '".$cantidad."', '".$precio."', '".$referencia."', '".$ancho."', '".$altura."', '".$profundidad."', '".$peso."', '0', '1','1', '1', '1')
Also I insert this for the name and description.
INSERT into ps_product_lang ( id_product, id_shop, id_lang, description, description_short, link_rewrite, name )
VALUES ('".$id_nova."', '1', '".$x."', '".$contenido."', '".$contenido."', '".str_replace(" ","-",$nombre)."', '".$nombre."')"
php mysqli prestashop-1.7
php mysqli prestashop-1.7
edited Nov 21 '18 at 17:16
Fanie Void
1619
1619
asked Nov 21 '18 at 16:04
Jose Castillo
213
213
Do you have a table namedps_category_product
? In 1.6 it was here that the link between category and product was made, but I don't know for 1.7
– Fanie Void
Nov 21 '18 at 16:27
Can you have a look in your database ? Does your data is here ?
– Fanie Void
Nov 21 '18 at 16:32
add a comment |
Do you have a table namedps_category_product
? In 1.6 it was here that the link between category and product was made, but I don't know for 1.7
– Fanie Void
Nov 21 '18 at 16:27
Can you have a look in your database ? Does your data is here ?
– Fanie Void
Nov 21 '18 at 16:32
Do you have a table named
ps_category_product
? In 1.6 it was here that the link between category and product was made, but I don't know for 1.7– Fanie Void
Nov 21 '18 at 16:27
Do you have a table named
ps_category_product
? In 1.6 it was here that the link between category and product was made, but I don't know for 1.7– Fanie Void
Nov 21 '18 at 16:27
Can you have a look in your database ? Does your data is here ?
– Fanie Void
Nov 21 '18 at 16:32
Can you have a look in your database ? Does your data is here ?
– Fanie Void
Nov 21 '18 at 16:32
add a comment |
3 Answers
3
active
oldest
votes
Finally I desist doing this by queries, now im using prestashop clases, and they work in good way and realy easy, just I dont know why all is working fine but the stock isnt updated, I post the code that worked for my inserts.
Code here
Some fields arent taken, so I update them with queries, and also I´m having troubles with the rewrite_link field, the class cant validate it sometimes but I have created the products and also the image attachment.
add a comment |
you have missing ' in your first query, try this :
insert into ps_product (id_product, id_category_default, ean13, quantity, price, reference, width, height, depth, weight, id_supplier, id_shop_default, id_tax_rules_group, available_for_order, state) VALUES ('".$id_nova."' ,'".$categoria."', '".$ean."', '".$cantidad."', '".$precio."', '".$referencia."', '".$ancho."', '".$altura."', '".$profundidad."', '".$peso."', '0', '1','1', '1', '1')
1
I tried, just same result the first field is type int so it takes also with no 'x', but waht i mean is that the queries insert the data into de data base but prestashop cant list products i think i need to insert in ps_product_shop also. Thanks Hamed.
– Jose Castillo
Nov 22 '18 at 8:42
add a comment |
You need to insert also to ps_product_shop. Adding products by SQL is not good idea becouse there is many dependencis. Better way is use API or CSV import. In product class you have $definitons array it is kinda of map for DB.
https://devdocs.prestashop.com/1.7/development/database/objectmodel/
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53416054%2fprestashop-products-inserted-by-db-not-showing%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
Finally I desist doing this by queries, now im using prestashop clases, and they work in good way and realy easy, just I dont know why all is working fine but the stock isnt updated, I post the code that worked for my inserts.
Code here
Some fields arent taken, so I update them with queries, and also I´m having troubles with the rewrite_link field, the class cant validate it sometimes but I have created the products and also the image attachment.
add a comment |
Finally I desist doing this by queries, now im using prestashop clases, and they work in good way and realy easy, just I dont know why all is working fine but the stock isnt updated, I post the code that worked for my inserts.
Code here
Some fields arent taken, so I update them with queries, and also I´m having troubles with the rewrite_link field, the class cant validate it sometimes but I have created the products and also the image attachment.
add a comment |
Finally I desist doing this by queries, now im using prestashop clases, and they work in good way and realy easy, just I dont know why all is working fine but the stock isnt updated, I post the code that worked for my inserts.
Code here
Some fields arent taken, so I update them with queries, and also I´m having troubles with the rewrite_link field, the class cant validate it sometimes but I have created the products and also the image attachment.
Finally I desist doing this by queries, now im using prestashop clases, and they work in good way and realy easy, just I dont know why all is working fine but the stock isnt updated, I post the code that worked for my inserts.
Code here
Some fields arent taken, so I update them with queries, and also I´m having troubles with the rewrite_link field, the class cant validate it sometimes but I have created the products and also the image attachment.
answered Nov 22 '18 at 13:55
Jose Castillo
213
213
add a comment |
add a comment |
you have missing ' in your first query, try this :
insert into ps_product (id_product, id_category_default, ean13, quantity, price, reference, width, height, depth, weight, id_supplier, id_shop_default, id_tax_rules_group, available_for_order, state) VALUES ('".$id_nova."' ,'".$categoria."', '".$ean."', '".$cantidad."', '".$precio."', '".$referencia."', '".$ancho."', '".$altura."', '".$profundidad."', '".$peso."', '0', '1','1', '1', '1')
1
I tried, just same result the first field is type int so it takes also with no 'x', but waht i mean is that the queries insert the data into de data base but prestashop cant list products i think i need to insert in ps_product_shop also. Thanks Hamed.
– Jose Castillo
Nov 22 '18 at 8:42
add a comment |
you have missing ' in your first query, try this :
insert into ps_product (id_product, id_category_default, ean13, quantity, price, reference, width, height, depth, weight, id_supplier, id_shop_default, id_tax_rules_group, available_for_order, state) VALUES ('".$id_nova."' ,'".$categoria."', '".$ean."', '".$cantidad."', '".$precio."', '".$referencia."', '".$ancho."', '".$altura."', '".$profundidad."', '".$peso."', '0', '1','1', '1', '1')
1
I tried, just same result the first field is type int so it takes also with no 'x', but waht i mean is that the queries insert the data into de data base but prestashop cant list products i think i need to insert in ps_product_shop also. Thanks Hamed.
– Jose Castillo
Nov 22 '18 at 8:42
add a comment |
you have missing ' in your first query, try this :
insert into ps_product (id_product, id_category_default, ean13, quantity, price, reference, width, height, depth, weight, id_supplier, id_shop_default, id_tax_rules_group, available_for_order, state) VALUES ('".$id_nova."' ,'".$categoria."', '".$ean."', '".$cantidad."', '".$precio."', '".$referencia."', '".$ancho."', '".$altura."', '".$profundidad."', '".$peso."', '0', '1','1', '1', '1')
you have missing ' in your first query, try this :
insert into ps_product (id_product, id_category_default, ean13, quantity, price, reference, width, height, depth, weight, id_supplier, id_shop_default, id_tax_rules_group, available_for_order, state) VALUES ('".$id_nova."' ,'".$categoria."', '".$ean."', '".$cantidad."', '".$precio."', '".$referencia."', '".$ancho."', '".$altura."', '".$profundidad."', '".$peso."', '0', '1','1', '1', '1')
answered Nov 21 '18 at 16:29
Hamed
262
262
1
I tried, just same result the first field is type int so it takes also with no 'x', but waht i mean is that the queries insert the data into de data base but prestashop cant list products i think i need to insert in ps_product_shop also. Thanks Hamed.
– Jose Castillo
Nov 22 '18 at 8:42
add a comment |
1
I tried, just same result the first field is type int so it takes also with no 'x', but waht i mean is that the queries insert the data into de data base but prestashop cant list products i think i need to insert in ps_product_shop also. Thanks Hamed.
– Jose Castillo
Nov 22 '18 at 8:42
1
1
I tried, just same result the first field is type int so it takes also with no 'x', but waht i mean is that the queries insert the data into de data base but prestashop cant list products i think i need to insert in ps_product_shop also. Thanks Hamed.
– Jose Castillo
Nov 22 '18 at 8:42
I tried, just same result the first field is type int so it takes also with no 'x', but waht i mean is that the queries insert the data into de data base but prestashop cant list products i think i need to insert in ps_product_shop also. Thanks Hamed.
– Jose Castillo
Nov 22 '18 at 8:42
add a comment |
You need to insert also to ps_product_shop. Adding products by SQL is not good idea becouse there is many dependencis. Better way is use API or CSV import. In product class you have $definitons array it is kinda of map for DB.
https://devdocs.prestashop.com/1.7/development/database/objectmodel/
add a comment |
You need to insert also to ps_product_shop. Adding products by SQL is not good idea becouse there is many dependencis. Better way is use API or CSV import. In product class you have $definitons array it is kinda of map for DB.
https://devdocs.prestashop.com/1.7/development/database/objectmodel/
add a comment |
You need to insert also to ps_product_shop. Adding products by SQL is not good idea becouse there is many dependencis. Better way is use API or CSV import. In product class you have $definitons array it is kinda of map for DB.
https://devdocs.prestashop.com/1.7/development/database/objectmodel/
You need to insert also to ps_product_shop. Adding products by SQL is not good idea becouse there is many dependencis. Better way is use API or CSV import. In product class you have $definitons array it is kinda of map for DB.
https://devdocs.prestashop.com/1.7/development/database/objectmodel/
edited Nov 27 '18 at 22:11
answered Nov 27 '18 at 22:05
Marcin Jaworski
657
657
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53416054%2fprestashop-products-inserted-by-db-not-showing%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Do you have a table named
ps_category_product
? In 1.6 it was here that the link between category and product was made, but I don't know for 1.7– Fanie Void
Nov 21 '18 at 16:27
Can you have a look in your database ? Does your data is here ?
– Fanie Void
Nov 21 '18 at 16:32