【问题标题】:How to make a custom template to one category in Magento?如何在 Magento 中为一个类别制作自定义模板?
【发布时间】:2014-08-14 19:13:17
【问题描述】:
我想创建一个新主题,该主题将仅替换 list.phtml 文件,保留 view.phtml 等其他文件,并将其归入我的类别之一。
我在 app/design/frontend/default/newtheme/template/catalog/category/list.phtml 上创建了将替换当前 list.phtml 文件的模板文件。
我必须在 app/design/frontend/default/newtheme/layout/ 上创建一个 xml 文件吗?应该怎么样?
如何指定要在我的类别中使用的模板文件?
【问题讨论】:
标签:
php
xml
magento
templates
themes
【解决方案1】:
您可以使用以下代码添加列表 phtml
:
<reference name="product_list">
<action method="setTemplate"><template>yourfilelocation/yourfile.phtml</template></action>
</reference>
<catalog_category_layered>
<catalog_category_default>
<reference name="product_list">
<action method="setTemplate"><template>yourfilelocation/yourfile.phtml</template></action>
</reference>
<catalog_category_default>