magento 自定义pager自定义每页显示多少条记录
来源:互联网 发布:java premain 编辑:程序博客网 时间:2024/04/29 08:12
1. 在xml中,定义catalog/product_list_toolbar为xxxx/xxxxter_toolbar
<xxxx_xxxxter_index> <reference name="root"> <action method="setTemplate"><template>page/3columns.phtml</template></action> </reference> <reference name="content"> <block type="xxxx/xxxxter_index" name="xxxx_index" template="bysoft/xxxx/xxxxter/index.phtml"> <block type="xxxx/xxxxter_list" name="product_list" template="bysoft/xxxx/xxxxter/list.phtml"> <!-- <action method="addReviewSummaryTemplate"><type>default</type><template>review/helper/su.phtml</template></action> --> <block type="xxxx/xxxxter_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml"> <block type="page/html_pager" name="product_list_toolbar_pager"> </block> </block> <action method="addColumnCountLayoutDepend"><layout>empty</layout><count>6</count></action> <action method="addColumnCountLayoutDepend"><layout>one_column</layout><count>5</count></action> <action method="addColumnCountLayoutDepend"><layout>two_columns_left</layout><count>4</count></action> <action method="addColumnCountLayoutDepend"><layout>two_columns_right</layout><count>4</count></action> <action method="addColumnCountLayoutDepend"><layout>three_columns</layout><count>3</count></action> <action method="setToolbarBlockName"><name>product_list_toolbar</name></action> </block> </block> </reference></xxxx_xxxxter_index>
2. 继承Mage_Catalog_Block_Product_List_Toolbar,重写getLimit(),里面是自定义的记录数
class AAA_Xxx_Block_Xxxter_Toolbar extends Mage_Catalog_Block_Product_List_Toolbar{ /** * Get specified products limit display per page * * @return string */ public function getLimit() { return Mage::helper('Aaa_Xxx')->getXxxterListingNumber(); }}
3. 继承Mage_Catalog_Block_Product_List, 重写 _getProductCollection()。
<?php class Aaa_Xxx_Block_Xxxter_List extends Mage_Catalog_Block_Product_List{ protected function _getParams($param=null) { if($param) return Mage::app()->getRequest()->getParam($param); else return Mage::app()->getRequest()->getParams(); } /** * Retrieve loaded category collection * * @return Mage_Eav_Model_Entity_Collection_Abstract */ protected function _getProductCollection() { $p = $this->_getParams('p'); if(empty($p)){ $p = 1; } $this->_productCollection=Mage::getResourceModel('catalog/product_collection') ->addStoreFilter() ->setCurPage($p) ->setPageSize(Mage::helper('Aaa_Xxx')->getXxxterListingNumber()) ->addAttributeToSelect("*"); return $this->_productCollection; }}
- magento 自定义pager自定义每页显示多少条记录
- 首先要定义四个变量: int pageSize:每页显示多少条记录 int pageNow:希望显示第几页 int pageCount:一共有多少页 int rowCount:一共有多少条记录 说明:
- extJS控件之每页显示N条记录
- 限定水晶报表每页显示记录条数
- RDLC报表:每页显示N条记录
- RDLC报表:每页显示N条记录
- Silverlight 自定义Pager
- 自定义pager控件
- jquery datatables如何去掉搜索框和每页显示多少条数据
- 每页显示两条
- 在magento前端显示自定义属性值
- 使用jQuery进行客户端无刷新的翻页且可以每页显示记录条数
- 水晶报表分组分页且每页最多显示N条记录
- navicat默认每页显示1000条记录,ctrl+f也只在当前页面搜
- DEV Gridcontrol 查询得到0条记录时显示自定义的字符提示/显示
- 用table显示n条记录,每三条换一下颜色
- 如何使gridView中的每条记录分两行显示
- gird的底部分页工具栏下拉菜单,可以用下拉菜单选择每页显示多少条数据
- asp.net未能加载类型Global
- ASP.NET中Get和Post的用法
- JMock测试入门
- VS2010设置选中的关键字高亮
- Boost.Interprocess使用手册翻译之三:一些基本解释 (Some basic explanations)
- magento 自定义pager自定义每页显示多少条记录
- Extjs3.3.1 实现翻页后,可记录已经选择的选项
- MaintainScrollPositionOnPostback属性
- 【排序】排序算法之---选择排序
- onclientclick和onclick的区别
- EJB的七年之痒
- .ashx 文件
- Asp.net中GDI+生成验证码
- 使用Minify在服务器端合并js/css