4

我在 magento 中创建了一个商店。我想在产品描述页面中增加追加销售产品的数量。目前它在前面显示 4 个产品,点击下一个链接后显示其他产品。我想把它改成5。

4

2 回答 2

11

upsell 块由布局中的一些布局更新 XML 在布局中调用catalog.xml,并且此限制被施加/评估catalog/product_list_upsell(又名Mage_Catalog_Block_Product_List_Upsell块实例。

<catalog_product_view translate="label">
    <!-- snip -->
    <reference name="content">
        <!-- snip -->
        <block type="catalog/product_list_upsell" name="product.info.upsell" as="upsell_products" template="catalog/product/list/upsell.phtml">
            <action method="setColumnCount"><columns>4</columns></action>
            <action method="setItemLimit"><type>upsell</type><limit>4</limit></action>
        </block>
        <!-- snip -->
    </reference>
    <!-- snip -->
</catalog_product_view>

您可以使用上述信息和您的布局local.xml(如果您还没有它,请创建它)来覆盖该item_limit值:

<catalog_product_view>
    <reference name="product.info.upsell">
        <action method="setItemLimit"><type>upsell</type><limit>5</limit></action>
        <!--
        if you want them all rendered on one line, change the column_count as well:
        <action method="setColumnCount"><columns>5</columns></action>
        -->
    </reference>
</catalog_product_view>

更多信息,请参阅 Mage_Catalog_Block_Product_List_Upsell 类定义

于 2012-06-20T12:29:57.703 回答
0

我认为这可能对至少使用更新版本的 magento (EE) 的人有用。

您可以制作一个更新脚本,这至少适用于企业版(1.14):

$scope = '0';
$installer->setConfigData('catalog/enterprise_targetrule/upsell_position_limit', '5', 'default', $scope);
于 2016-02-23T19:53:54.980 回答