webddr.net Posted July 19, 2013 Share Posted July 19, 2013 Hi, I am new in prestashop, I plan to create special page to insert fix type of product for intern use. Is there a function or way to save the product data/object programmatically? I am imagine it will look like drupal add node programmatically. If this not possible for now, anyone can tell me what tables are affected each time we adding product with combination? Sorry for my bad English Thanks Link to comment Share on other sites More sharing options...
webddr.net Posted July 19, 2013 Author Share Posted July 19, 2013 anyone can help? Link to comment Share on other sites More sharing options...
El Patron Posted July 19, 2013 Share Posted July 19, 2013 please search on prestashop webservice...this may give you some insight on how to do this without using csv here is the official doc http://doc.prestashop.com/display/PS15/Using+the+PrestaShop+Web+Service 1 Link to comment Share on other sites More sharing options...
webddr.net Posted July 19, 2013 Author Share Posted July 19, 2013 Prestashop webservice, a lot thing to learn, but at least I know where to start Thanks El Link to comment Share on other sites More sharing options...
El Patron Posted July 19, 2013 Share Posted July 19, 2013 it's a pretty cool part of native prestashop that I hope in the future to use more... enjoy! Link to comment Share on other sites More sharing options...
GOKULAN R Posted October 6, 2014 Share Posted October 6, 2014 it is possible to create new product by php code (program) $product = new Product();$product->ean13 = 9999999999999;$product->name = array((int)Configuration::get('PS_LANG_DEFAULT') => 'Test importu');;$product->link_rewrite = array((int)Configuration::get('PS_LANG_DEFAULT') => 'test-importu');$product->id_category = 2;$product->id_category_default = 2;$product->redirect_type = '404';$product->price = 22;$product->quantity = 1;$product->minimal_quantity = 1;$product->show_price = 1;$product->on_sale = 0;$product->online_only = 1;$product->meta_keywords = 'test';$product->is_virtual=1;$product->add();$product->addToCategories(array(2));$shops = Shop::getShops(true, null, true); $image = new Image();$image->id_product = $id_product;$image->position = Image::getHighestPosition($id_product) + 1;$image->cover = true; // or false;if (($image->validateFields(false, true)) === true &&($image->validateFieldsLang(false, true)) === true && $image->add()){ $image->associateTo($shops); if (!AdminImportController::copyImg($id_product, $image->id, $url, 'products', false)) { $image->delete(); }} 2 Link to comment Share on other sites More sharing options...
mardon Posted November 6, 2014 Share Posted November 6, 2014 (edited) it is possible to create new product by php code (program) $product = new Product(); $product->ean13 = 9999999999999; $product->name = array((int)Configuration::get('PS_LANG_DEFAULT') => 'Test importu');; $product->link_rewrite = array((int)Configuration::get('PS_LANG_DEFAULT') => 'test-importu'); $product->id_category = 2; $product->id_category_default = 2; $product->redirect_type = '404'; $product->price = 22; $product->quantity = 1; $product->minimal_quantity = 1; $product->show_price = 1; $product->on_sale = 0; $product->online_only = 1; $product->meta_keywords = 'test'; $product->is_virtual=1; $product->add(); $product->addToCategories(array(2)); $shops = Shop::getShops(true, null, true); $image = new Image(); $image->id_product = $id_product; $image->position = Image::getHighestPosition($id_product) + 1; $image->cover = true; // or false; if (($image->validateFields(false, true)) === true && ($image->validateFieldsLang(false, true)) === true && $image->add()) { $image->associateTo($shops); if (!AdminImportController::copyImg($id_product, $image->id, $url, 'products', false)) { $image->delete(); } } Hi and its possible create this way a product with specific product_id? When i run this script I obtain error : Call to protected method AdminImportControllerCore::copyImg() from context Edited November 6, 2014 by mardon (see edit history) Link to comment Share on other sites More sharing options...
enSysRanjit Posted December 3, 2014 Share Posted December 3, 2014 We can achieve this by overriding AdminImportController class and make copyImage() method as public. Now you can access copyImage() method from anywhere. Hope it will help. Link to comment Share on other sites More sharing options...
sami_c Posted December 5, 2014 Share Posted December 5, 2014 Hi, How can I define product features when adding new product ? Thanks Link to comment Share on other sites More sharing options...
sami_c Posted December 6, 2014 Share Posted December 6, 2014 I tried Product::addFeatureProductImport but it doesn't work Link to comment Share on other sites More sharing options...
hakeryk2 Posted May 30, 2019 Share Posted May 30, 2019 @sami_c I am looking for this as well, If You found it out how to add custom value for feature group then I will be very happy if You will share with it. Link to comment Share on other sites More sharing options...
Totti Posted March 3, 2020 Share Posted March 3, 2020 Any solution ? Link to comment Share on other sites More sharing options...
hakeryk2 Posted March 4, 2020 Share Posted March 4, 2020 If You are asking for custom feature add then look here Link to comment Share on other sites More sharing options...
Paul Albers Posted March 6, 2020 Share Posted March 6, 2020 Hey, Depends on how you will do this and how you can access the prestashop database. For myself, I have access from outside to my database (well, the database is running local and the website is running external from my provider) and so I can do anything I want. So I made a windows program (c#) that controls almost everything, including adding products automatically. To do so, you have to add data to a lot of rows in your database suchs as ps_product, ps_product_lang, ps_product_shop, ps_product_supplier, ps_stock, ps_stock_available, ps_image, ps_image, ps_image_lang, ps_image_shop, ps_category_product etc.. You can find the tables for your current version prestashop if you search for prestashop 1.x.x database product or someting like that. Good luck! Link to comment Share on other sites More sharing options...
El Patron Posted March 8, 2020 Share Posted March 8, 2020 https://devdocs.prestashop.com/1.7/development/webservice/ Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now