Showing posts with label set reviews limit on product page. Show all posts
Showing posts with label set reviews limit on product page. Show all posts

Friday, 26 May 2017

Magento Set reviews limit on product page

Copy /app/code/core/Mage/Review/Block/Product/View/View.php to
 /app/code/local/Mage/Review/Block/Product/View.php. with following code :-

Find the function getReviewsCollection() and replce with below function.

public function getReviewsCollection()
    {
        if (null === $this->_reviewsCollection) {
            $this->_reviewsCollection = Mage::getModel('review/review')->getCollection()
                ->addStoreFilter(Mage::app()->getStore()->getId())
                ->addStatusFilter(Mage_Review_Model_Review::STATUS_APPROVED)
                ->addEntityFilter('product', $this->getProduct()->getId())
                ->setDateOrder();
                $this->_reviewsCollection->getSelect()->limit(5);
        }
        return $this->_reviewsCollection;
    }