如何在local.xml中每页更改Magento的默认网格?

问题描述

| 对于magento来说,这是新手,我已经弄清楚了如何使用local.xml进行几乎所有我需要的更改,但是网格视图让我感到困惑。我将网格视图更改为5列,因此显示认9个项目看起来很草率。我想将其设置为5的倍数。浏览catalog.xml时,我认为应该这样做:
<reference name=\"product_list_toolbar_pager\">
    <action method=\"setDefaultGridPerPage\"><limit>15</limit></action>
</reference>
在category_catalog_default和category_catalog_layered句柄中,但没有骰子。我在Magento分散的文档中苦苦挣扎,但实际上却开始欣赏整个布局。 我使用1.5.1,如果有帮助的话。     

解决方法

        花了我很长时间才弄清楚这一点。事实证明,寻呼机值是通过管理员设置的。系统>配置>目录>目录>前端> \“网格上每页的产品默认值\”     ,        我知道这个问题已经回答,但我在这里很喜欢我。 您可以像这样使用XML:
<reference name=\"product_list_toolbar\">
  <action method=\"setDefaultGridPerPage\"><limit>30</limit></action>
</reference>
在“ 2”文件或“ 3”类别字段中。 但是,值得注意的是,该限制仅限于“系统配置目录”页面内列表中的值之一。     ,        有点老问题了,但是我在Google上偶然发现了这个答案,并认为这可能对某人有益。 管理部分中设置的值对我不起作用-我认为我当前正在使用的主题将其覆盖。对于那些想要/需要通过local.xml进行更改的人,这里有一种方法。 查看catalog.xml,将setDefaultGridPerPage嵌套在product_list_toolbar_pager下似乎是合理的,这也是我的想法,但这是一个自闭合标记,我没有发现。您要做的是将其嵌套在product_list_toolbar下。
<catalog_category_layered>
    <reference name=\"product_list_toolbar\">
        <action method=\"setDefaultGridPerPage\">
            <limit>15</limit>
        </action>
    </reference>
</catalog_category_layered>

<catalog_category_default>
    <reference name=\"product_list_toolbar\">
        <action method=\"setDefaultGridPerPage\">
            <limit>15</limit>
        </action>
    </reference>
</catalog_category_default>
这至少为我解决了这个问题。您的里程数可能会有所不同。     ,        
<five_column_grid>
    <reference name=\"product_list\">
        <action method=\"setColumnCount\">
            <count>5</count>
        </action>
    </reference>
</five_column_grid>

<catalog_category_default>
    <update handle=\"five_column_grid\" />
</catalog_category_default>

<catalog_category_layered>
    <update handle=\"five_column_grid\" />
</catalog_category_layered>
它会自动为您调整寻呼机。 玩得开心 :)