jahyax Posted August 23, 2013 Share Posted August 23, 2013 Good day everyone I have searched the forum regarding how to add a custom field on product CSV import, found some useful thread, but it doesn't solve my problem I am trying to add a custom field on Product CSV import, somehow I manage to add an option/selection to add my custom field, but when I try to hit 'CSV Import' I still get an empty value on my database. currently the files that I am messing with are AdminImportController.php and Products.php Hopefully someone could give a better direction.. on what to.. i am using prestashop 1.5.4 Link to comment Share on other sites More sharing options...
jahyax Posted August 23, 2013 Author Share Posted August 23, 2013 never mind about this thread Figured it out already.. Link to comment Share on other sites More sharing options...
PascalVG Posted August 24, 2013 Share Posted August 24, 2013 Hi Jahyax, for completeness sake, can you shortly describe what you did to make it work? Thx, pascal Link to comment Share on other sites More sharing options...
jahyax Posted August 25, 2013 Author Share Posted August 25, 2013 Sorry for not being so detailed.. I did add a field on my database first.. which is on PREFIX_products --- I added customfield Here is how did it.. On AdminImportController I added on the 'customfield' => array('label' => $this->l('My Custom Field')), //somewhere on line 238 and also on public function productImport() I added if (isset($product->customfield){ $product->customfield = $product->customfield; } 1 Link to comment Share on other sites More sharing options...
smallbizwiz Posted November 22, 2013 Share Posted November 22, 2013 In 1.5.6, I found a direct database entry was "easiest"...crazy you can't do this through the standard CSV import...Anways, here's a sample code that should work... INSERT into ps_customization_field (id_customization_field, id_product, type) VALUES ('7','5','1'); INSERT into ps_customization_field_lang (id_customization_field, id_lang, name) VALUES ('7','1','Comments'); UPDATE ps_product Set customizable = '1', text_fields = '1' where id_product = '5'; UPDATE ps_product_shop Set customizable = '1', text_field = '1' where id_product = '5'; NOTE: the "7" need to auto-increment as this is the PK/FK, and "5" matches each product. I created an Excel sheet that automatically creates these four lines of SQL for every product, then copied that into a text file, then copied that into phpMyAdmin...worked like a charm...ugh 1 Link to comment Share on other sites More sharing options...
kolega Posted May 13, 2014 Share Posted May 13, 2014 (edited) I followed @Jahayx's code, but its not working on prestashop on v 1.6.0 ... Should I add anything to product class? (classes/Product.php) Ty for advice Its working, but it dont store it to database, if i'll try to list it in mysql using SELECT real_name FROM ps_product; i get NULL, using this code if (isset($product->real_name)) { $product->real_name = $product->real_name; } Edited May 13, 2014 by kolega (see edit history) 1 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