Reputation: 361
I want to add a link to the 'write review' page on the category page, in case there is no review of the same product. How do I do this?
Upvotes: 3
Views: 1476
Reputation: 14746
You can count the amount of reviews of a product as follows:
$reviewCount = $_product->getRatingSummary()->getReviewsCount() ? $_product->getRatingSummary()->getReviewsCount(): 0;
if($reviewCount == 0){
//add write review link here
}
And write the anchor tag as follows:
<a href="<?php echo Mage::getUrl('review/product/list', array('id'=> $_product->getId())); ?>#review-form" rel="nofollow"> <?php echo $this->__('Write Review') ?></a>
Upvotes: 6