Skip to content

Commit 60dc40b

Browse files
rogerdzglo63652
authored andcommitted
update code
1 parent cbe60d3 commit 60dc40b

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

app/code/Magento/Catalog/Controller/Product/Compare/Index.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,14 @@ public function execute()
7878
{
7979
$beforeUrl = $this->getRequest()->getParam(self::PARAM_NAME_URL_ENCODED);
8080
if ($beforeUrl) {
81-
$this->_catalogSession->setBeforeCompareUrl(
82-
$this->urlDecoder->decode($beforeUrl)
83-
);
84-
} else {
85-
$this->_catalogSession->unsBeforeCompareUrl();
81+
$beforeUrl = $this->urlDecoder->decode($beforeUrl);
82+
if(strpos((string)$beforeUrl, "customer/section/load") == 0){
83+
$this->_catalogSession->setBeforeCompareUrl(
84+
$beforeUrl
85+
);
86+
} else {
87+
$this->_catalogSession->unsBeforeCompareUrl();
88+
}
8689
}
8790
return $this->resultPageFactory->create();
8891
}

app/code/Magento/Catalog/CustomerData/CompareProducts.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public function getSectionData()
7373
return [
7474
'count' => $count,
7575
'countCaption' => $count == 1 ? __('1 item') : __('%1 items', $count),
76-
'listUrl' => $this->helper->getListUrl(false),
76+
'listUrl' => $this->helper->getListUrl(),
7777
'items' => $count ? $this->getItems() : [],
7878
'websiteId' => $this->storeManager->getWebsite()->getId()
7979
];

app/code/Magento/Catalog/Helper/Product/Compare.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,13 +142,12 @@ public function __construct(
142142
/**
143143
* Retrieve compare list url
144144
*
145-
* @param bool $encodedUrl
146145
* @return string
147146
*/
148-
public function getListUrl($encodedUrl = true)
147+
public function getListUrl()
149148
{
150149
$params = [
151-
\Magento\Framework\App\ActionInterface::PARAM_NAME_URL_ENCODED => $encodedUrl ? $this->getEncodedUrl() : ''
150+
\Magento\Framework\App\ActionInterface::PARAM_NAME_URL_ENCODED => $this->getEncodedUrl()
152151
];
153152
return $this->_getUrl('catalog/product_compare', $params);
154153
}

0 commit comments

Comments
 (0)