1

How to get review form page url in view.phtml in magento I want to get the Be first to review this product url in view.phtml file

4 Answers 4

2

you can get url

<a href="<?php echo Mage::getUrl('review/product/list', array(
           'id'        => $productid,
           'category'  => $categoryid
        ));?>#review-form"><?php echo $this->__('Be the first to review this product') ?></a>
2
  • How to pass category id.. Is that mandatory..?
    – Vishnu
    Dec 15, 2016 at 5:49
  • go to app/code/core/Mage/Review/Block/Helper.php and check getReviewsUrl method. i also think product id will do that. Dec 15, 2016 at 6:10
0

Use below code to get that url

If you already Added review form in your view page via layout then add this code in your app/design/frontend/YourPackage/YourTheme/template/catalog/product/view.phtml file

<?php echo $this->getReviewsSummaryHtml($_product, 'default', false)?>
0

In catalog.xml file, add a new child block as below -

<block type="catalog/product_view" name="view.review" as="review" template="review/url.phtml"/>

now create a new phtml file at "review/url.phtml" and add below content -

<?php $_product = $this->getProduct(); ?>
<?php
    $url = Mage::getUrl('review/product/list', array(
            'id'        => $_product->getId(),
            'category'  => $_product->getCategoryId()
            ));
?>
<p class="no-rating"><a href="#review-form">
         <?php echo $this->__('Be the first to review this product') ?>
     </a>
</p>

now in view.phtml file add your link where you want using -

<?php echo $this->getChildHtml('review') ?>

hope this should work for you

0
 echo Mage::getUrl('review/product/list/id', array('id' => $_product->getId()));
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.