如何在magento中覆盖管理模板文件? [英] How to override the admin template file in magento?

查看:40
本文介绍了如何在magento中覆盖管理模板文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要覆盖"adminhtml/sales/order/create/items/grid.phtml"文件,以便在通过admin创建新订单时,在每个项目下显示一些自定义文本.我希望通过自定义模块完成此操作.任何人都可以建议如何覆盖管理模板文件?真的很感谢任何帮助

I need to override the "adminhtml/sales/order/create/items/grid.phtml" file to display some custom text under each item while creating new order from admin. I want this to be done through custom module. Anyone can suggest how to override the admin template files? Any help is really appreciated

推荐答案

我建议您创建一个新模板,并通过adminhtml部分的布局更新在模块中添加新设计. 例如:

I Recommend you that create a new template and add new design in your module with the layout update for the adminhtml section. For example:

在自定义扩展名的config.xml中,您可以使用以下方式更新adminhtml的布局:

In your config.xml of your custom extension you can update the layout of adminhtml with:

<adminhtml>
   <layout>
     <updates>
       <adminhtml>
                <file>yourcustomlayout.xml</file>
       </adminhtml>  
     </updates>
   </layout>
</adminhtml>

好吧,那么由于这种布局,您可以编写下一个代码来添加css,例如:

Ok, then since this layout you can write the next code to add a css for example:

<layout>
    <default>
        <reference name="head">
            <action method="addCss">
                <name>aw_all/css/window.css</name>
            </action>

        </reference>
    </default>
</layout>

在这种情况下,您需要为块添加自定义模板

In your case you need add you custom template for your block

<layout>
  <handle>
        <reference name="content">
            <block type="smspremium/adminhtml_smspremium" name="smspremium">
                <action method="setTemplate">
                   <template>customtemplate.phtml</template>
                </action>
            </block>
        </reference>
  </handle>
</layout>

如果您想拆散所有积木并替换成积木,可以将其设为unsetChild

If you want to discart all the block and replace with your block you can made unsetChild

<layout>
      <handle>
            <reference name="content">
                <action method="unsetChild"><name>your.last.block</name></action>

                <block type="smspremium/adminhtml_smspremium" name="smspremium">
                    <action method="setTemplate">
                       <template>customtemplate.phtml</template>
                    </action>
                </block>
            </reference>
      </handle>
 </layout>

此功能与前端布局相同,仅与目录的不同而已,因为您存储了文件. 对于模板:

This work same the frontend layout, only with the diference of the directory since you store your files. For Templates:

app/design/adminhtml/default/default/templates

对于布局:

app/design/adminhtml/default/default/layout

希望可以帮助您

这篇关于如何在magento中覆盖管理模板文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆