I am trying to add a simple generic button to the Sales Order View page using the adminhtml_widget_container_html_before event but no matter what I try the button will not appear.

Here is my code:


<?xml version="1.0"?>





Class ZeroBars_Approvebutton_Model_Observer
    public function adminhtmlWidgetContainerHtmlBefore($event) {

        $block = $event->getBlock();
        if ($block instanceof Mage_Adminhtml_Block_Sales_Order_View) {
            $block->addButton('do_something_crazy', array(
                'label'     => Mage::helper('module')->__('Button'),
                'onclick'   => "setLocation('{some location}')",
                'class'     => 'go'

The method for adding a button on the page seems pretty straightforward so I am not sure why it is not working. Is there a possibility that another extension is overriding it?

  • Is your observer (method adminhtmlWidgetContainerHtmlBefore) being invoked?
    – laketuna
    Mar 25, 2015 at 1:00
  • Your module files seems ok for me except for the observer definition. You need to use class instead of Class in your Observer.php. Also clear the cache and then try again. Mar 25, 2015 at 1:09
  • I don't think the function adminhtmlWidgetContainerHtmlBefore is being called. I added a var_dump / die line to it and nothing happens at all on the front end. Also changed "class" to lowercase and the problem persists.
    – Kray
    Mar 25, 2015 at 22:31

1 Answer 1


In your config.xml you have a <global> node however that is never closed out add </global> before <adminhtml> and it should work everything else looks OK to me.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.