Skip to main content
deleted 1 character in body
Source Link
Amit Bera
  • 77.7k
  • 20
  • 124
  • 239

Mage_Catalog_ProductP_CompareControllerMage_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(),
    );
}

Mage_Catalog_ProductP_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(),
    );
}

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(),
    );
}
Source Link
Neklo.com
  • 2.4k
  • 1
  • 12
  • 19

Mage_Catalog_ProductP_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(),
    );
}