Our Review page displaying same as product view page except short description.

when i add below code in app/design/frontend/rwd/theme/template/review/product/view.phtml

it didn't displayed short description in review page.

when i use template path hints, it gave like this

<?php if ($_product->getShortDescription()):?>
<div class="short-description">
<div class="std"><?php echo $_helper->productAttribute($_product, nl2br($_product->getShortDescription()), 'short_description') ?></div>
<?php endif;?>


 <?php echo $this->htmlEscape($this->getProductInfo()->getShortDescription()); ?>

complete code of review/product/view.phtml

    <!-- Short Description -->

//  echo $this->escapeHtml($this->getProductData()->getShortDescription());     
//  $pro=Mage::getModel('catalog/product')->load($this->getProductData()->getId()); echo $pro->getShortDescription();

echo $this->getProductData()->getShortDescription();

<!-- Short Description -->

<?php if($this->getProductData()->getId()): ?>
<div class="product-review">
    <div class="page-title">
        <h1><?php echo $this->__('Review Details') ?></h1>
    <div class="product-img-box">
        <a href="<?php echo $this->getProductData()->getProductUrl() ?>" title="<?php echo $this->escapeHtml($this->getProductData()->getName()) ?>">
            <img src="<?php echo $this->helper('catalog/image')->init($this->getProductData(), 'small_image')->resize(450, 450)->keepFrame(false); ?>"
                 alt="<?php echo $this->escapeHtml($this->getProductData()->getName()) ?>"
                 class="product-image" />
        <?php if( $this->getRating() && $this->getRating()->getSize()): ?>
             <p class="label"><?php echo $this->__('Average Customer Rating') ?>:</p>
             <?php echo $this->getReviewsSummaryHtml($this->getProductData()) ?>
        <?php endif; ?>
    <div class="product-details">
        <h2 class="product-name"><?php echo $this->escapeHtml($this->getProductData()->getName()) ?></h2>
        <?php if( $this->getRating() && $this->getRating()->getSize()): ?>
            <h3><?php echo $this->__('Product Rating:') ?></h3>
            <table class="ratings-table">
            <?php foreach ($this->getRating() as $_rating): ?>
                <?php if($_rating->getPercent()): ?>
                        <th><?php echo $this->__($this->escapeHtml($_rating->getRatingCode())) ?></th>
                            <div class="rating-box">
                                <div class="rating" style="width:<?php echo ceil($_rating->getPercent()) ?>%;"></div>
                <?php endif; ?>
            <?php endforeach; ?>
        <?php endif; ?>
                <?php echo $this->__('Product Review (submitted on %s):', $this->dateFormat($this->getReviewData()->getCreatedAt())) ?>
                <?php echo nl2br($this->escapeHtml($this->getReviewData()->getDetail())) ?>
    <div class="buttons-set">
        <p class="back-link"><a href="<?php echo $this->getBackUrl() ?>"><small>&laquo; </small><?php echo $this->__('Back to Product Reviews') ?></a></p>
<?php endif; ?>


enter image description here

Product view

enter image description here

  • you want to show the description in review section? Jun 22 '16 at 10:20
  • @QaisarSatti i want to display short description in top of the review page as like product view page. Jun 22 '16 at 10:22
  • did you try echo $this->getProductData()->getShortDescription() Jun 22 '16 at 10:38
  • @QaisarSatti just tried that, but did't worked for me. Jun 22 '16 at 10:41
  • @QaisarSatti sorry, did't worked for me. Jun 22 '16 at 10:46

you are editing the wrong file add your code in this file. frontend/rwd/Stylebaby/template/review/product/view/list.phtml

use this code

            $prod=Mage::getModel('catalog/product')->load($this->getProduct()->getId()); echo $prod->getShortDescription();
  • sorry , it didt worked for me. i added the code in list.phtml : link Jun 22 '16 at 12:02
  • @BabyinMagento updated and tested too Jun 22 '16 at 12:07
  • now its displaying reviews under middle of the page as here . I want to display it on top as like product view page here also in product view page its displaying 2 times, in middle & in top , i want to remove in middle. Jun 22 '16 at 12:14
  • @BabyinMagento now it is a css related thing can't help on that Jun 22 '16 at 12:26
  • got the perfect file : app/design/frontend/rwd/theme/template/review/product/view/other.phtml when i used your code it giving error as Fatal error: Call to a member function getId() on a non-object in but <p>test</p> is working fine. Jun 22 '16 at 12:40

You have to re-write Mage_Review_Block_Product_View block (or move to local codepool) and update below function :

protected function _toHtml()
//Comment this line

return parent::_toHtml();

Note: $this->getProduct()->setShortDescription(null); is commented.

  • @Baby in Magento: have you tried this ? Jun 22 '16 at 10:37
  • i will check & let you know. thanks for support. Jun 22 '16 at 10:41
  • got perfect file : app/design/frontend/rwd/theme/template/review/product/view/other.phtml when i use this code echo $this->getProductData()->getShortDescription(); it giving this error : Fatal error: Call to a member function getShortDescription() on a non-object in but html code <p>test</p> is displaying at right place. Jun 22 '16 at 12:51
  • You CAN'T get short description in ANY template file under review_product block, BECAUSE it's set to NULL from the block shown in this answer. You have to comment that line Jun 22 '16 at 13:03
  • if you want to add to app/design/frontend/rwd/theme/template/review/product/view/other.phtml (NOT RECOMMENDED), add this line : <?php echo Mage::getModel('catalog/product')->load($_product->getId())->getShortDescription(); ?> after <?php $_product = Mage::registry('product'); ?> Jun 22 '16 at 14:19

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.