Jump to content

Import features, overwrite existing


Recommended Posts

Hello,

 

I am currently figuring out how to import all products the right way.

The thing I'm working on right now are the features.

 

When I'm uploading a list of new products with as example 1 product with the color Black, it just creates another feature 'Black'. So when I upload 10 products with the color Black, I got 10 new added features with the same name 'Black'.

 

Is it possible to let Prestashop overwrite or just select the existing feature Black?

 

I'm using Prestashop v1.5.6.

 

Thanks!

Edited by nataschakater (see edit history)
Link to comment
Share on other sites

Features

Height:100cm:1, Width:50cm:2, Depth:50cm:3, Color:Brown:4, Weight:1kg:5, Size::6

Height:100cm:1, Width:50cm:2, Depth:50cm:3, Color:Brown:4, Weight:1kg:5, Size::6

Height:100cm:1, Width:50cm:2, Depth:50cm:3, Color:Brown:4, Weight:1kg:5, Size::6

 

As shown above it adds all these same features 3 times.

Edited by nataschakater (see edit history)
Link to comment
Share on other sites

That's what I did in the beginning, which was not working.
Only the last feature was added that way.

 

I read some posts about that not working anymore in Prestashop v1.5.x.

Their solution was to add it like I posted above. It did the trick because now all features are being added.

 

But yeah, not completely the right way.

Link to comment
Share on other sites

For 1.5.6, I have another and weird solution by coincidence :)

 

Note that I didn't replace the classes>FeatureValue.php as recommended through some github pages. I am using the original one.

 

Please use this CSV format below. You'll see that all features are in one column separated by comma.

 

ID;Active;Name;Category;Price Excl. OB;Tax ID Rules;Wholesale Price;On Sale;Discount amount;Discount percent;Discount from;Discount to;Reference;Supplier reference;Supplier;Manufacturer;EAN13;UPC;Eco tax;Weight;Quantity;Short description;Description;URL rewritten;Image URL;Feature
51;1;Modern Barstool 1;Home, Barstools;31.950.000;2;;;;;;;modern_barstool;;;;;;;;15;Lorem ipsum dolor sit amet, consec tetur adipiscing.;Lorem ipsum dolor sit amet, consec tetur adipiscing.;modern_barstool;http://www.righttothedoor.com/img/p/7/0/70.jpg;Height:100cm:0,Width:50cm:0,Depth:50cm:0,Color:Brown:0,Weight:1kg:0,Size::0

Forcing product id or not doesn't matter

 

You don't need to pre-create feature values used in the CSV, if you don't, it will assign the feature value as a custom value.

 

And here is the trick:

 

When you come to the csv import view data - column assigning step, for the features column, select the column name as "Feature(Name:Value:Position)" but leave the custom name field below empty.

 

If everything is set on other columns, click on the "Import .CSV data" button.

 

You'll get the below error when you hit the import button.

Fatal error: Cannot access empty property in blablabla...\controllers\admin\AdminImportController.php on line 792

Don't worry and simply click your browser's back button and again click on the "Import .CSV data" button.

 

You're done! It is funny, huh?  :D

 

The point is that the empty feature name is not opened when we come back and it skips the empty field validation. Hopefully someone creates a bug report, coz I'm done.

Link to comment
Share on other sites

Thanks for your answer. See my comments below.

 

Note that I didn't replace the classes>FeatureValue.php as recommended through some github pages. I am using the original one.

 

Me too, so that's not the problem.

 

You'll see that all features are in one column separated by comma.

 

Already did that in my own CSV file.

 

You don't need to pre-create feature values used in the CSV, if you don't, it will assign the feature value as a custom value.

 

I wasn't pre-creating the feature values and it's automatically adding the features as custom values. It just doesn't assign them when a feature value already exists, it adds a new one.

 

When you come to the csv import view data - column assigning step, for the features column, select the column name as "Feature(Name:Value:Position)" but leave the custom name field below empty.

You'll get the below error when you hit the import button.

 

Already was selecting the "Feature(Name:Value:Position)". Also tried to leave the custom name field empty but no luck. I don't even get that error. It just imports the products and I have all the same feature values multiple times again.

 

 

 

@RCP90

 

So, you're saying that when I update Prestashop to v1.5.6.1, it does not add the same feature value multiple times?
I wanna make sure it will resolve the problem before I start updating. Thanks.

Link to comment
Share on other sites

1.5.6.0 by default will duplicate features values when you import then via CSV, this was a known bug, and I create bug reports.

 

 

Another issue with 1.5.6.0 is that when importing products via CSV categories would randomly be deleted, and also sometimes products will be removed from their correct categories and moved to home category.

 

Your features look fine, there is no issue with them, it is just 1,5.6.0. I recommend to upgrade.

 

I am using 1.5.6.1 and over the past few days have imported 4000 products with zero issues.

Link to comment
Share on other sites

Have you aver tried the 1-click upgrade module? If not, please download the latest version, install, and from the configure link, follow the instructions. It is very easy and it makes a backup to restore back. 

 

It is always better to take a manual database and file backup, though.

Link to comment
Share on other sites

×
×
  • Create New...