Jump to content

CSV Import Problem with Customizable column (1.6.1.4)


hanny137

Recommended Posts

Hello,

 

I'm trying to import items with CSV  - in the customizable column it says 0 = No, 1 = Yes.

 

I've read a few other threads about this and it looks like it should be formatted like this:

 

"Field 1"|1, "Field 2"|1

 

But when I try to upload the products with that in the customizable column - it fails the import.

 

If I change it to just 1 or 0, the upload succeeds; but then I have to go into each product, then click on customization, then click on customization and save it.

 

What is the appropriate way to format the upload CSV so that the customizable fields save appropriately?

 

I'm using 1.6.1.4.

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...

Thanks again to no one on the forums - I have figured it out myself with the following script (adjust as needed):

 

I hope this helps someone who like me, can't find ANYTHING regarding this.

// Create connection
$conn = new mysqli($servername, $username, $password, $database);

/* check connection */
if ($conn->connect_errno) {
    printf("Connect failed: %s\n", $mysqli->connect_error);
    exit();
}
echo "Connected successfully<br /><br />";

$conn->query("update ps_category_lang set name=SUBSTRING_INDEX(name, '(', 1)  WHERE  name REGEXP '([[:digit:]]+)';"); 

$conn->query("truncate table ps_customization_field;");
$conn->query("INSERT INTO ps_customization_field (id_product,type,required) SELECT id_product,0,0 FROM ps_product WHERE id_shop_default = 1 AND customizable = 1;");
$conn->query("INSERT INTO ps_customization_field (id_product,type,required) SELECT id_product,1,1 FROM ps_product WHERE id_shop_default = 1 AND customizable = 1;"); 

echo "Added uploadable files & customized field to each item!<br /><br />";

$conn->query("truncate table ps_customization_field_lang;");
$conn->query("INSERT INTO ps_customization_field_lang (id_customization_field, id_lang,id_shop,name) select id_customization_field,1,1,'Upload 1' from ps_customization_field WHERE type = 0;");
$conn->query("INSERT INTO ps_customization_field_lang (id_customization_field, id_lang,id_shop,name) select id_customization_field,1,1,'Field 1' from ps_customization_field WHERE type = 1;");

echo "Added appropriate labeling for each field, for each product!<br /><br />";

echo "<h2>Yay, We're done!</h2>";


$conn->close();
Link to comment
Share on other sites

  • 1 month later...

Hi i am trying to do the same thing i have ran the script it connects to the database no problem says it did everything but nothing happens to the product it doesnt show in front office im on version 1.6.1.6 i thought i remembered reading something about default shop id being 2 now or something similiar do you think that is the issue?

 

 

thanks

fred

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...