2013-02-20 124 views
0

我试图重写了在Magento特定类别的默认模板和块类设置块级和模板在管理控制台中Magento的类别。如何使用XML

下面的代码只是改变了模板,

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

我还需要从Mage_Catalog_Block_Product_List更改默认座级到Mage_Catalog_Block_Product_List_Foobar。

这可能使用XML中的“自定义布局更新”字段类别?

我曾尝试以下,它也不起作用,

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

回答

1

严格回答:

<CUSTOM_CATEGORY_DISPLAY> 
    <reference name="category.products"> 
     <action method="unsetChild"><child>product_list</child></action> 
     <block type="catalog/product_list_foobar" name="product_list" template="catalog/product/list-foobar.phtml" /> 
    </reference> 
</CUSTOM_CATEGORY_DISPLAY> 

然后,您可以在每个类别中的自定义布局更新XML字段使用<update handle="CUSTOM_CATEGORY_DISPLAY" />为此您希望应用这些指令。

但是,有模型和参与分层导航块之间的一些奇怪/不幸耦合,所以很可能是一些错误行为。