Keep social networking links with reviews disabled

In this article I’ll walk you through the process of keeping your social networking share buttons active, after disabling the product reviews in OpenCart.

If you happened to have read my previous article about how to disable product reviews in OpenCart. I went over how you can turn off the ability for customers to see product reviews on your products. However when you disable this feature, it also removes the social media share buttons that exist for each product as well.

Keeping social share buttons

Using the steps below you’ll be able to still have your social share buttons, while leaving the product reviews disabled for your OpenCart site.

  1. Open up the File Manager Code Editor in cPanel and edit the following file:
    /catalog/view/theme/default/template/product/product.tpl
    You should also backup the file before editing to be on the safe side.
  2. You’ll be looking for code around line 218, where it begins with <?php if ($review_status) { ?>:
    <?php if ($review_status) { ?>
    <div class="review">
    <div><img src="catalog/view/theme/default/image/stars-
    <?php echo $rating; ?>.png" alt="<?php echo $reviews; ?>" />  
    <a onclick="$('a[href='#tab-review']').trigger('click');"><?php echo $reviews; ?></a>  |  
    <a onclick="$('a[href='#tab-review']').trigger('click');">
    <?php echo $text_write; ?></a></div>
    <div class="share"><!-- AddThis Button BEGIN -->
    <div class="addthis_default_style"><a class="addthis_button_compact">
    <?php echo $text_share; ?></a>
    <a class="addthis_button_email"></a>
    <a class="addthis_button_print"></a>
    <a class="addthis_button_facebook"></a>
    <a class="addthis_button_twitter"></a></div>
    <script type="text/javascript" src="//s7.addthis.com/js/250/addthis_widget.js"></script>
    <!-- AddThis Button END -->
    </div>
    </div>
    <?php } ?>

    Copy the code beginning with <div class=”share”> down to the last </div> prior to the closing <?php } ?> tag:

    <div class="share"><!-- AddThis Button BEGIN -->
    <div class="addthis_default_style"><a class="addthis_button_compact">
    <?php echo $text_share; ?></a>
    <a class="addthis_button_email"></a>
    <a class="addthis_button_print"></a>
    <a class="addthis_button_facebook"></a>
    <a class="addthis_button_twitter"></a></div>
    <script type="text/javascript" src="//s7.addthis.com/js/250/addthis_widget.js"></script>
    <!-- AddThis Button END -->
    </div>
    </div>

  3. Directly below the closing <?php } ?> tag and prior to the next <div> tag, insert the following line:
    <div class="review">
    Then proceed to paste your copied code below that added line. You should end up at the end with the full thing looking like this, with the entered in and pasted code in red:
    <?php if ($review_status) { ?>
    <div class="review">
    <div><img src="catalog/view/theme/default/image/stars-<?php echo $rating; ?>.png"
    alt="<?php echo $reviews; ?>" />  <a onclick="$('a[href='#tab-review']').trigger('click');">
    <?php echo $reviews; ?></a>  |  <a onclick="$('a[href='#tab-review']').trigger('click');">
    <?php echo $text_write; ?></a></div>
    <div class="share"><!-- AddThis Button BEGIN -->
    <div class="addthis_default_style"><a class="addthis_button_compact">
    <?php echo $text_share; ?></a>
    <a class="addthis_button_email"></a>
    <a class="addthis_button_print"></a>
    <a class="addthis_button_facebook"></a>
    <a class="addthis_button_twitter"></a></div>
    <script type="text/javascript" src="//s7.addthis.com/js/250/addthis_widget.js"></script>
    <!-- AddThis Button END -->
    </div>
    </div>
    <?php } ?>
    <div class="review">
    <div class="share"><!-- AddThis Button BEGIN -->
    <div class="addthis_default_style">
    <a class="addthis_button_compact">
    <?php echo $text_share; ?></a>
    <a class="addthis_button_email"></a>
    <a class="addthis_button_print"></a>
    <a class="addthis_button_facebook"></a>
    <a class="addthis_button_twitter"></a></div>
    <script type="text/javascript" src="//s7.addthis.com/js/250/addthis_widget.js"></script>
    <!-- AddThis Button END -->
    </div>
    </div>

    </div>
    </div>

    Product reviews enabled.

    front end product reviews and social enabled

    Product reviews disabled and social buttons kept.

    front end product reviews disabled social enabled

     

You should now know how to disable the product reviews within OpenCart, but still keep your social networking share buttons active.

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
+