Trliok
Trliok

Reputation: 361

How to add write review link on product list page.if there is no any review of same product product

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

Answers (1)

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

Related Questions