on 03-01-2017 3:03 PM
Hi everyone
is there any way to avoid an impex statement to add the same category multiple times when using append
mode? I think there should be a way to match the pre-existing values and void a duplication.
ie.
INSERT_UPDATE Product;code[unique=true];supercategories(code,$catalogVersion)[mode=append];$catalogVersion
;PRODUCT1;ZMKT_001,ZMKT_002
;PRODUCT1;ZMKT_001,ZMKT_002
would add 2 times ZMKT_001 and 2 times ZMKT_002, while it would only add them once.
Add directly to the category -> product relationship instead and you can enforce uniqueness.
INSERT_UPDATE CategoryProductRelation;source(code,$catalogVersion)[unique=true];target(code,$catalogVersion)[unique=true]
;ZMKT_001;product1
;ZMKT_002;product1
The main problem with this approach is that it doesn't update the modification time of the product so it won't know that it needs to be synced.
You could try something like this to 'touch' the product after updating (legacy scripting disabled)
INSERT_UPDATE CategoryProductRelation;source(code,$catalogVersion)[unique=true];target(code,$catalogVersion)[unique=true]
"#%groovy% afterEach: impex.lastImportedItem.target.modificationTime = new Date()"
;ZMKT_001;product1
;ZMKT_002;product1
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nicola
Here is a good start https://wiki.hybris.com/display/release5/ImpEx+API#ImpExAPI-WritingOwnTranslator .
Check also existing hybris translators tp have a better understanding.
Regards,
Florin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
From what i know the only way is to write your own translator.
It exists only append and replace.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
5 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.