Skip to content

Commit

Permalink
Merge pull request PrestaShop#21984 from PululuK/improve-vars-name
Browse files Browse the repository at this point in the history
Improve Link::getProductLink : Avoid short variable names
  • Loading branch information
kpodemski authored Nov 18, 2020
2 parents c190ae1 + 6f59337 commit f5a8bd1
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions classes/Link.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public function getProductObject($product, $idLang, $idShop)
* @param string|null $ean13
* @param int|null $idLang
* @param int|null $idShop (since 1.5.0) ID shop need to be used when we generate a product link for a product in a cart
* @param int|null $ipa ID product attribute
* @param int|null $idProductAttribute ID product attribute
* @param bool $force_routes
* @param bool $relativeProtocol
* @param bool $addAnchor
Expand All @@ -146,7 +146,7 @@ public function getProductLink(
$ean13 = null,
$idLang = null,
$idShop = null,
$ipa = null,
$idProductAttribute = null,
$force_routes = false,
$relativeProtocol = false,
$addAnchor = false,
Expand Down Expand Up @@ -176,10 +176,10 @@ public function getProductLink(
}

//Attribute equal to 0 or empty is useless, so we force it to null so that it won't be inserted in query parameters
if (empty($ipa)) {
$ipa = null;
if (empty($idProductAttribute)) {
$idProductAttribute = null;
}
$params['id_product_attribute'] = $ipa;
$params['id_product_attribute'] = $idProductAttribute;
if (!$alias) {
$product = $this->getProductObject($product, $idLang, $idShop);
}
Expand Down Expand Up @@ -241,10 +241,10 @@ public function getProductLink(
}
$params['categories'] = implode('/', $cats);
}
if ($ipa) {
if ($idProductAttribute) {
$product = $this->getProductObject($product, $idLang, $idShop);
}
$anchor = $ipa ? $product->getAnchor((int) $ipa, (bool) $addAnchor) : '';
$anchor = $idProductAttribute ? $product->getAnchor((int) $idProductAttribute, (bool) $addAnchor) : '';

return $url . $dispatcher->createUrl('product_rule', $idLang, array_merge($params, $extraParams), $force_routes, $anchor, $idShop);
}
Expand Down

0 comments on commit f5a8bd1

Please sign in to comment.