I want to add a button on the Order View page of the Admin.
I created a custom module in app\code\community\CPT\TCS and added subfolders Block, controllers, etc, Helper, Model, sql
This is my CPT_TCS.xml file in app\etc\modules\
CPT_TCS.xml
:
<?xml version="1.0"?>
<config>
<modules>
<CPT_TCS>
<active>true</active>
<codePool>community</codePool>
<depends>
<Mage_Adminhtml />
</depends>
</CPT_TCS>
</modules>
</config>
This is my custom module's etc\config.xml
:
<?xml version="1.0" ?>
<config>
<modules>
<CPT_TCS>
<version>
1.0.0
</version>
</CPT_TCS>
</modules>
<blocks>
<cpttcs>
<class>CPT_TCS_Block</class>
</cpttcs>
<adminhtml>
<rewrite>
<sales_order_view>CPT_TCS_Block_Adminhtml_Sales_Order_View</sales_order_view>
</rewrite>
</adminhtml>
</blocks>
</config>
Now I've added view.php
in TCS\Block\Adminhtml\Sales\Order\
<?php
class CPT_TCS_Block_Sales_Order_View extends Mage_Adminhtml_Block_Adminhtml_Sales_Order_View
{
public function __construct() {
//parent constructor
parent::__construct();
//create URL to our custom action
$url = Mage::helper("adminhtml")->getUrl(
"CPT_TCS/order/doSomething",
array('order_id'=>$this->getOrder()->getId())
);
//add the button
$this->_addButton('cygtest_resubmit', array(
'label' => Mage::helper('sales')->__('Send TCS'),
'onclick' => 'setLocation(\'' . $url . '\')',
'class' => 'go'
));
}
}
The "Send TCS" button is not showing on order view page (this "Send TCS" button should ultimately send data order data on web service).
What can be wrong here?
rewrite
is actually working - link