eCommerce

Remove “Add to Compare” Text on Product Listing in Magento

Removing the "Add to Compare" link on product listings requires modifying some code.

Removing the “Add to Compare” link on product listings in Magento is not as easy as one might expect. Fortunately, once you know where to look, the process is relatively straightforward.

Step 1
To remove the Add to Compare link, you just need to edit the .phtml file that inserts the link into the product view. By commenting out the block of code that inserts the link, you can easily remove it from the product listing. Download a copy of YOUR_PACKAGE/YOUR_TEMPLATE/catalog/product/view/addto.phtml via FTP. Open the file in a text editor and find the following code:

<?php if($_compareUrl=$this->helper('catalog/product_compare')->getAddUrl($_product) ): ?>
<a href="<?php echo $_compareUrl ?>"><?php echo $this->__('add to compare') ?></a>
<?php endif; ?>

Step 2
Comment out the code that adds the link (see lines 1 and 5 below):

<!-- <?php if($_compareUrl=$this->helper('catalog/product_compare')->getAddUrl($_product) ): ?>    <a href="<?php echo $_compareUrl ?>"><?php echo $this->__('add to compare') ?></a> <?php endif; ?> -->

And that’s it! Upload the modified addto.phtml file and check the product listing — the “Add to Compare” link will be gone. If it is not, flush Magento’s cache and refresh the page.

Note: this was tested on a Magento 1.4.2 install; however, it should work for Magento 1.3 through 1.6, although the code may be on a different line.

6 Comment on “Remove “Add to Compare” Text on Product Listing in Magento

Leave a Reply

Your email address will not be published. Required fields are marked *