cancel
Showing results for 
Search instead for 
Did you mean: 

Impex append mode duplicating fields

Former Member
0 Kudos

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.

Accepted Solutions (0)

Answers (3)

Answers (3)

andyfletcher
Active Contributor
0 Kudos

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
Former Member
0 Kudos

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

Former Member
0 Kudos

From what i know the only way is to write your own translator.
It exists only append and replace.

Former Member
0 Kudos

thanks Florin. Do you have any starting point to take a look or do you think it needs to be developed from scratch?

rahulverma94
Active Participant
0 Kudos

Hi Nicola,

How did you resolve this issue? Any help with approach please? We are facing the same issue.

Thanks in advance.