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

synchronization: filter products

Former Member
0 Likes
1,373

Is it possible to filter products during catalog-synchronization?

Use case: - master catalog with whole product set - country catalogues with subset of master products

Thanks in advance, Heiko

Accepted Solutions (0)

Answers (7)

Answers (7)

Former Member
0 Likes
  1. The way to go is described here https://wiki.hybris.com/pages/viewpage.action?spaceKey=hybrisALF&title=Catalog+Synchronization, why it doesn't work for you, can you provide the steps?

  2. JobSearchRestriction is deprecated feature for a long time

According to our present recommendation, it is not a good approach any more to use the JobSearchRestrictions. In other words, it is not recommended to assign restrictions directly to the synchronization job. The best way to achieve your goal is to define a restriction for a dedicated user who will act as the synchronization job "runner". The sole purpose of this user existence is to restrict the scope of synchronized products by means of restrictions applied to him. Additional advantage of using restrictions concept is that they outcome can be seen as a result of Flexible Search query (respective tool available in administration console) so you can test them easily. Afterwards the forementioned user should be configured on the synchronization wizard -> advanced attributes tab -> session attributes section -> user field.

tino_kissig
Active Participant
0 Likes

The Jira link doesn't work for me.

Shouldn't the deprecation of JobSearchRestriction be mentioned here?

Former Member
0 Likes

Probably, please create a ticket for the documentation team.

Former Member
0 Likes

Thanks for your answer. I appreciate your frankness.

But a "normal" search restriction will not work! We have a masterCatalog as source and a lot of country-Catalogues as targets. This is a scenario you (Hybris) describe in your docu (https://help.hybris.com/6.6.0/hcd/8c6a38118669101481bdf1303d70949e.html)

That means: the result of the search-restriction depends on the target of the synchronization. That's why a user-dependant search restriction will not work, bute the JobSearchRestriction would be the perfect way.

I consider it as a bug and would request you to arrange a fix of it. Our proposal to the customer is based on your documentation and your advices.

If you say "After looking into the code it seems that JobSearchRestrictions are ignored by the sync job", than I ask: why? Is there a way to improve it?

Thanks in advance, Heiko.

tino_kissig
Active Participant
0 Likes

No idea why you think I'm affiliated with Hybris. I was just trying to find a solution with you since this issue might be important for us one day...

Nevertheless I still think that "normal" search restrictions can help here. You have to have a sync job per target catalog anyways. So you can have one user per sync with different restrictions that will be applied.

Former Member
0 Likes

Oh sorry, I considered you as a hybris guy :-) I will try it. Thanks.

tino_kissig
Active Participant
0 Likes

Since my first answer was obviously not the way to go please try this approach: https://wiki.hybris.com/pages/viewpage.action?spaceKey=hybrisALF&title=Catalog+Synchronization

Basically it's the solution I was suggesting here.

Former Member
0 Likes

Yes. I created an own item: OutboundChannel, with a relation to products. So I can compare againts it.

But where do I have to compare it? I did it within the JobSearchRestriction, but no success.

Former Member
0 Likes

Hi ,

You will need to have an attribute(i.e catalogRegion) at catalogVersion level to differentiate it for different countries. Then you can either customize the CatalogVersionSyncJob directly OR use interceptors by creating a product attribute and comparing its value with value in catalogRegion attribute.

Regards Rahul

Former Member
0 Likes

Thanks, Tino

ut But unfortunately it does not work. To test it in easy way, I added a restriction with some fix primary keys of existing products in source catalog version:

INSERT_UPDATE CatalogVersionSyncJob;code[unique=true];$sourceProductCatVer;$targetProductCatVer; ;syncProductCatalog_Master->Online;;;;

INSERT_UPDATE JobSearchRestriction;code[unique=true];job(code);type(code);query ;Sync_OutboundChannelRestriction;syncProductCatalog_Master->Online;Product;{pk} in (8796093054977, 8796093120513)

But the sync job does not care about it :-( Any idea?

Heiko

tino_kissig
Active Participant
0 Likes

That's weird. That's exactly how it should work.

As another approach you could create a "normal" search restriction and hook it onto a new user. Then run the sync job as this special user.

Former Member
0 Likes

But it does not work. Hybris-bug? Feature? Anything wrong on my side?

Former Member
0 Likes

The restriction will never be used. If I insert some wrong syntax, there is no error during synchronization.

tino_kissig
Active Participant
0 Likes

Good question. Seems like legacy data model which is not used anymore. Strange that it's still mentioned in the documentation. I can't see what should be wrong on your side...


Update: After looking into the code it seems that JobSearchRestrictions are ignored by the sync job.

agrabovskis
Participant
0 Likes

Could it be that you're running it with user that is a member of admingroup? Search restrictions are not applied to members of admingroup, but I would have guessed that the job search restrictions should be applied. But at least another clue to follow.

tino_kissig
Active Participant
0 Likes

Please see section "Using Restrictions with Jobs" here: https://help.hybris.com/6.6.0/hcd/8b9ce4868669101499b2f0f25ef9395f.html

TL;DR Create one or more JobSearchRestrictions and add them to your sync job.