1

I have large number of product reviews being displayed on product detail page.

I need to count the total number of reviews and set limit on the number of reviews displayed and with pagination.

Does Magento default has this feature ?

How can I achieve this.

Thanks.

1

Yes, it's simple to add these lines to local.xml file

<reference name="product.info">
    <block type="page/html_pager" name="product_review_list.toolbar" />
    <block type="core/template" name="product_review_list.count" template="review/product/view/count.phtml" />
     <block type="review/product_view_list" name="product_customer_reviews" as="product_customer_reviews" template="review/product/view/list.phtml">
        <block type="review/form" name="product.review.form" as="review_form">
            <block type="page/html_wrapper" name="product.review.form.fields.before" as="form_fields_before" translate="label">
                <label>Review Form Fields Before</label>
                <action method="setMayBeInvisible"><value>1</value></action>
            </block>
        </block>
    </block> 
</reference>

0

please check this link which is explaining on Add Paging to a Custom Collection. I'd used this for my custom module and the paging was working exactly as expected.

In your case you must set your collection of review to paging. You may need to customize the template files as well. Hope you knows how to do that.

  • Thanks for your reply but I do not want to make a custom module for pagination. Is there any other solution ? – Mark Mar 28 '14 at 11:32
  • are you using magento's review or is there your own? – Mohammad Faisal Mar 28 '14 at 12:01
  • No Magento's default review – Mark Mar 28 '14 at 12:54
0

It looks like the default theme has a pager for the <review_product_list> handle.

<block type="page/html_pager" name="product_review_list.toolbar" />

Make sure if you are using a custom theme that this is included, you can double check with app/design/frontend/base/default/layout/review.xml to see how the default theme works with the pager.

It should get added to the Mage_Review_Block_Product_View_List when there is a child block with the correct name.

if ($toolbar = $this->getLayout()->getBlock('product_review_list.toolbar')) {
    $toolbar->setCollection($this->getReviewsCollection());
    $this->setChild('toolbar', $toolbar);
}

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.