I am trying to create a button on the Magento View Order page that when I click it, it will email a certain vendor using information that is contained on the order and items in the order.
I have successfully created the module, and the button, I can click the button and it displays a warning type message. But I cannot figure out how to make the button perform the action. Currently the button is just going to a URL.
Here is what I have:
MG_Dropship.xml
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<MG_Dropship>
<!-- Whether our module is active: true or false -->
<active>true</active>
<!-- Which code pool to use: core, community or local -->
<codePool>local</codePool>
</MG_Dropship>
</modules>
</config>
config.xml
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<MG_Dropship>
<version>0.0.1</version>
</MG_Dropship>
</modules>
<!-- Configure our module's behavior in the global scope -->
<global>
<blocks>
<adminhtml>
<rewrite>
<sales_order_view>MG_Dropship_Block_Adminhtml_Sales_Order_View</sales_order_view>
</rewrite>
</adminhtml>
</blocks>
</global>
</config>
View.php
<?php
class MG_Dropship_Block_Adminhtml_Sales_Order_View extends Mage_Adminhtml_Block_Sales_Order_View {
public function __construct() {
parent::__construct();
$this->_addButton('dropship', array(
$message = "Are you sure you want to dropship?",
'label' => Mage::helper('Sales')->__('Dropship'),
'onclick' => "confirmSetLocation('{$message}','{$this->getUrl('MG_Dropship')}')"
));
}
}
Any help would be greatly appreciated.