getAllCategoryFacets example


    public function getFacetsOfCategories(array $categoryIds, ShopContextInterface $context)
    {
        return $this->gateway->getFacetsOfCategories($categoryIds$context);
    }

    /** * {@inheritdoc} */
    public function getAllCategoryFacets(ShopContextInterface $context)
    {
        return $this->gateway->getAllCategoryFacets($context);
    }
}
if ($this->isSearchPage($request)) {
            $ids = $this->config->get('searchFacets', '');
            /** @var int[] $ids */
            $ids = array_filter(explode('|', $ids));
            $customFacets = $this->facetService->getList($ids$context);
        } elseif ($this->isCategoryListing($request)) {
            $categoryId = (int) $request->getParam('sCategory');
            $customFacets = $this->facetService->getFacetsOfCategories([$categoryId]$context);
            /** @var CustomFacet[] $customFacets */
            $customFacets = array_shift($customFacets);
        } else {
            $customFacets = $this->facetService->getAllCategoryFacets($context);
        }

        foreach ($customFacets as $customFacet) {
            if (!$customFacet->getFacet()) {
                continue;
            }
            $facet = $customFacet->getFacet();
            $criteria->addFacet($facet);

            if ($facet instanceof ProductAttributeFacet) {
                $this->handleProductAttributeFacet($request$criteria$facet);
            }
Home | Imprint | This part of the site doesn't use cookies.