Compare Product is a Magento function that is integrated with Magento by default. You may find this function not necessary for your Magento store and you want to completely remove it? This tutorial for beginners will guide you steps by steps how to Remove Compare product function from your Magento site by making a few modifications.
Use a FTP client like Winscp, CuteFTP, open list.phtml file located in app/design/frontend/default/yourtheme/template/catalog/
Step 2: Remove add to compare function from product list view and product grid view
Now we will remove add to compare function Product list view and product grid view.
Search for the following code and remove it from list.phtml
<?php if($_compareUrl=$this-getAddToCompareUrl($_product)): ?>
<a title="<?php echo $this->__('Add to Compare') ?> " href="<?php echo $_compareUrl ?>" rel="tooltip" class="link-compare "><?php echo $this->__('Add toCompare') ?></a></li>
<?php endif; ?>
You can remove the code or simply comment it <!– comment –>
Do the same to make changes in a grid view.
Step 3: Remove add to compare function from product list view and product grid view
To remove Add To Compare option from product page, first, we will copy addto.phtml file from app/design/frontend/base/default/template/catalog/product/view/ and paste to app/design/frontend/default/yourtheme/template/catalog/product/view/
After copying the file, locate and remove or comment the following code in addto.phtml:
$_compareUrl = $this->helper('catalog/product_compare')->getAddUrl($_product);
<?php if($_compareUrl) : ?>
<li><span class="separator">|</span> <a href="<?php echo $_compareUrl ?>" class="link-compare"><?php echo $this->__('Add to Compare') ?></a></li>-->
<?php endif; ?>
Step 4: Remove Add To Compare option from the sidebar
Now we will remove Add To Compare option from the sidebar of our Magento website.
First, locate catalog.xml file in app/design/frontend/default/yourtheme/layout directory and remove or comment the following code:
<block type="catalog/product_compare_sidebar" after="cart_sidebar" name="catalog.compare.sidebar" template="catalog/product/compare/sidebar.phtml"/>
After you are done, save the edited catalog.xml file and see the result.
Sometimes you may need to clear Magento and Browser cache to see the changes, to do this go to Admin section >Select System>Cache Management and select all option to clear Magento and Browser cache.
Now open your Magento website and refresh the page with shortcut CTRL+F5 (this shortcut will do cache refresh of your browser, and will guarantee that if the content is changed, you will get the new content).
Did you have any troubles while removing Add to compare function? Feel free to ask or comment here, I’m willing to help you out.
Happy coding with Magento explorer tutorial