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
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>
-
-
go to
app/code/core/Mage/Review/Block/Helper.php
and checkgetReviewsUrl
method. i also think product id will do that. Dec 15, 2016 at 6:10
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)?>
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
echo Mage::getUrl('review/product/list/id', array('id' => $_product->getId()));
-
It is better to accept the solution rather posting your own identical answer meta.stackexchange.com/questions/5234/… Dec 15, 2016 at 6:27