“&” instead of “&” in language switch url
-
12-12-2019 - |
Question
when using magento's language switcher, the generated URL is:
a href="http://www.shop.com/index.php/bags/eastpak.html?___store=en&___from_store=default">
Magento version 1.7 is used.
How can I convert this &
to &?
Is Magento's Redirect class reason for this bug?
Solution
It seems to be correct. Please look at https://stackoverflow.com/questions/3705591/do-i-encode-ampersands-in-a-href
OTHER TIPS
It's annoying, especially in product list pages, when url contains all search params.
To avoid this, some changes are required in two files :
1) in Mage_Core_Controller_Varien_Action
under
protected function _redirectReferer($defaultUrl=null)
{
$refererUrl = $this->_getRefererUrl();
if (empty($refererUrl)) {
$refererUrl = empty($defaultUrl) ? Mage::getBaseUrl() : $defaultUrl;
}
$this->getResponse()->setRedirect($refererUrl);
return $this;
}
add
protected function _redirectRefererNoSpecialChars($defaultUrl=null)
{
$refererUrl = $this->_getRefererUrl();
$refererUrl = htmlspecialchars_decode($refererUrl, ENT_NOQUOTES);//this needs to be added
if (empty($refererUrl)) {
$refererUrl = empty($defaultUrl) ? Mage::getBaseUrl() : $defaultUrl;
}
$this->getResponse()->setRedirect($refererUrl);
return $this;
}
2) in Mage_Directory_CurrencyController
change $this->_redirectReferer(Mage::getBaseUrl());
with $this->_redirectRefererNoSpecialChars(Mage::getBaseUrl());
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange