gpt4 book ai didi

xml - Magento 限制新产品 block 中显示的产品数量

转载 作者:数据小太阳 更新时间:2023-10-29 02:05:15 26 4
gpt4 key购买 nike

如何限制新产品 block 中显示的产品数量?通过 cms/pages/design/Layout 更新 XML

<block type="catalog/product_new" name="home.catalog.product.new" template="catalog/product/new.phtml" >
<action method="setColumnCount"><count>5</count></action>
<action method="setLimit"><limit>5</limit></action>
</block>

setLimit 不起作用,

<action method="setDefaultGridPerPage"><limit>5</limit></action>

或:

<action method="setData"><key>limit</key><value>3</value></action>

或:

<action method="setProductLimit"><count>5</count></action> 

或:

<action method="setProductsLimit"><count>5</count></action> 

或:

<action method="setProductsCount"><count>5</count></action>

最佳答案

尝试

 <action method="setProductsCount"><count>5</count></action>

参见/app/code/core/Mage/Catalog/Block/Product/New.php

/**
* Set how much product should be displayed at once.
*
* @param $count
* @return Mage_Catalog_Block_Product_New
*/
public function setProductsCount($count)
{
$this->_productsCount = $count;
return $this;
}

阅读更多@ http://www.magentocommerce.com/wiki/groups/248/display_products_on_home_page

关于xml - Magento 限制新产品 block 中显示的产品数量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13050587/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com