When clicking on the add to compare button, I want to remain on the same page & perform the add function without redirecting to the homepage - is this possible?
1 Answer
Mage_Catalog_Product_CompareController::addAction();
This call _redirectReferer()
which gives redirection url to home page.
You can change this line with $this->_redirectUrl($product->getProductUrl());
OR
You can add referer_url
to catalog/product_compare/add
request.
Mage_Catalog_Helper_Product_Compare
::_getUrlParams
protected function _getUrlParams($product)
{
return array(
'product' => $product->getId(),
Mage_Core_Controller_Front_Action::PARAM_NAME_URL_ENCODED => $this->getEncodedUrl(),
Mage_Core_Controller_Varien_Action::Mage_Core_Controller_Varien_Action => $product->getProductUrl(),
);
}