cancel
Showing results for 
Search instead for 
Did you mean: 

setting catalog version on impex owner field

Former Member
0 Kudos

Hi, I need to set catalog version for the owner field on impex for the product owner(Product.code); I tried to define this owner(Product.code,catalogversion); but it gives unknown attributes [Item.catalogversion] How can I set this? thanks

Accepted Solutions (0)

Answers (2)

Answers (2)

andyfletcher
Active Contributor
0 Kudos

You're very close. You need to tell it on the catalogVersion attribute header that it is importing a Product too.

Try this:

 INSERT_UPDATE Product;code[unique=true];catalogVersion(catalog(id),version)[unique=true];owner(Product.code,Product.catalogVersion(catalog(id),version))
 ;test1;Default:Staged
 ;test2;Default:Staged;test1:Default:Staged

or if you'd prefer with a macro for $catalogVersion

 $catalogVersion=catalogVersion(catalog(id[default=Default]),version[default=Staged])
 INSERT_UPDATE Product;code[unique=true];$catalogVersion[unique=true];owner(Product.code,Product.$catalogVersion)
 ;test1
 ;test2;;test1
Former Member
0 Kudos

I'm not sure there is direct way to assign catalog aware item as owner from impex.

Still you can achieve it by using document id reference. some thing like below will work for you

 $productCatalog=testProductCatalog
 $catalogVersion=catalogversion(catalog(id[default=$productCatalog]),version[default='Online'])[unique=true,default=$productCatalog:Online]
 
 INSERT_UPDATE Product;code[unique=true];&ref;$catalogVersion;
 ;testproduct;&testproduct
 
 insert_update Address;firstName;owner(&ref)[forceWrite=true]
 ;testname;&testproduct