Thu. Jul 4th, 2024

48. Magento. How to disable compare products feature

2 min read

magento-remove_add_to_compare1

  1. 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:
    magento-remove_add_to_compare2
  2. You will need to remove “add to compare” option from product list view and/or product grid view.
  3. Using CTRL+F search tool locate and remove the following code:
    1
    2
    3
    4
    <?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; ?>
  4. You can remove the code or comment it out using two forward slash punctuation marks for PHP: //
  5. For HTML you can use the following punctuation marks: <!– comment –>
  6. Do the same to alter items in a grid view.
  7. 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:
    1
    2
    3
    4
    5
    6
    <?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; ?>
  8. 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”/>
  9. Save your changes and upload to the server replacing the original files.
  10. Please note that you may need to clean Magento and Browser cache to see the changes:
    1. Go to your_domain_name.com/index.php/admin;
    2. Select System>Cache Management;
    3. In Cache Control box check all options and in All Cache dropdown select Refresh;
    4. 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).

July 2024
M T W T F S S
« Jun    
1234567
891011121314
15161718192021
22232425262728
293031