0

Below is code in list.phtml showing products on category pages. I am looking to use the attributes (RatingSummary, ReviewsSummary) in related.phtml

<div class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($_product->getName(), null, true) ?>"><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></a></div>

                **<?php if($_product->getRatingSummary()): ?>
                <?php echo $this->getReviewsSummaryHtml($_product, 'short') ?>
                <?php endif; ?>**

                <?php echo $this->getPriceHtml($_product, true) ?>

I found the below code on the web that might be a step in the right direction but does anybody understand how I can adapt it or something different so (RatingSummary, ReviewsSummary) will work in related.phtml

 foreach($this->getItems() as $_item) {
         $product = Mage::getModel('catalog/product')->load($_item->getId());
         echo $this->htmlEscape($product->getDescription());
} 

I would like to use the (RatingSummary, ReviewsSummary) attributes inside the related.phtml Below is the current related.phtml code:

<div class="product-details">
                    <div class="product-name"><a href="<?php echo $_item->getProductUrl() ?>"><?php echo $this->htmlEscape($_item->getName()) ?></a></div>

                <?php echo $this->getPriceHtml($_item, true) ?>
                        <?php 
                            $listHelper = Mage::helper('colorswatchproductlist'); 
                            $listHelper->showSwatches($_item); ?>
                    </div>
                </div>
2
  • <?php echo $this->getReviewsSummaryHtml($_item, 'short') ?> in related.phtml didn't work?
    – Sander Mangel
    Mar 16, 2015 at 18:59
  • Wow. that worked. what an incredible first experience with stackexchange. question answered perfectly in under a minute
    – Djabba
    Mar 16, 2015 at 19:01

1 Answer 1

1

you can use the blocks getReviewsSummaryHtml since the related.phtml has all of the methods from Mage_Catalog_Block_Product_View available.

So, in your related.phtml add the following

<?php echo $this->getReviewsSummaryHtml($_item, 'short') ?>

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.