How To Get Rid Of Product Comparison Feature In Magento

Share

Product comparison feature is loved by many customers as it gives them a precise idea about the interesting products in one place but this feature is not apt for few stores who do not wish to have product comparison feature. If you run a music store then comparing between two different music albums or songs would be of no real use.

Developer around the world scratch their head when it comes to getting rid of Product Comparison feature (RHS box) from their site layout. Although, this feature is default in Magento but their are options which will help you to remove this feature from your Magento store.

With a little bit of PHP knowledge and Magento customization you can easily get rid of Magento Product comparison functionality from your site. Most of the magento installation run cache which will not let you see your changes as you edit the files. It is advised to turn your cache off before induging yourself into the act and turn the cache on once you are satisfied with your changes i.e. removing Magento Product Comparison. You can enable/disable your cache from System -> Cache Management option given in Magento admin panel.

Getting rid of Product Comparison Box and feature

In order to achieve this you need to make changes in 6 different places which are given below:

  1. catalog.xml
  2. reports.xml
  3. customer.xml
  4. addto.phtml
  5. list.phtml
  6. crosssell.phtml

In order to make changes in your catalog.xml file you should open app/design/frontend/deafult/YourTheme/layout/catalog.xml in your favorite PHP editor and delete the following lines of code and save the file.

1
<block type="core/template" before="cart_sidebar" name="catalog.compare.sidebar" template="catalog/product/compare/sidebar.phtml"/>

Now open reports.xml file by opening app/design/frontend/deafult/YourTheme/layout/reports.xml in your favorite PHP editor and delete the two lines in am mentioning below. You can search the two lines and delete both of them from reports.xml file.

1
<block type="reports/product_viewed" before="right.permanent.callout" name="right.reports.product.viewed" template="reports/product_viewed.phtml" />
1
<block type="reports/product_compared" before="right.permanent.callout" name="right.reports.product.compared" template="reports/product_compared.phtml" />

Open customer.xml by editing app/design/frontend/default/YourTheme/layout/customer.xml in your favorite editor and delete the following line of code then save the file.

1
2
3
4
5
<action method="addItemRender">
 <type>grouped</type>
 <block>checkout/cart_item_renderer_grouped</block>
 <template>checkout/cart/sidebar/default.phtml</template>
</action>

Now, save the file and refresh your page and see if the box is still there. Hopefully you should not see the box. There is few more thing left to be done to entirely remove the “Add To Compare” link.

Open addto.phtml by opening app/design/frontend/default/YourTheme/template/catalog/product/view/addto.phtml in your favorite PHP editor and delete the following lines of code and save the file.

1
2
3
4
5
6
< ?php if($_compareUrl=$this->helper('catalog/product_compare')->getAddUrl($_product) ): ?>
 <li>
  <span class="pipe">|</span>
  <a href="<?php echo $_compareUrl ?>">< ?php echo $this->__('Add to Compare') ?></a>
 </li>
< ?php endif; ?>

Open list.phtml by editing app/design/frontend/default/YourTheme/catalog/product/list.phtml in your favorite PHP editor and delete the following 2 code blocks.

1
2
3
4
<?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
  <span class="pipe">|</span>
  <a href="<?php echo $_compareUrl ?>"><?php echo $this->__('Add to Compare') ?></a>
<?php endif; ?>
1
<a href="<?php echo $_compareUrl ?>"><?php echo $this->__('Add to Compare') ?></a>

Finally open crosssell.phtml by editing app\design\frontend\default\default\template\checkout\cart in your favorite PHP editor and delete the following lines of code.

1
2
3
4
<?php if($_compareUrl=$this->getAddToCompareUrl($_item)): ?>
 <br/>
 <small><a href="<?php echo $_compareUrl ?>"><?php echo $this->__('Add to Compare') ?></a></small>
<?php endif; ?>

Now, refresh the page and you won’t see Product comparison instance or its link anywhere on your store. Please leave me a comment and share your experiences of removing Product comparison feature from your Magento powered store. Don’t forget to subscribe to our RSS to receive latest updates delivered to your mailbox for Free!

Leave a Reply

You must be logged in to post a comment.