Jump to content

CSV import : product with text field


Recommended Posts

Hi !

 

I want to import product in prestashop, and I need that all product get a text field. So I use this :

Text field (0 = No, 1 = Yes)

 

But, after import I need to go to every imported products, go to Customization tab, give my field a name and save.

 

I read this topic : https://www.prestashop.com/forums/topic/319630-csv-import-and-file-fields/ and try :

 

"fieldname1"|1, "fieldname2"|1, "fieldname3"|0, "fieldname4"|0

 

But then I get a error message :

 

Property Product->text_fields is not valid

 

Have anyone a solution for that problem ?

  • Like 1
Link to comment
Share on other sites

  • 2 months later...
Hi, 

 

I nedeed to add a text filed for all my product so I create this script and launch it : 

 

$db = new DB();

 

if (($db != null) && ($db->isOk()))

{

$rs = mysql_query("update ps_category_lang set name=SUBSTRING_INDEX(name, '(', 1)  WHERE  name REGEXP '([[:digit:]]+)';");

$rs = mysql_query("truncate table ps_customization_field;");

$rs = mysql_query("INSERT INTO ps_customization_field (id_product,type,required) SELECT id_product,1,0 FROM ps_product WHERE id_shop_default = 2;"); 

$rs = mysql_query("truncate table ps_customization_field_lang;");

$rs = mysql_query("INSERT INTO ps_customization_field_lang (id_customization_field, id_lang,id_shop,name) select id_customization_field,1,2,'Taille du cadre' from ps_customization_field;");

}

 

You could adapt it and use it. 

Link to comment
Share on other sites

No, it's a php file, you must run it from the browser.

 

This bit of code delete the content of the table ps_customization_field and ps_customization_field_lang and add for each product where is in the shop 2, a text field named 'Taille du cadre'. So you will have to adapt it for your use. And you must enter the information to connect DB.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...