While handling a magento job, i encountered a situation to implement the toollbar section for a custom product collection. So today we are discussing about how to add Toolbar and pager to custom product collection in magento

Let us assume $_productCollection is an object of custom product collection.

First we need to create a toolbar object as shown below

$toolbar = Mage::getBlockSingleton('catalog/product_list')->getToolbarBlock();

Then Assign product collection to toolbar object


then set pager to toolbar as a child for show with pagination

  $pager = Mage::getSingleton('core/layout')->createBlock('page/html_pager');
 $toolbar->setChild('product_list_toolbar_pager', $pager);
 echo $toolbar->toHtml();

So this is how we can add Toolbar and pager to custom product collection in magento, hope this helps

Leave a Reply

Your email address will not be published. Required fields are marked *