[英]How to override the radio.phtml in custom module?
我创建了一个自定义模块,该模块更改了bundle产品选项的模板,它位于radio.phtml
。
我现在重写radio.phtml
上一个新的主题xxx/template/bundle/catalog/product/view/type/bundle/option/radio.phtml
。
但是我想把radio.pthml
放到我的自定义模块文件夹中,即template/mycompany/mymodule/radio.phtml
我了解可以通过使用<action method="setTemplate">
在mymodule.xml
布局中进行<action method="setTemplate">
,但是如何知道radio.phtml
的<reference>
名称?
您需要重写此块,因为主题是在块中设置的。
Mage_Bundle_Block_Catalog_Product_View_Type_Bundle_Option_Radio
你可以在这个功能
protected function _construct()
{
$this->setTemplate('bundle/catalog/product/view/type/bundle/option/radio.phtml');
}
你可以像这样重写模块
<global>
<blocks>
<bundle>
<rewrite>
<catalog_product_view_type_bundle_option_radio>Spacename_Modulname_Block_Adminhtml_Radio</catalog_product_view_type_bundle_option_radio>
</rewrite>
</bumdle>
</blocks>
</global>
并调用您的phtml文件
class Spacename_Modulname_Block_Adminhtml_Radio extends Mage_Core_Block_Template
{
protected function _construct()
{
$this->setTemplate('test/radio.phtml'); //your file path link here
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.