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

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>
  • How to pass category id.. Is that mandatory..? – Vishnu Dec 15 '16 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. – Fme Extensions Dec 15 '16 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()));

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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