/** * {@inheritdoc} */ public function handle(CriteriaPartInterface $criteriaPart, Criteria $criteria, Search $search, ShopContextInterface $context) { /** @var CategoryCondition $criteriaPart */ $filter = new TermsFilter('categoryIds', $criteriaPart->getCategoryIds()); if ($criteria->hasBaseCondition($criteriaPart->getName())) { $search->addFilter($filter); } else { $search->addPostFilter($filter); } }