diff --git a/engine/Shopware/Core/sArticles.php b/engine/Shopware/Core/sArticles.php index d486da167b9..178651e7ada 100644 --- a/engine/Shopware/Core/sArticles.php +++ b/engine/Shopware/Core/sArticles.php @@ -2374,11 +2374,11 @@ private function getLegacyProduct(Product $product, $categoryId, array $selectio * Creates different links for the product like `add to basket`, `add to note`, `view detail page`, ... * * @param StoreFrontBundle\Struct\ListProduct $product - * @param null $categoryId + * @param int $categoryId * @param bool $addNumber * @return array */ - private function getLinksOfProduct(StoreFrontBundle\Struct\ListProduct $product, $categoryId = null, $addNumber = false) + private function getLinksOfProduct(StoreFrontBundle\Struct\ListProduct $product, $categoryId, $addNumber) { $baseFile = $this->config->get('baseFile'); $context = $this->contextService->getShopContext(); @@ -2387,10 +2387,13 @@ private function getLinksOfProduct(StoreFrontBundle\Struct\ListProduct $product, if ($categoryId) { $detail .= '&sCategory=' . $categoryId; } + + $rewrite = Shopware()->Modules()->Core()->sRewriteLink($detail, $product->getName()); + if ($addNumber) { - $detail .= '&number=' . $product->getNumber(); + $rewrite .= strpos($rewrite, '?') !== false ? '&' : '?'; + $rewrite .= 'number=' . $product->getNumber(); } - $rewrite = Shopware()->Modules()->Core()->sRewriteLink($detail, $product->getName()); $basket = $baseFile . "?sViewport=basket&sAdd=" . $product->getNumber(); $note = $baseFile . "?sViewport=note&sAdd=" . $product->getNumber();