覆盖Magento Adminhtml模板文件 [英] Overriding a Magento Adminhtml template file

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

问题描述

我试图覆盖页面上的特定块,在这种情况下,它是Sales_Order_View_History模板。我看到的问题是这个块已经被覆盖。



覆盖此块的自定义模块使用的观察器基本上是:当History.php要加载,请加载Historytwo.php。 History.php也在后端的两个单独的页面上使用。我只能在一页上覆盖它。这让我完全失去了。我确实相信我想覆盖模板的模块只覆盖我想覆盖的模块。



我看到的一般接受重写块的格式为:

 < adminhtml> 
< rewrite>
< sales_order_view_companyhistory>
Namespace_Package_Blocks_Adminhtml_Sales_Order_View_Companyhistory_Content< /

上面的代码给我一个坏了的布局,

解决方案

如果其他模块在adminhtml_block_html_before事件上使用观察者,重写他们的观察者模型,使它做你想要的?

在同一时间,你也可以在同一事件上添加你自己的观察者,这将做同样的事情,但只有当其他模块未启用(例如,通过检查 Mage :: helper('core') - > isModuleEnabled()),以便它可以在所有情况下工作。 / p>

I'm attempting to override a particular block on a page, in this case it's the Sales_Order_View_History template. The problem I'm seeing is that this block is already being overridden.

The custom module that is overriding this block is using an observer that basically does: when History.php is to be loaded, load Historytwo.php instead. History.php is also being used on two separate pages in the back end. I must only override it on one page. This has gotten me absolutely lost. I do believe that the module I'm wanting to override the template of is only overriding the one I'd like to override.

What I have seen as the generally accepted format for overriding blocks is:

<adminhtml>
    <rewrite>
       <sales_order_view_companyhistory>
       Namespace_Package_Blocks_Adminhtml_Sales_Order_View_Companyhistory_Content</

The above code is giving me a broken layout that is stopping the rendering of most of the blocks/templates.

解决方案

If the other module uses an observer on the "adminhtml_block_html_before" event, have you tried to rewrite their observer model to make it do what you want ?
And in the same time, you could also add your own observer on the same event, that would do the same thing, but only when the other module is not enabled (eg, by checking with Mage::helper('core')->isModuleEnabled()), so that it would work in all cases.

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

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