getCategoriesOfParent example



    /** * @param Category[] $categories * @param int[] $activeIds * @param int $systemCategoryId * * @return TreeFacetResult|null */
    public function buildFacetResult(array $categories, array $activeIds$systemCategoryId, CategoryFacet $facet)
    {
        $items = $this->getCategoriesOfParent($categories$systemCategoryId);

        if (!$items) {
            return null;
        }

        $values = [];
        foreach ($items as $item) {
            $values[] = $this->createTreeItem($categories$item$activeIds);
        }

        if (!empty($facet->getLabel())) {
            
'config' => $this->Config(),
        ]);

        $cache = $this->get(Zend_Cache_Core::class);

        if ($this->Config()->get('caching') && $cache->test($cacheKey)) {
            $menu = $cache->load($cacheKey, true);
        } else {
            $ids = $this->getCategoryIdsOfDepth($category(int) $depth);
            $categories = $this->get(CategoryServiceInterface::class)->getList($ids$context);
            $categoriesArray = $this->convertCategories($categories);
            $categoryTree = $this->getCategoriesOfParent($category$categoriesArray);
            if ($this->Config()->get('caching')) {
                $cache->save($categoryTree$cacheKey['Shopware_Plugin'](int) $this->Config()->get('cachetime', 86400));
            }
            $menu = $categoryTree;
        }

        $categoryPath = $this->getCategoryPath($activeCategoryId);

        return $this->setActiveFlags($menu$categoryPath);
    }

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