48. Magento. How to disable compare products feature
2 min read- Open list.phtml file located in app/design/frontend/default/themeXXX/template/catalog/product directory using your FTP client or FileManager in your Hosting Control panel:
- You will need to remove “add to compare” option from product list view and/or product grid view.
- Using CTRL+F search tool locate and remove the following code:
1234<?php if($_compareUrl=$this-getAddToCompareUrl($_product)): ?><li><span class=”separator”>|</span><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 comment it out using two forward slash punctuation marks for PHP: //
- For HTML you can use the following punctuation marks: <!– comment –>
- Do the same to alter items in a grid view.
- In order to remove the Add To Compare option from the product page, you should copy addto.phtml file from app/design/frontend/base/default/template/catalog/product/view directory into app/design/frontend/default/themeXXX/template/catalog/product/view directory and remove or comment out the following code:
123456<?php$_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; ?>
- Lastly, if you want to remove the Add To Compare option from the sidebar, you need to edit catalog.xml file located in app/design/frontend/default/themeXXX/layout directory and remove the following code:
1<block type=”catalog/product_compare_sidebar” after=”cart_sidebar” name=”catalog.compare.sidebar” template=”catalog/product/compare/sidebar.phtml”/>
- Save your changes and upload to the server replacing the original files.
- Please note that you may need to clean Magento and Browser cache to see the changes:
- Go to your_domain_name.com/index.php/admin;
- Select System>Cache Management;
- In Cache Control box check all options and in All Cache dropdown select Refresh;
- Open your website and refresh the page CTRL+F5.
Thank you for watching this tutorial. Now you know how to remove Add To Compare option in Magento template(s).