如何使用XML通过管理面板为Magento中的类别设置块类和模板
我试图覆盖Magento中特定类别的默认模板和块类 以下代码仅更改模板如何使用XML通过管理面板为Magento中的类别设置块类和模板,magento,templates,block,categories,magento-1.6,Magento,Templates,Block,Categories,Magento 1.6,我试图覆盖Magento中特定类别的默认模板和块类 以下代码仅更改模板 <reference name="product_list"> <action method="setTemplate"><template>catalog/product/list-foobar.phtml</template></action> </reference> 目录/产品/列表-foobar.phtml 我还需要将默认块类从Mag
<reference name="product_list">
<action method="setTemplate"><template>catalog/product/list-foobar.phtml</template></action>
</reference>
目录/产品/列表-foobar.phtml
我还需要将默认块类从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>
严格回答:
产品目录
然后,您可以在要应用这些指令的每个类别的自定义布局更新XML字段中使用
但是,分层导航中涉及的模型和块之间存在一些奇怪/不幸的耦合,因此很可能存在一些错误行为
<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>