It looks like the collection returned in list.phtml has already had load() called, which means that by the time we get to the template we've lost the opportunity to set the page size. So, this is going to get a bit messy!
The block that generates that collection is Mage_Catalog_Block_Product_List
, which we can extend with our own class and override at the same time. Create a new block that extends Mage_Catalog_Block_Product_List
and override the method _getProductCollection
as follows:
/**
* Retrieve loaded category collection
*
* @return Mage_Eav_Model_Entity_Collection_Abstract
*/
protected function _getProductCollection()
{
if (is_null($this->_productCollection)) {
$layer = Mage::getSingleton('catalog/layer');
/* @var $layer Mage_Catalog_Model_Layer */
if ($this->getShowRootCategory()) {
$this->setCategoryId(Mage::app()->getStore()->getRootCategoryId());
}
// if this is a product view page
if (Mage::registry('product')) {
// get collection of categories this product is associated with
$categories = Mage::registry('product')->getCategoryCollection()
->setPage(1, 1)
->load();
// if the product is associated with any category
if ($categories->count()) {
// show products from this category
$this->setCategoryId(current($categories->getIterator()));
}
}
$origCategory = null;
if ($this->getCategoryId()) {
$category = Mage::getModel('catalog/category')->load($this->getCategoryId());
if ($category->getId()) {
$origCategory = $layer->getCurrentCategory();
$layer->setCurrentCategory($category);
}
}
$this->_productCollection = $layer->getProductCollection();
$this->prepareSortableFieldsByCategory($layer->getCurrentCategory());
// OUR CODE MODIFICATION ////////////////////
$yourCustomPage = someFunctionThatDetectsYourCustomPage();
if($yourCustomPage) {
$this->_productCollection->setPageSize(1);
$this->_productCollection->setCurPage(3);
$this->_productCollection->load();
}
/////////////////////////////////////////////
if ($origCategory) {
$layer->setCurrentCategory($origCategory);
}
}
return $this->_productCollection;
}
The important part is to find some way to detect whether you're using the custom list.phtml page or not. Then you'll need to override references to <block type='catalog/product_list' />
in the layouts with your class, and you should be set to go.
Hope that helps!
Thanks,
Joe