cancel
Showing results for 
Search instead for 
Did you mean: 

Duplicate categories were getting created in mode=append

Former Member
0 Kudos

Hi Team,

Duplicate categories were getting created after adding mode=append in supercategories header. Kindly help me how to resolve this issue.

Example scenario: we have loaded category1 to product1, after that we are trying to add category1,category2 to product1 then dupliate categories(category1) were creating in the hybris for product1, can anyone help me how to resolve this issue.

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Thanks for your response ,

Yes we can achieve it by using prepareInterceptor, but i have one more solution , we have categoryproductrelation table in OOTB and i am planning to create product and in the same ImpEx i will map category to product using categoryproductrelation table so in this case if we receive multiple updates with same category then instead of appending it will map only one category.

Any thoughts.

Thanks,

Suresh G.

vinay_malempati
Active Participant
0 Kudos

The best way i can see is to write a prepareinterceptor and there you do lie this

product.setCategories(Set(product.getcategories))

rahulverma94
Active Participant
0 Kudos

Hi ,

Write a translator on supercategories field , so that it checks duplicacy before associating categories to product. Let me know if it worked.

andyfletcher
Active Contributor
0 Kudos

Insert the relationship directly to enforce uniqueness of both the source and target.

See https://answers.sap.com/questions/12762356/impex-append-mode-duplicating-fields.html?childToView=127...

former_member1320010
Participant
0 Kudos

this is how we did this , but also we ensured to manually update the modifiedtime as these were not considered by the sync

former_member618655
Active Participant
0 Kudos

Hi Suresh

you can do the following

INSERT_UPDATE Product;code[unique=true];categories(code, $catalogVersion)[mode=append]
;product1;category1

INSERT_UPDATE Product;code[unique=true];categories(code, $catalogVersion)[mode=append]
;product1;category2

or you can do this

INSERT_UPDATE Product;code[unique=true];categories(code, $catalogVersion)[mode=append]
;product1;category1

INSERT_UPDATE Product;code[unique=true];categories(code, $catalogVersion)[mode=replace]
;product1;category1, category2

hope it helps!

Former Member
0 Kudos

Hi Swaurabh,

Thanks for your reply,

I have tried above approach but few more categories existing to the product is getting replaced. So what are the categories we are sending through ImpEx those were saving.

Thanks, Suresh G.