on ‎2019 Feb 12 1:27 PM
Hi, As per my requirement, there are you enum attributes in product Model ChannelIndicator and PreviousChannelIndictor of type ChannelIndicatorEnum Type. Both attributes can have values ,Online ,Offline and Both. So if ChannelIndicator and PreviousChannelIndicator are set to "Offline", then that product should not be synced from one Online Catalog to another Online catalog. In order to achieve this, i have used JobSearchRestriction on CatalogSyncJob. But i sync,that product is also getting synced. For some reason , my restriction is not getting applied on the sync job. Neither i am able to find any error in logs as well. Please find the Impex that i used and please let me know , where i am doing mistake.
$pcmProductCatalog=BobsPcmProductCatalog
$productCatalog=BobsProductCatalog
$catalogVersion=catalogversion(catalog(id[default=$pcmProductCatalog]),version[default='Online'])[unique=true,default=$pcmProductCatalog:Online]
$classificationCatalog=BobsClassification
$languages=en
$sourcePcmProductStagedCV=sourceVersion(catalog(id[default=$pcmProductCatalog]),version[default='Staged'])[unique=true,default='$pcmProductCatalog:Staged']
$targetPcmProductOnlineCV=targetVersion(catalog(id[default=$pcmProductCatalog]),version[default='Online'])[unique=true,default='$pcmProductCatalog:Online']
$sourcePcmProductOnlineCV=sourceVersion(catalog(id[default=$pcmProductCatalog]),version[default='Online'])[unique=true,default='$pcmProductCatalog:Online']
$targetProductOnlineCV=targetVersion(catalog(id[default=$productCatalog]),version[default='Online'])[unique=true,default='$productCatalog:Online']
INSERT_UPDATE CatalogVersionSyncJob ; code[unique=true] ; $sourcePcmProductOnlineCV ; $targetProductOnlineCV ; rootTypes(code)[mode=append]
; BobsPcmToProductCatalog_OnlineToOnlineSyncJob ; ; ; Category,Product,Media,Keyword,TaxRow,PriceRow,DiscountRow,MediaContainer,ProductBadge
#Impex to add restriction on product catalog sync job
INSERT_UPDATE Employee ;UID[unique=true] ;description ;name ;groups(uid) ;sessionLanguage(isocode);sessionCurrency(isocode)
;bobssyncsessionuser;This is session user for Sync job (PCM Stage to Ecomm Online jobs)to add filter on product to be included to syncing ;Bob Sync Session User ;productmanagergroup;en
UPDATE CatalogVersionSyncJob ; code[unique=true] ;sessionUser(uid)
; BobsPcmToProductCatalog_OnlineToOnlineSyncJob ;bobssyncsessionuser
### Restrictions ###
INSERT_UPDATE JobSearchRestriction ;code[unique=true] ;job(code) ;query;type(code)
;bobsSyncJobStatusRestriction ; BobsPcmToProductCatalog_OnlineToOnlineSyncJob ; {channelIndicator} IN ({{select {channelIndicator} from {Product as p join ChannelIndicator as ci on {ci.pk}={p.channelIndicator} join ChannelIndicator as pci on {pci.pk}={p.previousChannelIndicator}} where {ci.code} IN ('ONLINE','BOTH') or {pci.code} IN ('ONLINE','BOTH') }}); Product
Request clarification before answering.
Like Arvind mentioned just make sure you are using the restriction on type which has the attribute.
If you are doing from the whole catalog version sync whatever restriction you have given should be fine, but that doesn't work for single product sync as it will be a different flow. For example if admin user does the sync of a single product from backoffice it will go to performSynchronization Method in SynchronizationServiceImpl class OOTB, you can override this method to filter products before being synced
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Instead of Product as the value of type(code), you should use Your-Custom-Product-Type. You should also use Your-Custom-Product-Type in the query.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.