在类别列表页面中显示分页

时间:2016-11-25 11:23:56

标签: magento

我为类别创建了一个自定义的phtml文件,其中列出了父类别的子类别。

我想在那个类别列表中显示分页工具栏是否还有呢?

1 个答案:

答案 0 :(得分:0)

您可以在_preparelayout函数中设置集合,如块文件中的以下代码

受保护的函数_prepareLayout()     {

    parent::_prepareLayout();
    $toolbar = $this->getLayout()->createBlock('page/html_pager');
    if ($toolbar) {

       $toolbar->setAvailableLimit(array(10=>10,20=>20,'all'=>'All'));
        $toolbar->setCollection($this->getCollection());
        $this->setChild('toolbar', $toolbar);

    }
    return $this;
}

public function getToolbarHtml()
{
    return $this->getChildHtml('toolbar');
}

并通过

调用您的phtml文件
 $this->getToolbarHtml();