在一个BLOCK的类里面
protected function _prepareLayout(){
parent::_prepareLayout();
$brand_id= $this->getRequest()->getParam('id');
if (is_numeric($brand_id)) {
$collection = Mage::getModel('catalog/product')->getCollection();
$collection->addFieldToFilter('brand', array('eq' => $brand_id));
$pager = $this->getLayout()->createBlock('page/html_pager')
->setTemplate('page/html/test.pager.phtml')
->setLimit($this->page_size)
->setCollection($collection);
$this->setChild('pager', $pager);
}
return $this;
}
public function getPagerHtml(){
return $this->getChildHtml('pager');
}
调用就很简单啦。。对应的.phtml
<?php echo $this->getPagerHtml()?>
更多精彩内容:各种AI课程、技能课程、黑科技软件、网站小程序源码、副业小项目、PPT模板等精品素材、电商课程、推广引流课程等,尽在 天边资源网 。