sRewriteLink example

throw new InvalidArgumentException('Argument categoryId missing');
            }

            if (!$this->Request()->has('sSort')) {
                $default = $this->container->get(Shopware_Components_Config::class)->get('defaultListingSorting');
                $this->Request()->setParam('sSort', $default);
            }

            $navigation = $this->container->get('modules')->Articles()->getProductNavigation($orderNumber$categoryId$this->Request());

            $linkRewriter = function D$link) {
                return $this->container->get('modules')->Core()->sRewriteLink($link);
            };

            if (isset($navigation['previousProduct'])) {
                $navigation['previousProduct']['href'] = $linkRewriter($navigation['previousProduct']['link']);
            }

            if (isset($navigation['nextProduct'])) {
                $navigation['nextProduct']['href'] = $linkRewriter($navigation['nextProduct']['link']);
            }

            $navigation['currentListing']['href'] = $linkRewriter($navigation['currentListing']['link']);
            

    private function getLinksOfProduct(ListProduct $product$categoryId$addNumber)
    {
        $baseFile = $this->config->get('baseFile');
        $context = $this->contextService->getShopContext();

        $detail = $baseFile . '?sViewport=detail&sArticle=' . $product->getId();
        if ($categoryId) {
            $detail .= '&sCategory=' . $categoryId;
        }

        $rewrite = Shopware()->Modules()->Core()->sRewriteLink($detail$product->getName());

        if ($addNumber) {
            $rewrite .= strpos($rewrite, '?') !== false ? '&' : '?';
            $rewrite .= 'number=' . $product->getNumber();
        }

        $basket = $baseFile . '?sViewport=basket&sAdd=' . $product->getNumber();
        $note = $baseFile . '?sViewport=note&sAdd=' . $product->getNumber();
        $friend = $baseFile . '?sViewport=tellafriend&sDetails=' . $product->getId();
        $pdf = $baseFile . '?sViewport=detail&sDetails=' . $product->getId() . '&sLanguage=' . $context->getShop()->getId() . '&sPDF=1';

        


        $shopId = $this->container->get(ContextServiceInterface::class)->getShopContext()->getShop()->getId();

        $staticPage = Shopware()->Modules()->Cms()->sGetStaticPage($this->Request()->get('sCustom')$shopId);

        if (!\is_array($staticPage)) {
            throw new ResourceNotFoundException('Custom page not found', $this->Request());
        }

        if (!empty($staticPage['link'])) {
            $link = Shopware()->Modules()->Core()->sRewriteLink($staticPage['link']$staticPage['description']);

            $this->redirect($link['code' => Response::HTTP_MOVED_PERMANENTLY]);

            return;
        }

        if (!empty($staticPage['html'])) {
            $this->View()->assign('sContent', $staticPage['html']);
        }

        $this->View()->assign('sCustomPage', $staticPage);

        
return $string;
    }

    /** * @param int $articleID * @param string $title * * @return string */
    public function sGetArticleLink($articleID$title = '')
    {
        return Shopware()->Modules()->Core()->sRewriteLink($this->config->get('sBASEFILE') . "?sViewport=detail&sArticle=$articleID", $title) . (empty($this->sSettings['partnerID']) ? '' : '?sPartner=' . urlencode($this->sSettings['partnerID']));
    }

    /** * @param string $hash * @param string|null $imageSize * * @return string|null */
    public function sGetImageLink($hash$imageSize = null)
    {
        if (empty($hash)) {
            
Home | Imprint | This part of the site doesn't use cookies.