2011-06-14 53 views
1

因此,我創建了一個自定義view.phtml文件,以在產品頁面上顯示不同的佈局以進行事件註冊。我能夠顯示該自定義視圖文件,如果我將它添加到設計選項卡下的XML字段。Magento:添加自定義view.phtml到我的自定義產品類型

我想要做的是在magento中創建一個自定義產品類型,該類型已經使用了我的新view-events.phtml。我知道如何創建自定義產品類型,但是如何獲得新產品類型以使用我的自定義視圖文件?

回答

3

在你的模塊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> 
+0

我使用該代碼爲我工作,但不要」噸顯示產品價格和所有兒童htmls。你能幫我解決我做錯了什麼嗎? – 2014-06-19 05:18:09

相關問題