开发者

Magento: Add a custom view.phtml to my custom product type

So I created a custom view.phtml file to display a different layout on the product page for event registration. I am able to display that custom view file if i add it to the XML field under the design tab.开发者_如何转开发

What i want to do is create a custom product type in magento that already uses my new view-events.phtml. I know how to create the custom product type but how do I get the new product type to use my custom view file?


In your module's 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>

Then in the your_module.xml layout file just referenced:

<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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜