I'm using the allreviews
Magento extension so that I have a page with all reviews however I need to add pagination to this page.
The last bit I'm stuck with is essentially adding the limit to the query. I've read a number of threads that say to use setCurPage
on the collection but this doesn't seem to affect the query at all?
When I try what should equal LIMIT 25, 25
and LIMIT 75,25
etc I still get the result from LIMIT 0, 25
Current query:
//$_GET['product'] = 1; //product id
$numberOfReviews = 25; //per page
$page = 3; //page
$_reviews = Mage::getModel('review/review')
->getCollection()
->addFieldToFilter('entity_pk_value', $_GET['product'])
->addStoreFilter(Mage::app()->getStore()->getId())
->addStatusFilter(Mage_Review_Model_Review::STATUS_APPROVED)
->setDateOrder('desc')
->setPageSize($numberOfReviews)
->addRateVotes()
->setCurPage($page);
What am I doing wrong?
Best Answer
I believe
addRateVotes()
loads the collection, trysetCurPage()
before that call.Once a collection has been loaded, no changes can be made to it without first clearing it.