Need help buying now? +358 9-424-505-31 +1 888-886-76-81
My Cart

Your Cart is Empty

Need help buying now?
+358 9-424-505-31 +1 888-886-76-81

Disabling of product compare option

Disabling of product compare option

In one of the previous articles of our blog we discussed how to add products to compare. Now we will review how to disable that option if it is not needed.

First of all, open file list.phtml in folder app/design/frontend/default/themeXXX/template/catalog/product on your server. You can do that with the help of FTP client.

Then, remove the function ‘add to compare’ from the product listing page. Using CTRL+F hotkeys locate and remove the following code

<?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; ?>

If you plan to disable the option temporarily you may not remove the code but comment it out with double slash for PHP: //. For HTML code use symbols <!— comment —>. Then repeat these steps to remove the option in the products grade.

In order to disable ‘Add To Compare’ option on the product page copy the file addto.phtml which is located in app/design/frontend/base/default/template/catalog/product/view folder into app/design/frontend/default/themeXXX/template/catalog/product/view folder, then remove or comment out the following code:

$_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; ?>

If you wish to remove the compare option from the sidebar you need to edit the file catalog.xml in folder app/design/frontend/default/themeXXX/layout and then remove or comment out the following code:

<block type="catalog/product_compare_sidebar" after="cart_sidebar" name="
.sidebar" template="catalog/product/compare/sidebar.phtml"/>

As soon as the changes are saved upload modified files on the server. If the changes are not applied on the site, you should clean Magento and browser cache. If you have any questions please feel free to leave comments to this article or email GoMage team directly.