How to disable the Compare products functionality?

You can disable the Compare products functionality using a Magento extension which should be installed additionally or by manually editing two of the Magento core files.

1. By installing an extension:

You can install the following Magento extension for your application called ET Advanced Compare:

http://www.magentocommerce.com/magento-connect/niro/extension/6455/et_advancedcompare

This will add an option to  your Magento administrative area which allows you to disable the Compare feature with just few clicks of your mouse. Detailed instructions about the installation can be found on the extension page above.

After the installation, the Compare feature can be turned off through your Magento admin area -> System -> ET Extensions -> Advanced Compare -> Remove Compare Option.

2. By creating an override of the the Magento core files:

  • First, create a backup of these files in order to avoid any application crashes and data loss!

The file called Compare.php is situated inside the folder ~/app/code/core/Mage/Catalog/Helper/Product/. The other file is called catalog.xml and it is situated inside the folder ~/app/design/frontend/base/default/layout/

  • Copy ~/app/code/core/Mage/Catalog/Helper/Product/Compare.php to ~/app/code/local/Mage/Catalog/Helper/Product/Compare.php and change the following code:

to:

By creating an override of the Compare.php file you make sure that the core file itself will not be changed and this way the app will not be negatively affected. In addition, local override files are never changed during upgrades. This means that your changes will not be reverted when you upgrade your Magento application.

  • Edit ~/app/design/frontend/base/default/layout/catalog.xml (if you are using a different Magento theme, enter its name instead of default) and change the following code:

to:

  • When you are ready flush the Magento cache through your Magento admin area -> System -> Cache Management.

You need help with a shopping cart? SiteGround is specialized in eCommerce hosting and provides expert support for a large number of shopping carts. Check out our shopping cart hosting services!

7 Comments

  1. Reply May 22, 2015 / 21:39 BrianSiteGround Team

    Recommending that core files are modified is a horrible idea. If disabling the compare block using step 2, the Compare.php file should be copied from app/code/core/Mage/Catalog/Helper/Product/Compare.php to app/code/local/Mage/Catalog/Helper/Product and then modified there. That way it is applied as an override and not as a core file modification!

    • Reply May 25, 2015 / 08:38 Daniel KanchevSiteGround Team

      Thank you for the comment! We updated the article in order to advise people to create overrides instead of modifying the core files.

  2. Reply December 28, 2015 / 21:10 LedianSiteGround Team

    Hello. This kind of override isn't the best.
    Sorry but, to override classes from Magento core, we should to create new module, and we can extend the class that we want to override.
    Next we override only the method that we want.
    The override method that you have made, prevent this class to get updates from magento core.
    Thank you.

    • Reply January 6, 2016 / 08:13 Hristo PandjarovSiteGround Team

      Thanks for the feedback. We will update the article as soon as possible.

  3. Reply April 25, 2016 / 14:42 VladSiteGround Team

    Hello,

    the code is missing from the second option, right after the "Edit ~/app/design/frontend/base/default/layout/catalog.xml (if you are using a different Magento theme, enter its name instead of default) and change the following code:" phrase.

    Regards,
    Vlad

    • Reply May 3, 2016 / 09:20 escalationsSiteGround Team

      Fixed! Thank you for bringing this to our attention.

  4. Reply November 30, 2016 / 16:26 SnowcoreSiteGround Team

    Also, there is a free module that allows you to easily disable compare products functionality http://magery-themes.com/disable-compare-products.html

* (Required)