Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email

Magento Forum

toolbar not respecting collection size / page attributes
Total Posts:  31
Joined:  2013-04-23

So I’ve overloaded the Mage_Catalog_Block_Product_List with the following function in order to handle an additional filter paramter to the collection

class My_Catalog_Block_Product_List extends Mage_Catalog_Block_Product_List {
protected function getProductCollection() {
//$collection = parent::_getProductCollection();
$collection $this->_productCollection;
$a $this->getRequest()->getParam('a');
        if (
$a != ''{
->addAttributeToFilter('name', array('regexp' => array('^['.substr($a01).'-'.substr($a11).']')));
$this->_productCollection $collection;

Within my Toolbar, I’m instantiating it and feeding it the resulting product collection

$toolbar $this->getLayout()
along with a foreach loop to iterate through the returned products
foreach ($_productCollection as $_product{
// do stuff

the foreach loop correctly only displays 12 items, as well as the proper page of the collection. (items 13-24 on page 2, etc..)
however the toolbar shows the count as the full collection (size before adding the custom filter above), as well as displaying the full pagination for the full collection.

How can I get the toolbar to respect the filtered collection size fed to it?

Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top