GoMage Updates

Product Compare Option: How To Disable

Apr 28, 2015 1 min read 167 views
Listen audio
Product Compare Option: How To Disable

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

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

Then, remove the ‘add to compare’function 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 a double slash for PHP: //. For HTML code use symbols <!— comment —>. Then repeat these steps to remove the option in the product’s grade.

In order to disable ‘Add To Compare’ option on the product page, copy the addto.phtml file 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:

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

 

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

<block type="catalog/product_compare_sidebar" after="cart_sidebar" name="catalog.compare
.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 cache in Magento ® and your browser cache. If you have any questions please feel free to leave comments on this article or email GoMage team directly.

That's where you contact us!

    By submitting this form you agree to GoMage's Terms of Use and Privacy Policy
    woo-hoo! Now its time to keep checking your inbox, as we will be getting in touch soon. Promise :)
    oops! Thanks. But it seems like some kind of technical issues stop you from meeting GOMAGE. Could you try again?