Question

I am using this url: http://xhtmlandcsshelp.blogspot.in/2010/12/get-products-from-particular-category.html

i need to display particular category id's product on home page

So I used that url, i have added,

$model->load($_prdIds);
$pname = $model->getName();

But rating summary stars how do I display? Can anyone help me please?

Thanks in advance ...

Was it helpful?

Solution

Tested and working on Magento 1.7.0.1


Reviews on homepage


<?php
    /**
     * Instanciate reviews helper
     */
    $this->_reviewsHelperBlock = $this->getLayout()->createBlock('review/helper');

    /**
     * Get products for your category
     */
    $products = Mage::getModel('catalog/category')->load(YOUR_CATEGORY_ID)->getProductCollection();

    /**
     * Loop thru products
     */
    foreach($products as $product) {
        $product = Mage::getModel('catalog/product')->load($product->getId());
        echo $product->getName();

        /**
         * Display review summary with stars.
         * If correctly configured in back-office: Catalog > Reviews and Ratings > Manage Ratings
         */
        echo $this->_reviewsHelperBlock->getSummaryHtml($product, false, false);

        echo '<hr/>';
    }
?>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top