1

I have create the custom pagination with Magento(1.9), see the below code for the pagination.

code in block

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

protected function _prepareLayout()
 {
        parent::_prepareLayout();
        $pager = $this->getLayout()->createBlock('page/html_pager', 'custom.pager');
        $pager->setAvailableLimit(array(5=>5,10=>10,20=>20,'all'=>'all'));
        $pager->setCollection($this->getCollection());
        $this->setChild('pager', $pager);
        $this->getCollection()->load();
        return $this;
  }

by default it list the first 5 list, i need to list only 4. how and where i need to work for this changes.

FYI i attached screen will better help you.

enter image description here

4

Set setAvailableLimit() as

$pager->setAvailableLimit(array(4=>4,10=>10,20=>20,'all'=>'all')); // Now you can get 4 items in a page.

i.e, The first element in the array will be set the default limit for the collection (per page).

  • Hi sundaram,i follow as per your suggestion, but still no response, unfortunately its show 6 records in first page. – senthil Oct 23 '15 at 5:57
1

You can try $pager->setPageSize(4)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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