Overwrite an administration unit that is being overwritten by another extension

I'm trying to rewrite sales_order_view. Here is what I have in config.xml

<blocks> <adminhtml> <rewrite> <sales_order_view>Bitstream_FancourierSelfawb_Block_View</sales_order_view> </rewrite> </adminhtml> <bitstream_selfawb> <class>Bitstream_FancourierSelfawb_Block</class> </bitstream_selfawb> </blocks> 

Ofcorse, I have the correct file in Bitstream / FancourierSelfawb / Block

All I need to do is add a button, but looking through the other modules, I see that the block has already been overwritten.

  <blocks> <adminhtml> <rewrite> <sales_order_view>Fooman_EmailAttachments_Block_View</sales_order_view> </rewrite> </adminhtml> </blocks> 

If I comment on this in the config.xml file from the Fooman module, I can see my button. Otherwise, no luck. Is there a way to rewrite the same block twice in another module?

+4
source share
1 answer

In app/etc/modules/Bitstream_FancourierSelfawb.xml add depends node.

 <config> <modules> <Bitstream_FancourierSelfawb> ... <depends> <Fooman_EmailAttachments /> </depends> </Bitstream_FancourierSelfawb> </modules> </config> 

Of course, your Bitstream_FancourierSelfawb_Block_View class will have to extend Fooman_EmailAttachments_Block_View directly instead of the original Mage.


If you want your add-on to work with or without the Fooman extension, you will have to resort to a longer event-based method.

+6
source

Source: https://habr.com/ru/post/1390655/


All Articles