sGetCategoriesByParent example


    public function sGetArticleCategoryPath($articleID$separator = ' > ', $categoryID = null, $field = 'name')
    {
        if (empty($categoryID)) {
            $categoryID = $this->sSettings['categoryID'];
        }

        $productCategoryId = $this->sSYSTEM->sMODULES['sCategories']->sGetCategoryIdByArticleId($articleID$categoryID);
        $breadcrumb = array_reverse(Shopware()->Modules()->Categories()->sGetCategoriesByParent($productCategoryId));
        $breadcrumbs = [];

        foreach ($breadcrumb as $breadcrumbObj) {
            $breadcrumbs[] = $field === 'link' ? Shopware()->Modules()->Core()->sRewriteLink($breadcrumbObj[$field]) : $breadcrumbObj[$field];
        }

        return htmlspecialchars_decode(implode($separator$breadcrumbs));
    }

    /** * @param int|string $country * * @return array|false */
/** * Returns listing breadcrumb * * @param int $categoryId * * @return array<array{id: int, name: string, blog: bool, link: string}> listing breadcrumb * * @deprecated in 5.6, will be private in 5.8 */
    public function getBreadcrumb($categoryId)
    {
        $breadcrumb = Shopware()->Modules()->Categories()->sGetCategoriesByParent($categoryId);

        return array_reverse($breadcrumb);
    }

    /** * @deprecated in 5.7, will be private in 5.8 * * @param int $categoryId * @param bool $withStreams * @param int $streamId * * @return array{emotions: array<array<string, mixed>>, hasEmotion: bool, showListing: bool, isHomePage: bool, showListingButton: bool} */
if (!empty($this->container->get(Config::class)->get('InquiryID'))) {
            $view->assign('sInquiry', $this->Front()->ensureRouter()->assemble([
                'sViewport' => 'support',
                'sFid' => $this->container->get(Config::class)->get('InquiryID'),
                'sInquiry' => 'detail',
                'sOrdernumber' => $product['ordernumber'],
            ]));
        }

        if (!empty($product['categoryID'])) {
            $breadcrumb = array_reverse($this->container->get('modules')->Categories()->sGetCategoriesByParent($product['categoryID']));
            $categoryInfo = end($breadcrumb);
        } else {
            $breadcrumb = [];
            $categoryInfo = null;
        }

        $view->assign('sBreadcrumb', $breadcrumb);
        $view->assign('sCategoryInfo', $categoryInfo);
        $view->assign('sArticle', $product);
        $view->assign('rand', Random::getAlphanumericString(32));
    }

    

    public function getCategoryBreadcrumb($categoryId)
    {
        trigger_error(sprintf('%s:%s is deprecated since Shopware 5.6 and will be private with 5.8.', __CLASS__, __METHOD__), E_USER_DEPRECATED);

        return array_reverse(Shopware()->Modules()->Categories()->sGetCategoriesByParent($categoryId));
    }

    /** * Save a new blog comment / voting * * @param array $commentData * @param int $blogArticleId * * @throws Enlight_Exception * * @return void */
Home | Imprint | This part of the site doesn't use cookies.