fetchCategory example

$product = reset($products);

                if (!$product instanceof ListProduct || !$product->getCover() instanceof Media) {
                    break;
                }

                $element->getData()->set('image', $product->getCover());
                $element->getData()->set('images', $product->getCover()->getThumbnails());
                break;
        }

        $this->fetchCategory($element$context);
    }

    private function fetchCategory(Element $element, ShopContextInterface $context): void
    {
        $categoryId = (int) $element->getConfig()->get('category_selection');
        $category = $this->categoryService->getList([$categoryId]$context);

        if (!$category) {
            return;
        }

        
Home | Imprint | This part of the site doesn't use cookies.