Skip to content

Commit 493e5b6

Browse files
committed
MAGETWO-95212: Dynamic block call to getCurrentUrl method is returning ajax request value
- Fixed product compare link
1 parent 45bf612 commit 493e5b6

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,15 @@ public function getListUrl()
166166
*/
167167
public function getPostDataParams($product)
168168
{
169-
return $this->postHelper->getPostData($this->getAddUrl(), ['product' => $product->getId()]);
169+
$params = ['product' => $product->getId()];
170+
$requestingPageUrl = $this->_getRequest()->getParam('requesting_page_url');
171+
172+
if (!empty($requestingPageUrl)) {
173+
$encodedUrl = $this->urlEncoder->encode($requestingPageUrl);
174+
$params[\Magento\Framework\App\ActionInterface::PARAM_NAME_URL_ENCODED] = $encodedUrl;
175+
}
176+
177+
return $this->postHelper->getPostData($this->getAddUrl(), $params);
170178
}
171179

172180
/**

0 commit comments

Comments
 (0)