When I click "Add to Compare" on a product, a message stating that "such-and-such product successfully added to compare list" appears, however the compare products sidebar shows "You have no items to compare." If I do a print_r($this->helper('catalog/product_compare')->getItemCount())
in template/catalog/product/compare/sidebar.phtml
, "0
" is returned.
Why won't the sidebar show the products to compare?
Info: Magento version 1.4.0.1 Sessions appear to work for I can add products to the cart and they will stay in the cart as I navigate around the site.
Thank you, Ben
Found the solution after several hours of searching: One or more of the indexes needed to be rebuilt.
In case anyone else encounters this issue, the option to trigger index rebuilding is found in the admin interface by going to the System menu and selecting Index Management.
I've made the changes on this file:
app\code\core\Mage\Catalog\Helper\Product\Compare.php
from line 215. I've commented the if statement out.
/*
if (!$this->_getSession()->hasCatalogCompareItemsCount()) {
$count = 0;
} else {
*/
and on line 235. Commented the closing bracket out:
/*}*/
It worked for me.
I think thats the solution.
The other reason that compare tools may be broken are some site optimizations like disabling certain events like
controller_action_predispatch controller_action_postdispatch
Check etc/local.xml
<frontend>
<events>
<controller_action_predispatch>
<observers><log><type>disabled</type></log></observers>
</controller_action_predispatch>
<controller_action_postdispatch>
<observers><log><type>disabled</type></log></observers>
</controller_action_postdispatch>
</events>
</frontend>
and remove
<controller_action_predispatch>
<observers><log><type>disabled</type></log></observers>
</controller_action_predispatch>
<controller_action_postdispatch>
<observers><log><type>disabled</type></log></observers>
</controller_action_postdispatch>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With