How to add a link to view the review on the product page. If there is no review of the same product

I want to add a link to the 'write review' page on a category page if there is no review for the same product. How to do it?

+3


source to share


1 answer


You can count the number of product reviews as follows:

$reviewCount = $_product->getRatingSummary()->getReviewsCount() ? $_product->getRatingSummary()->getReviewsCount(): 0;
if($reviewCount == 0){
    //add write review link here 
}

      



And write your anchor tag like this:

<a href="<?php echo Mage::getUrl('review/product/list', array('id'=> $_product->getId())); ?>#review-form" rel="nofollow"> <?php echo $this->__('Write Review') ?></a>

      

+6


source







All Articles