Compare products. Side element does not display products.

When I click "Add to compare" on a product, a message appears stating that "such and such a product has been successfully added to the comparison list", however, the side panel "Compare Products" displays "You have no items to compare." If I do print_r($this->helper('catalog/product_compare')->getItemCount()) in template/catalog/product/compare/sidebar.phtml , " 0 " is returned.

Why doesn't the sidebar show product comparison?

Information: Magento version 1.4.0.1 It seems that the sessions are working, and I can add products to the basket, and they will remain in the basket when navigating the site.

Thanks Ben

+5
source share
5 answers

Found a solution after several hours of searching: One or more indexes needed to be rebuilt.

In case anyone else encounters this problem, the ability to start index recovery is located in the administratorโ€™s interface by going to the System menu and choosing Manage Indexes.

+18
source

I made changes to this file:

Application \ Code \ Kernel \ Mage \ Catalog \ Helper \ Product \ Compare.php

from line 215. I commented on the output of if.

 /* if (!$this->_getSession()->hasCatalogCompareItemsCount()) { $count = 0; } else { */ 

and in line 235. Commented on the closing bracket:

 /*}*/ 

It worked for me.

I think this is the solution.

+2
source

Another reason you can compare comparison tools is because of some site optimizations, such as disabling certain events, such as

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 delete

  <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> 
+1
source
 app\code\core\Mage\Catalog\Helper\Product\Compare.php at line 257 

comment if instruction does not work in community magento v 1.7.0.2

 /** * Retrieve count of items in compare list * * @return int */ public function getItemCount() { if (!$this->_getSession()->hasCatalogCompareItemsCount()) { $this->calculate(); } return $this->_getSession()->getCatalogCompareItemsCount(); } 
0
source

I have the same problem, and because of my browser (chrome) I switch to firefox, and the Add to Compare option works fine.

0
source

All Articles