UPDATE: this is partially answered(for someone who comes here lately).The answers does not updated the search filters.

I want to limit my product collection in any category/subcategory landing page with the help of a url parameter say itemlimit=10

I tried to do this in my phtml with setPageSize(3) but this is setting the number of product in a page so the filters wont get modified accordingly.

Then i tried to do it with


and getting an error like this

Unrecognized method 'setCurPage()'

Am I doing the wrong thing? Should I override the catalog resource model collection for this?


This is my custom block class

class Ziva_Customcatalog_Block_Product_List extends Mage_Catalog_Block_Product_List {
    public function __construct() {

    protected function _getProductCollection() {
        $collection = Mage::getModel('catalog/product')->getCollection();
        return $collection->getSelect()->limit(10); // This will first 10 results    

EDIT as asked: the entire trace

#0 C:\wamp\www\magento2\app\code\core\Mage\Catalog\Block\Product\List\Toolbar.php(225): Zend_Db_Select->__call('setCurPage', Array)
#1 C:\wamp\www\magento2\app\code\core\Mage\Catalog\Block\Product\List\Toolbar.php(225): Varien_Db_Select->setCurPage(1)
#2 C:\wamp\www\magento2\app\code\core\Mage\Catalog\Block\Product\List.php(158): Mage_Catalog_Block_Product_List_Toolbar->setCollection(Object(Varien_Db_Select))
#3 C:\wamp\www\magento2\app\code\core\Mage\Core\Block\Abstract.php(862): Mage_Catalog_Block_Product_List->_beforeToHtml()
#4 C:\wamp\www\magento2\app\code\core\Mage\Core\Block\Abstract.php(582): Mage_Core_Block_Abstract->toHtml()

.................................................. #27 C:\wamp\www\magento2\app\code\core\Mage\Core\Model\App.php(354): Mage_Core_Controller_Varien_Front->dispatch() #28 C:\wamp\www\magento2\app\Mage.php(683): Mage_Core_Model_App->run(Array) #29 C:\wamp\www\magento2\index.php(87): Mage::run('', 'store') #30 {main}

  • Did you find solution of this error? I am also stuck with same error.
    – Mohit
    Commented Aug 10, 2017 at 14:26

2 Answers 2


Try this : Updated answer


 . . . . . 
 . . . . . .
 . . . . . 


class Test_Home_Block_Product_List extends Mage_Catalog_Block_Product_List
     protected function _getProductCollection()
        $collection = parent::_getProductCollection(); 
        $noOfItems = 5; // The number of items which you want to show.
        $count = 0;
        $myProductCollection = new Varien_Data_Collection();
        foreach($collection as $product)
            if($count < $noOfItems) {
            } else {

        return $myProductCollection;
  • This i already tried , please see my question. I have posted the error also there in question
    – zamil
    Commented Nov 14, 2013 at 7:18
  • Sorry. I didn't notice it. Can you put the entire error message here?
    – Sukeshini
    Commented Nov 14, 2013 at 7:38
  • edited my qustion
    – zamil
    Commented Nov 14, 2013 at 8:31
  • Edited the answer as well.
    – Sukeshini
    Commented Nov 14, 2013 at 9:04
  • I tried you updated answer. but i am getting this error Fatal error: Call to a member function setCurPage() on a non-object in C:\wamp\www\magento2\app\code\core\Mage\Catalog\Block\Product\List\Toolbar.php on line 225
    – zamil
    Commented Nov 14, 2013 at 9:30

If you only want to filter category_view you could listen to the event which is triggered just before the collection gets loaded. In your config.xmls global section:


In your Observer model you can alter the collection:

 * @param Varien_Event_Observer $observer
 * @return Ziva_Customcatalog_Model_Observer
public function catalogBlockProductListCollection(Varien_Event_Observer $observer)
    $collection = $observer->getCollection();
    if($collection) {
        //todo: get params from request
    return $this;

The event gets dispatched in app/code/core/Mage/Catalog/Block/Product/List.php:161.

  • I tried this code But there is no change in the output. it loads the total number of items in a collection. I tried an echo inside the function catalogBlockProductListCollection but that is not output to the browser. So i assume it is not calling this method. Any suggestions.
    – zamil
    Commented Nov 14, 2013 at 9:57
  • My observer.php is in Model/Observer.php
    – zamil
    Commented Nov 14, 2013 at 10:06
  • Your section models might be called different then ziva_customcatalog. Take care to clear the config cache after assuring your module is enabled via app/etc/modules and the observers is referenced correctly according to: <class>ziva_customcatalog/observer</class> Commented Nov 14, 2013 at 10:30
  • this is the error i am getting Warning: include(Mage\Ziva\Customcatalog\Model\Observer.php)
    – zamil
    Commented Nov 14, 2013 at 11:10
  • Please show how you reference your models within config.xmls global section? magentocommerce.com/wiki/5_-_modules_and_development/reference/… Commented Nov 14, 2013 at 11:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.