How to add custom button to order view page near \"Back\" and \"Edit\"?
Instead of core hacks or rewrites, just use an observer to add the button to the order:
your_module/observer
singleton
adminhtmlWidgetContainerHtmlBefore
Then just check in the observer if the type of the block matches the order view:
public function adminhtmlWidgetContainerHtmlBefore($event)
{
$block = $event->getBlock();
if ($block instanceof Mage_Adminhtml_Block_Sales_Order_View) {
$message = Mage::helper('your_module')->__('Are you sure you want to do this?');
$block->addButton('do_something_crazy', array(
'label' => Mage::helper('your_module')->__('Export Order'),
'onclick' => "confirmSetLocation('{$message}', '{$block->getUrl('*/yourmodule/crazy')}')",
'class' => 'go'
));
}
}
The "getUrl" function of the block will automatically append the current order id to the controller call.