getBreadcrumb example

$this->get('events')->notify(sprintf('Content_Type_Frontend_Criteria_Creation_%s', $this->type->getInternalName())[
            'subject' => $this,
            'criteria' => $criteria,
        ]);

        $result = $this->repository->findAll($criteria);

        $this->View()->assign('sPage', $p);
        $this->View()->assign('pages', ceil($result->total / self::LIMIT));
        $this->View()->assign('sItems', $result->items);
        $this->View()->assign('sTotal', $result->total);
        $this->View()->assign('sBreadcrumb', $this->getBreadcrumb());
    }

    public function detailAction(int $id = 1): void
    {
        $criteria = new Criteria();
        $criteria->limit = 1;
        $criteria->filter = [['property' => 'id', 'value' => $id]];

        $result = $this->repository->findAll($criteria);

        if (\count($result->items) === 0) {
            


        /** @var CategoryCollection $categories */
        $categories = $this->repository
            ->search(new Criteria($ids->all())$context)
            ->getEntities();

        $c1 = $categories->get($ids->level1);
        $c2 = $categories->get($ids->level2);
        $c3 = $categories->get($ids->level3);

        static::assertSame(['EN-A']$c1->getBreadcrumb());
        static::assertSame(['EN-A', 'EN-B']$c2->getBreadcrumb());
        static::assertSame(['EN-A', 'EN-B', 'EN-C']$c3->getBreadcrumb());

        $context = new Context(
            new SystemSource(),
            [],
            Defaults::CURRENCY,
            [$this->deLanguageId]
        );

        /** @var CategoryCollection $categories */
        


        // Check if the requested category-id belongs to a blog category         if ($categoryContent['blog']) {
            throw new Enlight_Controller_Exception('Listing category missing, non-existent or invalid for the current shop', 404);
        }

        $request->query->set('sCategory', $requestCategoryId);

        $this->View()->assign([
            'sBanner' => Shopware()->Modules()->Marketing()->sBanner($requestCategoryId),
            'sBreadcrumb' => $this->getBreadcrumb($requestCategoryId),
            'sCategoryContent' => $categoryContent,
            'activeFilterGroup' => $request->getQuery('sFilterGroup'),
            'ajaxCountUrlParams' => ['sCategory' => $categoryContent['id']],
            'params' => $request->getParams(),
        ]);

        if (!empty($categoryContent['template'])) {
            if ($this->View()->templateExists('frontend/listing/' . $categoryContent['template'])) {
                $vars = $this->View()->getAssign();
                $this->View()->loadTemplate('frontend/listing/' . $categoryContent['template']);
                $this->View()->assign($vars);
            }

        $this->breadcrumb = $breadcrumb;
    }

    /** * @return array<mixed> */
    public function jsonSerialize(): array
    {
        // Make sure that the sorted breadcrumb gets serialized         $data = parent::jsonSerialize();
        $data['translated']['breadcrumb'] = $data['breadcrumb'] = $this->getBreadcrumb();

        return $data;
    }

    public function getMainCategories(): ?MainCategoryCollection
    {
        return $this->mainCategories;
    }

    public function setMainCategories(MainCategoryCollection $mainCategories): void
    {
        
Home | Imprint | This part of the site doesn't use cookies.