【问题标题】:Where to limit the Related Products in MagentoMagento 在哪里限制相关产品
【发布时间】:2015-07-16 09:01:00
【问题描述】:

我想问一下 Magento 中的相关产品。 在 Magento Admin 中,我检查了 20 个产品作为产品“A”的相关产品。 我在view.phtml 文件中写了<?php echo $this->getChildHtml('related'); ?>。 我从核心文件中复制了related.phtml 文件,并编辑了相关产品视图的布局。 当我运行该站点时,它只显示 11 个相关产品。我不知道为什么。我已经做了“清除缓存”和“重新索引”。 请帮帮我..

【问题讨论】:

  • 请检查剩余产品在前端是否可见

标签: magento product


【解决方案1】:

在布局 XML 中设置。默认值为4,如app/design/frontend/base/default/layout/catalog.xml中所见:

<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>

例如,可以在自定义主题中将其更改为 20,使用以下布局 XML:

<layout>
    <catalog_product_view>
        <reference name="product.info.upsell">
            <action method="setItemLimit"><type>upsell</type><limit>20</limit></action>
        </reference>
    </catalog_product_view>
</layout>

(对于无限制,输入0作为限制参数)

这应该在layout/local.xml 或主题特定的布局文件中。不要不要复制和修改原来的catalog.xml

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-02-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多