Skip to Content

How to prevent synchronisation of unapproved products from staged to online?

Hi ,

We have a requirement where a product cockpit user should only be able to sync approved products from staged to online. The product cockpit user should be not be able to sync products whose approval status is checked or unapproved.

How can I achieve this?

Add a comment
10|10000 characters needed characters exceeded

Related questions

5 Answers

  • Posted on Jul 20, 2016 at 07:32 PM

    Hello Abhinav,

    Have you tried creating a restriction/personalization rule for the cockpit user to "see" only approved products?

    Br, Shwetha

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Shwetha,

      I have tried to add this restriction

      INSERT_UPDATE SearchRestriction;code[unique=true];principal(uid)[unique=true];query;restrictedType(code)[unique=true];active;generate ;publisherProductVisibility;publishergroup;{approvalStatus} = ({{select {PK} from {ArticleApprovalStatus} where {code}='approved'}});Product;true;true

      but it seems to have no effect. I am still able to see unapproved and checked products in product cockpit

  • author's profile photo Former Member
    Former Member
    Posted on Jul 26, 2016 at 10:36 PM

    Hi, Shwetha,

    There is one way to synchronize only approved products , we need to apply SearchRestriction (known also as Personalization Rule or Restriction) on synchronization.

    1.Create a new user which will bound to the restriction and sync job

    *Login hmc using an account which has sufficient privileges to manage user accounts and personalization rules

    *Create a new user (here as an example: sync_only_approved_user) and not to assign any groups (Need to remove its default employee group) in order not to bring additional restrictions to obfuscate the results.

    *Save the user!

    2.Define a SearchRestriction for the technical user and product type with specific filter:

    *Click on System and right click on Personalization to create a new personalization rule

    *Enter the rule details and bound to Product and our newly create user, the filter is as follows: ({approvalStatus} IN ({{ select {pk} from {ArticleApprovalStatus} where {code}='approved'}}))

    *Save the personalization rule

    3.Set the user as the session user of the sync job

    *First, let's make some products to "check" and "unapproved", then edit their identifiers

    *Then go back to hmc, click on Catalog, then click on Catalog Management Tools, then click synchronization. We are using hybris OOTB electronics stores here, so lets pick the sync job, click next then right click on the job to edit it

    *Go to Advanced Attribute and find Session Attributes then assign our sync_only_approved_user then save and exit the edit page

    *Execute the synchronization, you will see the following warning in logs indicating we are using the correct user to sync and the rule applied and the log also depicted there is only 1 time been synced.

    *The log looks like:

    WARN [000002BI::de.hybris.platform.catalog.jalo.synchronization.CatalogVersionSyncJob] (000002BI) [CatalogVersionSyncJob] Session user is not admin but sync_only_approved_user[8796125888516] - due to possible restrictions synchronization may not cover all items INFO [000002BI::de.hybris.platform.catalog.jalo.synchronization.CatalogVersionSyncJob] (000002BI) [CatalogVersionSyncJob] Starting configuration ... INFO [000002BI::de.hybris.platform.catalog.jalo.synchronization.CatalogVersionSyncJob] (000002BI) [CatalogVersionSyncJob] Sync 'sync electronicsProductCatalog:Staged->Online' (pk:8796094300660) conf igured 1 entries for job '000002BI' (pk:8796191556085) schedule medias: 1 INFO [000002BI::de.hybris.platform.catalog.jalo.synchronization.CatalogVersionSyncJob] (000002BI) [CatalogVersionSyncJob] Finished configuration in 0d 00h:00m:00s:290ms. INFO [000002BI::de.hybris.platform.catalog.jalo.synchronization.CatalogVersionSyncJob] (000002BI) [CatalogVersionSyncJob] Starting synchronization ... INFO [000002BI::de.hybris.platform.catalog.jalo.synchronization.CatalogVersionSyncJob] (000002BI) [CatalogVersionSyncMaster] 1. pass, 0 (+0) of 1 items processed (0 %), 0.00 items/sec, 0 (+0) items dumped. INFO [000002BI::de.hybris.platform.catalog.jalo.synchronization.CatalogVersionSyncJob] (000002BI) [CatalogVersionSyncJob] Finished synchronization in 0d 00h:00m:00s:440ms. No errors.

    *Now let's go back to product cockpit and check again, the result listed as expected.

    All the steps in screen copy as attached.

    alt text alt text

    Regards

    Haitao


    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 21, 2016 at 06:50 AM
    -1

    Hi Shwetha,

    I have tried to add this restriction

    INSERT_UPDATE SearchRestriction;code[unique=true];principal(uid)[unique=true];query;restrictedType(code)[unique=true];active;generate ;publisherProductVisibility;publishergroup;{approvalStatus} = ({{select {PK} from {ArticleApprovalStatus} where {code}='approved'}});Product;true;true

    but it seems to have no effect. I am still able to see unapproved and checked products in product cockpit

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 26, 2016 at 10:37 PM
    -1

    alt text alt text


    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 26, 2016 at 10:38 PM
    -1

    alt text alt text


    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.