1.In the main block that calls your collection to render, add the following:

protected function _prepareLayout(){
    parent::_prepareLayout();
    $pager = $this->getLayout()->createBlock('page/html_pager', 'custom.pager');
    $pager->setAvailableLimit(array(9=>9, 18=>18, 27=>27));
    $pager->setCollection($this->_prepareCollection());
    $this->setChild('pager', $pager);
    return $this
}

public function getPagerHtml(){
    return $this->getChildHtml('pager');
}

2.Then, from your template phtml associated to your collection, add the pager controls by echoing the output of our other method, getPagerHtml:

<?php echo $this->getPagerHtml(); ?>

Categories: Magento

0 Comments

Leave a Reply

Avatar placeholder

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