I see when there is no item selected to compare, the block-compare is not displaying in sidebar and after adding product to compare it is there. How to display this block always and show message"You have not selected any items to compare" for example?


Natively the block should show regardless, and if there's no item, it would say "You have no items to compare.". So it looks like your theme is customised, or a module overwrites it. Make sure your catalog/product/compare/sidebar.phtml in your theme folder is similar to the default one.

  • Even I copied the sidebar.phtml from default to my theme folder, still I can not see the block :( – Zinat Oct 20 '15 at 14:24

The core code will not display the block if there's no recently compared products:

protected function _toHtml()
    if (!$this->getCount()) {
        return '';


    return parent::_toHtml();

To change this behavior you can do a rewrite of the Mage_Reports_Block_Product_Compared block to fulfill your needs.

  • This is for the "Recently Compared Products" block, that doesn't apply here – Mayers Oct 20 '15 at 14:44

I figured it out. In default sidebar.phtml there is a line $_items = $_helper->getItemCount() > 0 ? $_helper->getItemCollection() : null; I removed the condition of checking $_items and it works now.

  • Can you paste the content of your sidebar.phtml, your solution isn't really one. – Mayers Oct 20 '15 at 16:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.