Layout Magento:如何使用XML布局更新仅更新块参数

Layout Magento:如何使用XML布局更新仅更新块参数,layout,magento,block,Layout,Magento,Block,我有catalog\u category\u默认句柄,它有这样一个内容引用 <reference name="content"> <block type="catalog/category_view" name="category.products" template="catalog/category/view.phtml"> <block type="catalog/product_list" name="prod

我有catalog\u category\u默认句柄,它有这样一个内容引用

    <reference name="content">
        <block type="catalog/category_view" name="category.products" template="catalog/category/view.phtml">
            <block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml">
                <block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
                    <block type="page/html_pager" name="product_list_toolbar_pager"/>
                    <!-- The following code shows how to set your own pager increments -->
                        <action method="setDefaultDirection"><string>desc</string></action>
                        <action method="setDefaultListPerPage"><limit>10</limit></action>
                        <action method="setDefaultGridPerPage"><limit>9</limit></action>
                        <action method="addPagerLimit"><mode>list</mode><limit>10</limit></action>
                        <action method="addPagerLimit"><mode>list</mode><limit>20</limit></action>
                        <action method="addPagerLimit"><mode>list</mode><limit>30</limit></action>
                        <action method="addPagerLimit" translate="label"><mode>list</mode><limit>all</limit><label>All</label></action>
                        <action method="addPagerLimit"><mode>grid</mode><limit>12</limit></action>
                        <action method="addPagerLimit"><mode>grid</mode><limit>30</limit></action>
                        <action method="addPagerLimit"><mode>grid</mode><limit>60</limit></action>
                        <action method="addPagerLimit" translate="label"><mode>grid</mode><limit>all</limit><label>All</label></action>
                </block>
                <action method="addColumnCountLayoutDepend"><layout>empty</layout><count>6</count></action>
                <action method="addColumnCountLayoutDepend"><layout>one_column</layout><count>5</count></action>
                <action method="addColumnCountLayoutDepend"><layout>two_columns_left</layout><count>4</count></action>
                <action method="addColumnCountLayoutDepend"><layout>two_columns_right</layout><count>4</count></action>
                <action method="addColumnCountLayoutDepend"><layout>three_columns</layout><count>3</count></action>
                <!--action method="setColumnCount"><count>4</count></action-->
                <action method="setToolbarBlockName"><name>product_list_toolbar</name></action>
            </block>
        </block>
    </reference>

描述
10
9
清单10
清单20
清单30
利斯塔拉尔
网格12
网格30
网格60
格里德尔
空的
一栏五
两列左4
两列右4
三列
产品列表工具栏
我想用magento后端的布局更新来更新它,以加载不同的模板,因此

<block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml">

应该成为

<block type="catalog/product_list" name="product_list" template="catalog/product/other-list.phtml">

我想有比删除内容引用并创建新引用更好的解决方案。

如何仅更新该参数?

在布局更新中,只需添加以下内容:

<reference name="product_list">
    <action method="setTemplate"><name>catalog/product/other-list.phtml</name></action>
</reference>

目录/产品/其他-list.phtml

这是可能的,因为Magento提供了所有的块(以及模型和对象)魔法设置器

我不明白。我应该打电话给
吗。我先发制人,以为你明白了!非常感谢。我真的很怀念你可以称之为引用的东西,即使是在单个块上,我认为它只能用于“内容”、“左”或“右”之类的引用。现在一切都清楚了!非常感谢。