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

How to override CatalogVersionSync Job to sync products from the master catalog to appropriate product catalogs based on product attribute?

Former Member

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Manas,

our issue is/was not totally the same, but probably it helps: We had the issue that during synchronization, the catalog version of some items (VariantProducts) switches to a wrong online catalog.

We solved this in this way, that we added a line in

 de.hybris.platform.variants.jalo.GenericVariantProductVariantProduct.createItem(SessionContext, ComposedType, ItemAttributeMap)

to fix the catalog version. Hint: Our change is not directly in GenericVariantProductVariantProduct but in one project specific subtype.

With this solution you probably only need one sync job.

Regards

Wolfgang

former_member686625
Participant
0 Kudos

Hi Vinay,

You can achieve this by creating 2 syncjob with different target catalog and different restriction on each of them based on your attribute value.

So for masterCatalog:Staged->childCatalogA:Online, you need to put restriction something like: {pk} in ({{Select {p:pk} from {Product as p} where {p:childCatalog} = 'A'}})

and for syncJob masterCatalog:Staged->childCatalogB:Online something like: {pk} in ({{Select {p:pk} from {Product as p} where {p:childCatalog} = 'B'}})

To apply this restriction, you need to: 1. open sync job and go to "advanced Attriutes" tab. 2. Go to "Session Attribute" section and create a new user. 3. Open user and go to tab "personalization". 4. Create a Personalization rule and give the above mentioned query. Select "Restricted Type" as Product and "apply on" - the user you just created for this job. 5. Save it and run the job.

I hope this will help.

Former Member
0 Kudos

Hi @Manish,

Thanks for your answer. But this restriction will not work for admin users. Also this will not work for single product sync from product cockpit.

former_member686625
Participant
0 Kudos

Hi Manas,

Even if you run the job with admin, restriction will apply as we have explicitly assigned user in session(as I mentioned above) and we are applying restriction on it.

"this will not work for single product sync from product cockpit." - Yes it won't in this case.

Regards.

vinay_malempati
Active Participant
0 Kudos

Hi Manas,

You should be able to use the sync attribute descriptor impex foreach source and target combination, this works only for job, not individual.

 #Product model properties for sync from staged to online
 INSERT_UPDATE SyncAttributeDescriptorConfig;syncJob($sourceProductCV, $targetProductCV)[unique=true];attributeDescriptor(enclosingType(code), qualifier)[unique=true];includedInSync;copyByValue
 ;;Product:attributeQualifierForCustomType;true;true
Former Member
0 Kudos

Hi ,

Its not about syncing a product attribute. Its about syncing a product based on the value of a particular product attribute.

Example: Product Flag P1 A p2 B P3 A

My master catalog has 3 products p1,p2,p3 having flag values A,B and A respectively. Now when i use the masterCatalog:Staged->childCatalogA:Online job it should pick up p1 and P3 products to sync and not P2 even if P2 is changed. Similarly masterCatalog:Staged->childCatalogB:Online job should pick up product p2 and not p1 and p3.