cancel
Showing results for 
Search instead for 
Did you mean: 

Apply search restrictions in a cronjob

Former Member
0 Kudos
1,216

Hi,

Can we define any search restrictions in a cron job which is trying to get products from category and do some manipulation. Tried defining session search restrictions.

Thanks

View Entire Topic
mohamedvallbah
Advisor
Advisor
0 Kudos

Hi, In cronjobs the restrictions are not enabled by default. You need to enable them in the job code using searchRestrictionService.enableSearchRestrictions() before calling your getters or flexible search queries so they could be taken into account. I did a test getting products from a category in a cronjob and it seems it works that way.