Hybris OOTB ProductService 找不到现有产品

问题描述

我在后台注册了几个产品,如果我直接从 HAC 执行灵活的搜索查询,我可以看到其中的任何一个,但是,如果我使用 ProductService#getProductForCode 执行与我执行相同的查询,它找不到任何产品。这怎么可能?

解决方法

您可以在调用 productService#getProductForCode

之前尝试禁用搜索限制
import de.hybris.platform.search.restriction.SearchRestrictionService;
......
searchRestrictionService.disableSearchRestrictions();