Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Page 1 of 4
Product Reviews on a Product Page
 
rreece0113
Sr. Member
 
Total Posts:  76
Joined:  2009-01-28
Oregon
 

Hi working on a custom theme for magento.

I want to have product reviews displayed on product pages… seems harmless and almost easy to do.. but then the nightmare begins.

I have searched over all my layout/xml files to find a product review block to add to my catelog.xml file.
Thus far I have found nothing.

Anyone know where or what block I would need to add to produce product review in my view.phtml?

 
Magento Community Magento Community
Magento Community
Magento Community
 
NoamDesign
Jr. Member
 
Total Posts:  7
Joined:  2008-05-19
 

I have the same problem. Does anyone have a solution?

 
Magento Community Magento Community
Magento Community
Magento Community
 
robtull
Jr. Member
 
Avatar
Total Posts:  4
Joined:  2009-01-03
Springfield, Missouri
 

The block you guys are looking for can be found in interface/theme/layout/review.xml.

The reviews are all handled by the Review module, and all the layout is in the above file.

In this case, to display basic reviews on a product page, you want to add the following line

<block type="review/product_view_list" name="product.info.product_additional_data" as="reviews" template="review/product/view/list.phtml"/>

to your catalog.xml within catalog_product_view.

Then just make sure you add

<?php echo $this->getChildHtml('reviews'?>

to your catalog/product/view.phtml template, and you’re off and running.

Hope that helps. Cheers!

 
Magento Community Magento Community
Magento Community
Magento Community
 
speang
Jr. Member
 
Total Posts:  17
Joined:  2009-01-12
 

Thank you Rob your code worked for me. I was able to move customer product reviews from reviews page to product page in 1 minute.
Thanks a lot.

 
Magento Community Magento Community
Magento Community
Magento Community
 
speang
Jr. Member
 
Total Posts:  17
Joined:  2009-01-12
 

I just tried something else with code. If you want to display customers reviews and review form on product page you should insert this code instead:

<block type="review/product_view_list" name="product.info.product_additional_data" as="reviews" template="review/product/view/list.phtml">
<block type="review/form" name="product.review.form" as="review_form"/>
</block>

Chears

 
Magento Community Magento Community
Magento Community
Magento Community
 
firestorm
Jr. Member
 
Total Posts:  6
Joined:  2009-02-11
 

bit of a problem I’ve found here - it generates the link to the review itself on the review’s title, but since we’re extracting this code and placing it in a different module, the link gets constructed with /catalog/ instead of /review/ - any idea on how to fix that?

 
Magento Community Magento Community
Magento Community
Magento Community
 
rreece0113
Sr. Member
 
Total Posts:  76
Joined:  2009-01-28
Oregon
 

@Rob Tull -
Thanks this gets me started. But now I have another issue lol.

If I add that review block to the catalog.xml - > <catalog_product_view> -> <reference name="content"> I can get the review block to showup either at top of the page, or the bottom depend where I place it in the XML file.

But what If I want the reviews block to showup in the middle of the page? Or more specific, under the products description block?

Seems that if I nest that review block any further such as :

catalog.xml - > <catalog_product_view> -> <reference name="content"> -> <block type="catalog/product_view" name="product.info" template="catalog/product/view.phtml">

The review block wont showup at all..

So its ok to have the review block be nested directly into the content reference… but any deeper then that and it wont work?
There has got to be a solution here right?

Thanks.

 
Magento Community Magento Community
Magento Community
Magento Community
 
resourcedeal
Jr. Member
 
Total Posts:  1
Joined:  2009-10-12
 

how i can control the number of titles? and i found the title link was wrong, thanks!

 
Magento Community Magento Community
Magento Community
Magento Community
 
itchytrig
Sr. Member
 
Avatar
Total Posts:  162
Joined:  2008-10-03
UK
 

Hi,

To position the review on the product page, then just add:

<?php echo $this->getChildHtml('reviews'?>

to your catalog/product/view.phtml template, where you want it to show… perhaps below additional data towards the bottom of your page? In this case the positioning of the XML code makes no difference, where the actual review block shows up on the product page.

Excellent mod from Rob Tull!

Thanks.

 
Magento Community Magento Community
Magento Community
Magento Community
 
itchytrig
Sr. Member
 
Avatar
Total Posts:  162
Joined:  2008-10-03
UK
 

Oh,

One thing I can’t seem to fix, if anyone can assist:

In order to control the number of reviews on a review page, there appears to be a toolbar / counter (dropdown selection).

As this fix, above allows for the reviews to be shown directly on a product page, we would still need to have some control on how many reviews are displayed at a time… I thought by adding this XML line to the same catalog.xml page, that this would then appear:

<block type="page/html_pager" name="product_review_list.toolbar" />

The include exists in the list.phtml that wraps around the reviews, see here:

<?php echo $this->getChildHtml('toolbar'?>

But it doesn’t… any help much appreciated!

 
Magento Community Magento Community
Magento Community
Magento Community
 
David Oliver
Sr. Member
 
Avatar
Total Posts:  177
Joined:  2008-04-16
Cologne, Germany
 

Many thanks for the information, Rob Tull and speang.

firestorm - 30 June 2009 11:29 AM

bit of a problem I’ve found here - it generates the link to the review itself on the review’s title, but since we’re extracting this code and placing it in a different module, the link gets constructed with /catalog/ instead of /review/ - any idea on how to fix that?

I’d be interested in this, too. It’s not a major problem for me as I’ve edited template/review/product/view/list.phtml and removed the anchor altogether, leaving just the review summary itself.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Leeko
Jr. Member
 
Avatar
Total Posts:  2
Joined:  2009-09-18
 
itchytrig - 04 November 2009 01:12 AM

Oh,

One thing I can’t seem to fix, if anyone can assist:

In order to control the number of reviews on a review page, there appears to be a toolbar / counter (dropdown selection).

As this fix, above allows for the reviews to be shown directly on a product page, we would still need to have some control on how many reviews are displayed at a time… I thought by adding this XML line to the same catalog.xml page, that this would then appear:

<block type="page/html_pager" name="product_review_list.toolbar" />

The include exists in the list.phtml that wraps around the reviews, see here:

<?php echo $this->getChildHtml('toolbar'?>

But it doesn’t… any help much appreciated!

Please do it like this should be work.

<block type="page/html_pager" name="product_review_list.toolbar" />
                <
block type="core/template" name="product_review_list.count" template="review/product/view/count.phtml" />
                <
block type="review/product_view_list" name="product.info.product_additional_data" as="product_reviews" template="review/product/view/list.phtml">
                    <
block type="review/form" name="product.review.form" as="review_form"/>
                </
block>
 
Magento Community Magento Community
Magento Community
Magento Community
 
michelkompanje
Jr. Member
 
Total Posts:  15
Joined:  2009-10-07
 
Leeko - 17 December 2009 02:11 PM

itchytrig - 04 November 2009 01:12 AM
Oh,

One thing I can’t seem to fix, if anyone can assist:

In order to control the number of reviews on a review page, there appears to be a toolbar / counter (dropdown selection).

As this fix, above allows for the reviews to be shown directly on a product page, we would still need to have some control on how many reviews are displayed at a time… I thought by adding this XML line to the same catalog.xml page, that this would then appear:

<block type="page/html_pager" name="product_review_list.toolbar" />

The include exists in the list.phtml that wraps around the reviews, see here:

<?php echo $this->getChildHtml('toolbar'?>

But it doesn’t… any help much appreciated!

Please do it like this should be work.

<block type="page/html_pager" name="product_review_list.toolbar" />
                <
block type="core/template" name="product_review_list.count" template="review/product/view/count.phtml" />
                <
block type="review/product_view_list" name="product.info.product_additional_data" as="product_reviews" template="review/product/view/list.phtml">
                    <
block type="review/form" name="product.review.form" as="review_form"/>
                </
block>

Thanks I don’t get an error now…

Which code should I use to show this block on the productpage?
This code should be in this file, right?
app/design/frontend/*default*/*default*/template/catalog/product/view.phtml

I’m sorry i solved this tiny problem:
Solution: <?php echo $this->getChildHtml('product_reviews') ?>

 
Magento Community Magento Community
Magento Community
Magento Community
 
tjonnyc
Sr. Member
 
Total Posts:  111
Joined:  2009-04-07
 

Hello all,

Since it seems like you guys know what you’re talking about, I’d appreciate it if you could help me out with a small issue.

I’m using Magento 1.3.2.3, with the EasyTabs extension.

The problem I’m having is with the “Write Your Review” link.

If the code

<a href="<?php echo $this->getReviewsUrl() ?>#review-form" rel="nofollow">
    
<?php echo $this->__('Add Your Review'?>
</a>

is placed inside the “Reviews” tab, it produces the following URL on the front-end:

http://www.mydomain.com/category/item.html#review-form

...which does absolutely nothing when clicked on.

In the original, it would produce the following:

http://www.mydomain.com/review/product/list/id/366/category/35/#review-form

It seems like something simple I’m overlooking (like using some other syntax instead of getReviewsUrl), but I can’t figure it out.

Why is it pointing to {current page}#review-form, instead of the specific product ID?

Is there a way to fix it?

Alternately, can anyone show me a way to create the “Add Your Review” link on some other page (i.e. as an “independent” block)?

Thanks in advance!

 
Magento Community Magento Community
Magento Community
Magento Community
 
philsmy
Jr. Member
 
Total Posts:  10
Joined:  2009-01-30
 

I want to be able to let people just rate the item without writing a review. I was pointed to this thread as an answer but I don’t see anything in here to do that.
Also, I want people to be able to RATE the item directly from a catalog page (i.e. let them rate 15 items at a time without having to go to each product’s page).

I am new to magento, so maybe it is the terminology, but this thread talks about ‘the products’ page, which to me means an individual product…

 
Magento Community Magento Community
Magento Community
Magento Community
 
Northern Voyageur
Member
 
Avatar
Total Posts:  50
Joined:  2008-06-05
Duluth, MN
 

To fix the wrong URL here is what I did.

create a file
app/code/local/Mage/Review/Product/View/List.php

copy this into the file

<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Open Software License (OSL 3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/osl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @category   Mage
 * @package    Mage_Review
 * @copyright  Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
 * @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 */

/**
 * Detailed Product Reviews
 *
 * @category   Mage
 * @package    Mage_Review
 * @author      Magento Core Team <core@magentocommerce.com>
 */
class Mage_Review_Block_Product_View_List extends Mage_Review_Block_Product_View
{
    
protected $_forceHasOptions false;

    public function 
getProductId()
    
{
        
return Mage::registry('product')->getId();
    
}

    
protected function _prepareLayout()
    
{
        parent
::_prepareLayout();

        if (
$toolbar $this->getLayout()->getBlock('product_review_list.toolbar')) {
            $toolbar
->setCollection($this->getReviewsCollection());
            
$this->setChild('toolbar'$toolbar);
        
}

        
return $this;
    
}

    
protected function _beforeToHtml()
    
{
        $this
->getReviewsCollection()
            ->
load()
            ->
addRateVotes();
        return 
parent::_beforeToHtml();
    
}

    
public function getReviewUrl($id)
    
{
        
return Mage::getUrl('review/*/view', array('id' => $id));
    
}
}

Notice this last part has

return Mage::getUrl('review/*/view', array('id' => $id));
… the rest is the same as the original.
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 1 of 4