How to hide Review Tabs when no reviews present in Modern Theme
This is an old revision of the document!
I wanted to hide my reviews tab from view on product pages lacking a product review. To do so, go into your:
app / design / frontend / (package name, usually default) / (your theme) / template / review / product /view / list.phtml
<?php if (count($_items)):?>
and comment it out and place this underneath it, like so:
<?php //if (count($_items)):?> <?php if (!empty($_items)):?>
Since the original list.phtml file had a simple <?php> if statement, we now need to give it an else statment so it knows what to do with itself after it can’t find reviews for the product.
At the bottom of list.phtml, before:
<?php endif; ?>
<?php else: ?>
Make sure you use a colon after else to tell the document to continue executing code, a semi colon completes a function.
Your tabs should be devoid of a Review Tab on all products missing a review, if all is done properly.