Im trying to limit the number of returned results manually in a copy of the list.phtml template, but its turning out to be alot harder than I anticipated.
Ive tried man
A similar approach to @joseph is to override Mage_Catalog_Block_Product_List
but insert the following code in your new class:
const PAGE_SIZE = 3;
protected function _getProductCollection(){
$collection = parent::_getProductCollection();
$yourCustomBoolean = someFunctionThatDetectsYourCustomPage();
if($yourCustomBoolean) {
$collection->setPageSize(self::PAGE_SIZE);
}
return $collection;
}
that way you will inherit any future changes in the Mage_Catalog code from the parent block but still set your page limits.
Ideally you would use a system.xml
node to create a field that can be edited by an administrator without hardcoding the page_size. The xml would look something like:
text
9999
1
1
1
Then retrieve that value in your code with:
$page_size = Mage::getStoreConfig('catalog/frontend/custom_page_size');
HTH,
JD