cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to use UPDATE impex in a Batchmode? I need to update an attribute of all products in a Product table?

Former Member
View Entire Topic
andyfletcher
Active Contributor
0 Kudos

You need to specify something to match on, i.e. you need at least one [unique=true] column. Often with other types you can use itemtype(code) but this doesn't work as well for Product because you need to specify each type that extends product

 UPDATE Product[batchmode=true];itemtype(code)[unique=true];myattribute
 ;Product;foo
 ;VariantProduct;foo
 ;MyCustomProductType;foo

With types that have a boolean attribute it becomes much simpler because there are only 2 options (assuming it's not optional)

 UPDATE AbstractCMSComponent[batchmode=true];visible[unique=true];myattribute
 ;true;bar
 ;false;bar

If the attribute you are updating already contains a known value then you can use this to match on

 UPDATE Product[batchmode=true];myattribute[unique=true];myattribute
 ;before;after # updates all 'myattribute' that are 'before'
 ;;after # updates all 'myattribute' that are blank