Magento 默认显示全部 magento products per page on grid default value all

方法 1.  On an old thread I found the answer.

 

In admin go to System->Configuration->Catalog->Catalog->Frontend

 

Set List Mode to List Only or List as default and put a value of 0 for both Products per Page on List allowed values and Products per Page on List default value

 

from: http://www.magentocommerce.com/boards/viewthread/56910/

 

方法 2. Change this to make all products show all the time

app/code/core/Mage/Page/Block/Html/Pager.php:

 public function getLimit()
    {
        //always show all
        return 'all';
        $limits = $this->getAvailableLimit();
        if ($limit = $this->getRequest()->getParam($this->getLimitVarName())) {
            if (isset($limits[$limit])) {
                return $limit;
            }
        }
        $limits = array_keys($limits);
        return $limits[0];
    } 

 

I’m sure you can modify the above to meet your needs of only showing all products on certain pages, and defaulting to the normal behavior when you want it.  As you can see, this code does not use the database values, if there is nothing in the URL (getParams()) then it will use the first key of “$limits”.  $llimits is obtained from the code below.  If you only want certain pages to show all, you can probably override the above function in “Catalog/Block/Product/List/Toolbar.php”.  This will probably have the effect of only showing all for pagers that use the product list toolbar.  Changing the code in the above file will probably change *all* pages that show anything split into multiple pages.


To change the list of available options, change this:
app/code/core/Makge/Catalog/Block/Product/List/Toolbar.php

 public function getAvailableLimit()
    {
        if ($this->getCurrentMode() == 'list') {
            return array(5=>5,10=>10,15=>15,20=>20,25=>25, 'all'=>__('All'));
        }
        elseif ($this->getCurrentMode() == 'grid') {
            return array(9=>9,15=>15,30=>30, 'all'=>__('All'));
        }
        return parent::getAvailableLimit();
    } 

 

from: http://www.magentocommerce.com/boards/viewthread/2055/

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值