1

I need to show star rating list in Layered Navigation in magento1.9 and also need to add custom filter function in layered navigation like Magento default filter functionality.So, before that, I want to know how to get product count by rating collection, by which it will be easy to show product count besides each Star Rating in Rating list. If any one knows about it, please reply back. Thank You

0

for rating count in layered navigation it will count the number of rating of product is above 80 and less then equal too 100. hope you will find the solution..

 protected function _getCount()
{
    // Clone the select

   $select = clone $this->getLayer()->getProductCollection();



    $pid1=$select->getAllIds();
    $var=100;
    $secondvalue=$var-20;

 $products = Mage::getModel('catalog/product')->getCollection()
            ->joinField('rating_summary', 
               'review_entity_summary', 
               'rating_summary', 
               'entity_pk_value=entity_id', 
               array('entity_type'=>1, 'store_id'=> Mage::app()->getStore()->getId()),
               'left'
            )

            ->addAttributeToFilter('entity_id', array('in' => $pid1))
            ->addAttributeToFilter('rating_summary', array('lteq' => $var))
            ->addAttributeToFilter('rating_summary', array('gt' => $secondvalue))->load();



    return count($products);

}

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.