This guide will show you how to update an attribute value for a given product relation using the CSV product importerRelated Product Attributes Importer.
Let’s imagine that we have a product (name (sku)) “Vintage Cassete Player (vintageA)” and that this product have two product relations with attributes and, under each of these relations, two related products:
...
To update each attribute value of each product under each relation type we will need 5 columns fill in our CSV. One column header is “SKU” which will have the value of the product that have the relations we are working with, in our example it will be “vintageA”, the sku of “Vintage Cassete Player”. The other four columns headers are going to be written in the following pattern:
Relation Attribute:{Relation Type Name}:{Attribute Name}
“Relation Attribute”: This indicates to the importer that this column will update the attribute values of a product relation.
“{Relation Type Name}”: Change this with the name of the target relation type, for instance “Customer Also Bought”.
“{Attribute Name}”: Change this with the name of the target attribute, for instance “Golden Tags”
So for our example, here are the other 4 columns headers we need:
Relation Attribute:Customer Also Bought:Call to Action
Relation Attribute:Customer Also Bought:Golden Tags
Relation Attribute:Recommended:Call to Action
Relation Attribute:Recommended:Golden Tags
Don’t forget the “:” and to write correctly the relation type name and the attribute name, both case sensitive.
Each entry in these special columns needs to be written with this pattern:
{Product SKU} ({Attribute Value}) || {Product SKU} ({Attribute Value}) || …(repeat if necessary)
...
“{Product SKU}”: the sku of the related product that will receive the attribute values.
...
a CSV file with the following headers structure:
Product (ID or SKU): The ID or the SKU of the product.
Related Product (ID or SKU): The ID or the SKU of the related product.
Relation Type Name: The name of the product relation type.
Attribute Name: The name of the attribute.
Attribute Value: The value to be set. If the attribute is a “multiselect” one then you can pass multiple values by separating each of them with a comma. Like, in our example, for “Golden Tags” we could write “(Hot“Hot, Tech, Avant-garde)”.
“||”: separate each related product with “||” if necessary
Let’s see how we have each entry in our CSV to better illustrate this:
Relation Attribute:Customer Also Bought:Call to Action
vintageB (Buy now!) || vintageC (Click to be happy)
Relation Attribute:Customer Also Bought:Golden Tags
vintageB (Hot, Hype) || vintageC (Avant-garde)
Relation Attribute:Recommended:Call to Action
retroA (Find out why!) || retroB (You should be dancin` yeah!)
Relation Attribute:Recommended:Golden Tags
retroA (Hot, Tech) || retroB (Pro, Hot, Avant-garde, Hype)
...
garde”.
You can also download a CSV template at “Import/Export > CSV Importers > Related Prod. Attributes > Download Example CSV Template”.
All columns are case sensitive, always check your CSV file for typos.
How our final CSV file will look like:
...
Now you just have to import this file into “Import/Export > CSV Importers > Products” Related Prod. Attributes” and voilà!
...
...
You can also use the importer to clear the attribute values, for that just leave the “Attribute Value” entry empty at the line you want to do that. In the file below we are clearing the attribute value for product “vintageA”, related product “vintageB”, relation “Customer Also Bought” and attribute “Golden Tags”:
...
If something does not work as you expected check the logs for “Import Related Product Attributes from CSV” on the “Jobs” page, there you’ll find more details about what went wrong during the import process.