blondie63 Posted September 20, 2012 Share Posted September 20, 2012 Hi, i've a webapp (Codeigniter & PHP) to manage products catalogs (www.catalogo.mobi) I'm looking Prestashop 1.5 to create public stores I'd like to add products and categories from my webapp to a Prestashop store using Prestashop built-in Web Services. Is it possible ? Are there some sample php code like that i need ? Thanks for help Blondie Link to comment Share on other sites More sharing options...
Programmers Direct Posted September 20, 2012 Share Posted September 20, 2012 I am not sure abotu the web services, but you can export your product tables and categories to an excel format from phpMyAdmin panel and then make it into a cvs file. You can import products and categories into prestashop with the cvs files and there you go. Additionally, prestashop 1.5 handles phones, ipads, and the other mediums; in addition to the multi-store front options. Soon I will have my prestashop service website up and I will be doing this for people who need it as I am very handy with migration of categories, products and such. If I can help in any way let me know. Link to comment Share on other sites More sharing options...
blondie63 Posted September 20, 2012 Author Share Posted September 20, 2012 No sorry, i need to create a php code to export items from my DB to Prestashop DB to mantain our Prestashop stores updated ! All must be done by code, nothing manually Link to comment Share on other sites More sharing options...
math_php Posted September 21, 2012 Share Posted September 21, 2012 Hi blondie63, I had same issue and to make it I made a module. Also you can mix webservice capacity with a module to get what you want. Main problem was that product in prestashop have an integer for identification, I choosed to squat supplier reference to keep relation with my existing product on a foreign system An other issue was importing images to this products. The best documentation about your request is to look at AdminImport.php. At the time I did not found solution to import images with webservice then for me module is still the best way. Good luck Link to comment Share on other sites More sharing options...
blondie63 Posted September 21, 2012 Author Share Posted September 21, 2012 Hi blondie63, I had same issue and to make it I made a module. Also you can mix webservice capacity with a module to get what you want. Main problem was that product in prestashop have an integer for identification, I choosed to squat supplier reference to keep relation with my existing product on a foreign system An other issue was importing images to this products. The best documentation about your request is to look at AdminImport.php. At the time I did not found solution to import images with webservice then for me module is still the best way. Good luck There's no AdminImport.php in v1.5 ! Link to comment Share on other sites More sharing options...
math_php Posted September 21, 2012 Share Posted September 21, 2012 (edited) Ok ok rather an AdminImportController.php ! Edited September 21, 2012 by math_php (see edit history) Link to comment Share on other sites More sharing options...
blondie63 Posted December 3, 2012 Author Share Posted December 3, 2012 Hi blondie63, I had same issue and to make it I made a module. Also you can mix webservice capacity with a module to get what you want. Main problem was that product in prestashop have an integer for identification, I choosed to squat supplier reference to keep relation with my existing product on a foreign system An other issue was importing images to this products. The best documentation about your request is to look at AdminImport.php. At the time I did not found solution to import images with webservice then for me module is still the best way. Good luck i've successful tested image upload with code found here: http://doc.prestasho...mage+management but i'm searching a sample code to add one product via webservice.. Link to comment Share on other sites More sharing options...
peorthyr Posted February 14, 2013 Share Posted February 14, 2013 if you like, i've done a little test in php, using the webservice on PS1.5 here the code: <html><head><title>CRUD Tutorial - Create example</title></head><body> <?php // Here we define constants /!\ You need to replace this parameters define('DEBUG', true); define('PS_SHOP_PATH', 'http://www.myserver.it/folder'); define('PS_WS_AUTH_KEY', 'myauthkey################'); require_once('./PSWebServiceLibrary.php'); $webService = new PrestaShopWebservice(PS_SHOP_PATH, PS_WS_AUTH_KEY, DEBUG); $opt = array('resource' => 'products'); // $opt['id'] =8; $xml = $webService->get(array('url' => PS_SHOP_PATH.'/api/products?schema=blank')); // $xml = $webService->get($opt); $resources = $xml->children()->children(); $resources->price = '731.86'; $resources->link_rewrite = "link_rewrited_for_this_new_product"; $resources->name = "name ofthe new product"; $resources->associations->categories->category->id="11"; $resources->associations->combinations->id = "38"; unset($resources->position_in_category); unset($resources->manufacturer_name); unset($resources->quantity); try { $opt = array('resource' => 'products'); $opt['postXml'] = $xml->asXML(); $xml = $webService->add($opt); // if WebService don't throw an exception the action worked well and we don't show the following message echo "Successfully added."; } catch (PrestaShopWebserviceException $e) { // Here we are dealing with errors echo '<b>Error : '.$e->getMessage().'</b>'; } ?> </body></html> i have unset some field because they gave me errors. also, combinations and categories ID are known, i'm testing a way to: insert a category, insert a product in that category, insert a bunch of combinations for that product and last make the product HAS those combinations, with different prices. actually, i'm not getting on the right way, but i have to do this, so i'll find a way hope this helps people out of here, where the ONLY documentation is that on doc.prestashop, whcih is a bit poor... Link to comment Share on other sites More sharing options...
spherica Posted April 8, 2013 Share Posted April 8, 2013 Hallo, have you fond the right solution about your work? i need to do the same work. Link to comment Share on other sites More sharing options...
mattix19 Posted October 15, 2013 Share Posted October 15, 2013 I have the same problem. I need to add product via webservice but i don't know how to add category and image with them Link to comment Share on other sites More sharing options...
peorthyr Posted October 15, 2013 Share Posted October 15, 2013 i have solved this issue by adding "manually" i mean inserting things directly in the database both for categories and combinations, while the products are added via webservice... this is done primary for timeout issues, then for the complete lack of informations about those webservices and prestashop in general. i'm really disappointend about the support prestashop gives to its own users. by the way, on stackoverflow .com there are many more people that gives an hand to those stuck in such programs issues. Link to comment Share on other sites More sharing options...
mattix19 Posted October 15, 2013 Share Posted October 15, 2013 Thanks for your replay. Prestashop has very bad documentation about webservice (generally i would say it sux) so everybody has the same problem all the time. I'll try to do this via webservice but i think i'll need to forgive this and do this manually like you do. 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