Magento reviews on category page

I wanted to make my category page look even, so everything was the same height, my main problem with that was that I displayed reviews on the category page. The problem with this is that if a product didn’t have a review it didn’t show anything. My solution was to add the following lines of code to list.phtml in the catalog template files

<?php if($_product->getRatingSummary()): ?>
<?php echo $this->getReviewsSummaryHtml($_product, ‘short’) ?>
<?php else: ?>
<p align=”center”><a href=”<?php echo $_product->getProductUrl() ?>#product_tabs_review_tabbed” title=”<?php echo $this->stripTags($_product->getName(), null, true) ?>”>Be the first to review</a></p>
<?php endif; ?>

This then presented me with another problem, for some products it displayed “be the first to review”  and for some it didn’t, I checked what displayed and what didn’t and it appeared that products displayed “be the first to review” if they were created after an upgrade from 1.7 to 1.8 so a quick search of the database. I found that if you go to review_entity_summary and clear out any entries that have a review_count of 0 they will then all display.

Leave a comment

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.