I have a custom page where I have displayed custom products using custom queries by crossing models against brands. I have an array of products Ids now what I can\'t seem to fig
Step 1: Controller (IndexController.php) file In index controller simply load the layout and render it.
loadLayout();
$this->renderLayout();
}
}
?>
Step 2: Layout (custom.xml) file Put the under given code in the layout file of module.
here is code for block where you can define collection
getCollection();
$this->setCollection($collection);
}
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;
}
public function getPagerHtml()
{
return $this->getChildHtml('pager');
}
}
you have to define custom collection which return the product id as per your requirement.in above code here is the phtml file where you can get pagination
getMessagesBlock()->getGroupedHtml() ?>
getCollection(); ?>
__('My Custom Collection') ?>
getPagerHtml(); ?>
getSize()): ?>
__('ID #') ?>
__('Title') ?>
__('Created') ?>
getCollectionId() ?>
getTitle(); ?>
formatDate($_obj->getCreatedTime()) ?>
getPagerHtml(); ?>
__('The collection is empty.'); ?>
hope this will help you