Remove rating and reviews from product comparison

In this article I’ll teach you how to remove the rating and reviews section from the product comparison page in OpenCart.

If you’ve read my previous article on how to disable product reviews in OpenCart you should already know how to login to your OpenCart admin dashboard to turn off the product reviews from showing on your products. However if a user clicks on the Add to Compare link beside a product, and then they click on the product comparison page the product reviews will still display here.

It would probably be helpful to first learn about how to edit a OpenCart template before continuing, as this is the process we’ll be using to make our modifications to OpenCart’s product comparison page.

Disable rating and reviews from product comparisons

Using the steps below you should be able to modify your OpenCart compare.tbl template in order to not display any information regarding the rating or reviews of products.

  1. Open up the File Manager Code Editor in cPanel and edit the following file:

    /catalog/view/theme/default/template/product/compare.tpl
    You should also backup the file before editing to be on the safe side.

  2. Around line 65 you’ll want to comment out or remove the following block of code:

    <tr>
    <td><?php echo $text_rating; ?></td>
    <?php foreach ($products as $product) { ?>
    <td><img src="catalog/view/theme/default/image/stars-
    <?php echo $products[$product['product_id']]['rating']; ?>.png"
    alt="<?php echo $products[$product['product_id']]['reviews']; ?>" /><br />
    <?php echo $products[$product['product_id']]['reviews']; ?></td>
    <?php } ?>
    </tr>

    To simply comment these lines out begin with <!– and end with –> around the code so it ends up looking like this:

    <!--<tr>
    <td><?php echo $text_rating; ?></td>
    <?php foreach ($products as $product) { ?>
    <td><img src="catalog/view/theme/default/image/stars-
    <?php echo $products[$product['product_id']]['rating']; ?>.png"
    alt="<?php echo $products[$product['product_id']]['reviews']; ?>" /><br />
    <?php echo $products[$product['product_id']]['reviews']; ?></td>
    <?php } ?>
    </tr>-->

    Product reviews enabled.

    compare products product reviews enabled

    Product reviews removed.

    compare products product reviews disabled

     

You should now know how to remove the rating and reviews section from the product comparison page in OpenCart.

InMotion Hosting Contributor
InMotion Hosting Contributor Content Writer

InMotion Hosting contributors are highly knowledgeable individuals who create relevant content on new trends and troubleshooting techniques to help you achieve your online goals!

More Articles by InMotion Hosting

Was this article helpful? Join the conversation!

Questions about our MailChannels Deployment? We have answers and are here to help!Learn More
+