Magento:添加自定义view.phtml到我的自定义产品类型
问题描述:
因此,我创建了一个自定义view.phtml文件,以在产品页面上显示不同的布局以进行事件注册。我能够显示该自定义视图文件,如果我将它添加到设计选项卡下的XML字段。Magento:添加自定义view.phtml到我的自定义产品类型
我想要做的是在magento中创建一个自定义产品类型,该类型已经使用了我的新view-events.phtml。我知道如何创建自定义产品类型,但是如何获得新产品类型以使用我的自定义视图文件?
答
在你的模块config.xml中:
<config>
<global>
<catalog>
<product>
<type>
<!-- Change "custom" to your custom product type -->
<custom>
<!-- See app/code/core/Mage/Catalog/etc/config.xml for hints here -->
</custom>
</type>
</product>
</catalog>
</global>
<frontend>
<layout>
<updates>
<!-- Use your module's name here -->
<your_module>
<file>your_module.xml</file>
</your_module>
</updates>
</layout>
</frontend>
然后在your_module.xml布局文件只是引用:
<layout>
<PRODUCT_TYPE_custom>
<reference name="product.info">
<action method="setTemplate">
<template>path/to/your/view-events.phtml</template>
</action>
</reference>
</PRODUCT_TYPE_custom>
</layout>
我使用该代码为我工作,但不要”吨显示产品价格和所有儿童htmls。你能帮我解决我做错了什么吗? – 2014-06-19 05:18:09