manoj_malviya Posted January 28, 2011 Share Posted January 28, 2011 Hi all,As my effort to give back to this great prestashop community, I want to share prestashop product importer.I have developed some php classes, that can be used to push product data in prestashop from any source.So far I have tested it with csv and xml, by virtually it can be used to import data from any source. Since It is developed in OOP way, you can customize/ extend it to suit your need.Note that I haven't developed them as a module but rather it will work as an standalone tool, and can be invoke via command line or url.If anybody need/want to review. please let me know. 1 Link to comment Share on other sites More sharing options...
misa Posted January 28, 2011 Share Posted January 28, 2011 I am interested. Is this for 1.3? Link to comment Share on other sites More sharing options...
manoj_malviya Posted January 28, 2011 Author Share Posted January 28, 2011 I never worked on 1.3Don't know if it work with 1.3.Also not that, it will not work out of box. you may need to adjust some code according to your data source. Link to comment Share on other sites More sharing options...
optiplex1 Posted January 28, 2011 Share Posted January 28, 2011 how to i find older version solutions Link to comment Share on other sites More sharing options...
cha Posted March 9, 2011 Share Posted March 9, 2011 Hi,Very Interested how can I get it? Chavone. Link to comment Share on other sites More sharing options...
manoj_malviya Posted March 10, 2011 Author Share Posted March 10, 2011 Here you go.Should be straight forward to understandBaseClass : ProductImporterChild Class : AccessoryImporter (an example import class)(work for xml data source)AccessoryImporter Can be invoked via command line. ini_set('max_execution_time', 600); //600 seconds = 10 minutes require(dirname(__FILE__).'/../../config/config.inc.php'); require_once('ProductImport.php'); require_once('AccessoryImporter.php'); require_once('Logger.php'); $accessories = Simple_XML_Load('path to xml'); foreach($accessories ->accessory as $acc){ $accessroyImport = new AccessoryImporter(); $accessroyImport ->SetProductSource($acc); $accessroyImport ->Save(); } ProductImporter.php AccessoryImporter.php 4 Link to comment Share on other sites More sharing options...
cha Posted March 10, 2011 Share Posted March 10, 2011 Any suggestions on how to add download_file support (for download products)?Thanx Link to comment Share on other sites More sharing options...
manoj_malviya Posted March 10, 2011 Author Share Posted March 10, 2011 Should be doable. But will need to look into prestashop core, how that work. Link to comment Share on other sites More sharing options...
JulianM Posted October 25, 2011 Share Posted October 25, 2011 Ok, this sounds very exciting. I will try to use it for 1.4.5.1 and see if it works. I have a db of 1000 products to import from a csv and need to update it periodically. Well, I Am assuming that require_once('ProductImport.php'); actually means ProductImporter.php Link to comment Share on other sites More sharing options...
numeric69 Posted May 4, 2012 Share Posted May 4, 2012 hello, how I can add a product from a module with such class? 1 Link to comment Share on other sites More sharing options...
Nozonda Posted May 20, 2012 Share Posted May 20, 2012 Even though it is a while ago that this is posted.. I just want to say thank you! Works great I am connecting an web service to get the products and your classes saved me a lot of time. 1 Link to comment Share on other sites More sharing options...
websku Posted May 21, 2012 Share Posted May 21, 2012 Hi! Thank you for the scripts, I do have few questions. How can I use your script to bulk insert 1000 products with random attributes? I want to test Prestashop stability and performance and I can't find any code to help me import a single product from an external script uploaded to server. If you help a bit, I can share the tests results. Thank you! Link to comment Share on other sites More sharing options...
Nozonda Posted May 21, 2012 Share Posted May 21, 2012 Little bit like his example, but then: for($i=0;$i<1000;$i++){ $accessroyImport = new AccessoryImporter(); $accessroyImport ->SetProductSource(array()); $accessroyImport ->Save(); } And then edit AccessoryImporter.php to make some random values. Like: protected function GetName(){ return "this is a random title ".rand(100000,999999); } You have to change almost every function in there to return something. For features you could use: protected function GetFeatures(){ return array('test'=>'bla','sfdsfd'=>'fsfd'); } Attributes is currently not supported, but shouldn't be too complicated to make if you look at the function AddFeature in ProductImporter.php. Good luck. Link to comment Share on other sites More sharing options...
websku Posted May 25, 2012 Share Posted May 25, 2012 hi. It didn't work, so I found the built-in csv importer and was ok. Thanks anyway! Link to comment Share on other sites More sharing options...
webxtor Posted June 26, 2013 Share Posted June 26, 2013 Thanks! This helped me to complete a project I am working on. I know, most of the functions are from AdminImportController.php but still a good job has been done! Link to comment Share on other sites More sharing options...
ovoce Posted June 27, 2013 Share Posted June 27, 2013 Hay, yo !! Thank You very much ! It is good to get know, how the things works. You save "my life" !! Link to comment Share on other sites More sharing options...
giancarlo.spadini Posted August 6, 2013 Share Posted August 6, 2013 Very interesting. But you have a schema for XML file with products to import? Where I can find an XML file as example? When you write this: $accessories = Simple_XML_Load('path to xml'); Link to comment Share on other sites More sharing options...
giancarlo.spadini Posted August 7, 2013 Share Posted August 7, 2013 (edited) A little contribution. ProductImporter.php line 452 uses a deprecated function: imageResize($newimage, $path.'-'.stripslashes($imageType['name']).'.jpg', $imageType['width'], $imageType['height']); can be replaced with: ImageManager::resize($newimage, $path.'-'.stripslashes($imageType['name']).'.jpg', $imageType['width'], $imageType['height']); So you can also remove line 3 that is no more necessary: include_once(PS_ADMIN_DIR.'/../images.inc.php'); Edited August 7, 2013 by giancarlo.spadini (see edit history) Link to comment Share on other sites More sharing options...
dan.pascu Posted September 14, 2013 Share Posted September 14, 2013 Very interesting. But you have a schema for XML file with products to import? Where I can find an XML file as example? When you write this: $accessories = Simple_XML_Load('path to xml'); Hi Giancarlo, Did you fint the xml schema for this script? Can you share it please? Thank you. Link to comment Share on other sites More sharing options...
giancarlo.spadini Posted September 16, 2013 Share Posted September 16, 2013 Hi Giancarlo, Did you fint the xml schema for this script? Can you share it please? Thank you. No, i haven't found a valid xml for this script. I have solved creating an array (the product) with the fields needed by the calls in function AddUpdated(). If your shop is in Italy, Portugal or Spain we have completed a module to start selling over 10.000 products from our dropshipping wholesales. 1 Link to comment Share on other sites More sharing options...
Galanid Posted June 13, 2014 Share Posted June 13, 2014 Hi, Someone know how to integrat this class in a script in order to import csv containing product ? I need to use a comand line way to import my base product and the only way to do it on my server is commande line as i dont have time out issue with command line environement. ( while if i use the built in csv function it fails) cheers Link to comment Share on other sites More sharing options...
atef1987 Posted November 14, 2014 Share Posted November 14, 2014 hi nozonda, i'm in the same situation, if you can explain to me how to do fix the situation. 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