I'm updating an old Magento instance from 1.7.0.2 to 1.9.2.1 (I know there is the v. 1.9.2.2).
I'm also using the Ultimo theme, but i tested the bug also with the standard RWD theme that comes with Magento 1.9.
The issue is about the add to compare button: it doesn't work. It only redirects me to the same page but it doesn't add the product to compare list.
I find out that the problem is in the addAction() function in CompareController.php
There is
public function addAction()
{
if (!$this->_validateFormKey()) {
$this->_redirectReferer();
return;
}
...
}
And $this->_validateFormKey() return FALSE so nothing is done.
Just for information, my add to compare link are looking like the following
http://example.com/catalog/product_compare/add/product/2480/uenc/aHR0cDovL3N0a25ldzE5Lmh0dGRldi5pdC9pcGhvbmUtNi1wbHVzLTE2Z2ItYmxhY2suaHRtbA,,/
At the moment, my solution is to comment the IF.
Somebody knows how to solve this problem?
EDIT:
Into the template file addto.phtml the code is the following:
...
<?php
$_compareUrl = $this->helper('catalog/product_compare')->getAddUrl($_product);
?>
<?php if($_compareUrl) : ?>
<li>
<a class="link-compare feature feature-icon-hover first" href="<?php echo $_compareUrl ?>" title="<?php echo $this->__('Add to Compare') ?>">
<span class="ic ic-compare ib icon-color-productview"></span>
<span class="label"><?php echo $this->__('Add to Compare') ?></span>
</a>
</li>
<?php endif; ?>
...
Best Answer
You will need to change compare URL in your phtml
This code will give you the right compare URL for your product.
If this will not work show your phtml code which have compare link.