Engine23
blogBannerImage
By Engine23

Magento - How to Remove Add to Compare

First step create the module declaration:

file: app/etc/modules/Russellalbin_Catalog.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Russellalbin_Catalog>
            <active>true</active>
            <codePool>local</codePool>
        </Russellalbin_Catalog>
    </modules>
</config>

Create the rewrite xml

File: app/code/local/Russellalbin/Catalog/etc/config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Russellalbin_Catalog>
            <version>1.0</version>
        </Russellalbin_Catalog>
    </modules>
    <global>
        <helpers>
            <catalog>
                <rewrite>
                    <product_compare>Russellalbin_Catalog_Helper_Product_Compare</product_compare>
                </rewrite>
            </catalog>
        </helpers>
    </global>
</config>

Create the override class

File: app/code/local/Russellalbin/Catalog/Helper/Product/Compare.php

<?php
/**
* @category Mage
* @package Mage_Catalog
* @author Russell Albin
*/
class Russellalbin_Catalog_Helper_Product_Compare extends Mage_Catalog_Helper_Product_Compare
{

/**
* Retrieve url for adding product to compare list, return false
*
*/
public function getAddUrl($product)
{
if(Mage::getStoreConfig('catalog/recently_products/compared_count')) {
return parent::getAddUrl($product);
}
return false;
}

}
?>

Update some config settings

  1. Go to System > Configuration >> Catalog: Catalog >> Recently Viewed/Compared Products
  2. Set Default Recently Compared Products count to 0