Skip to content

Commit

Permalink
Merge pull request #4367 in SW/shopware from sw-17393/5.2/fix-lastsee…
Browse files Browse the repository at this point in the history
…narticle-seo-url-parsing to 5.2

* commit '12c08cad0311c07da13cfec0c1aaaa87d9a4da82':
  SW-17393 - Register product number deeplink after link has been rewritten
  • Loading branch information
OliverSkroblin committed Jan 12, 2017
2 parents 07698fb + 12c08ca commit b48cabb
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions engine/Shopware/Core/sArticles.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
Expand Down

0 comments on commit b48cabb

Please sign in to comment.