31 private $categoryRepository;
36 private $storeManager;
59 if (
$request->getName() === $this->name) {
76 $queryType =
$request->getQuery()->getType();
104 private function getCategoriesFromQuery(QueryInterface $queryExpression)
107 $categoryIds = $this->getCategoryIdsFromQuery($queryExpression);
110 foreach ($categoryIds as $categoryId) {
113 ->get($categoryId, $this->storeManager->getStore()->getId());
114 }
catch (NoSuchEntityException $e) {
130 private function getCategoryIdsFromQuery(QueryInterface $queryExpression)
132 $queryFilterArray = [];
134 $queryFilterArray[] = $queryExpression->getMust();
135 $queryFilterArray[] = $queryExpression->getShould();
138 foreach ($queryFilterArray as
$item) {
139 if (!empty(
$item) && isset(
$item[
'category'])) {
140 $queryFilter =
$item[
'category'];
142 $categoryIds[] = $queryFilter->getReference()->getValue();
__construct(CategoryRepositoryInterface $categoryRepository, StoreManagerInterface $storeManager, $name)
isApplicable(RequestInterface $request)