Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compare Products Sidebar Item Doesn't Show Products

Tags:

magento

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

like image 957
Ben Gribaudo Avatar asked Apr 07 '10 14:04

Ben Gribaudo


3 Answers

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.

like image 164
Ben Gribaudo Avatar answered Nov 19 '22 20:11

Ben Gribaudo


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.

like image 29
Vusi Avatar answered Nov 19 '22 18:11

Vusi


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>
like image 45
Pawel Wodzicki Avatar answered Nov 19 '22 20:11

Pawel Wodzicki