We want to display custom button "Generate bluedart shipment" in Sales > Order view page. so we installed custom module in fresh site, it worked fine.
here we used class Bluedart_Shipment_Block_Sales_Order_View extends Mage_Adminhtml_Block_Sales_Order_View
In another site we used same module, but here another module is already extending default Sales Order view to display Delete Order button as class Raveinfosys_Deleteorder_Block_Adminhtml_Sales_Order_View extends Mage_Adminhtml_Block_Sales_Order_View
So here "Generate Bluedart shipment button" is not displaying....
app/code/community/Bluedart/Shipment/Block/Sales/Order/View.php :
class Bluedart_Shipment_Block_Sales_Order_View extends Mage_Adminhtml_Block_Sales_Order_View
{
function __construct()
{
$itemscount = 0;
$totalWeight = 0;
$_order = Mage::getModel('sales/order')->load($this->getRequest()->getParam('order_id'));
$itemsv = $_order->getAllVisibleItems();
foreach($itemsv as $itemvv){
if($itemvv->getQtyOrdered() > $itemvv->getQtyShipped()){
$itemscount += $itemvv->getQtyOrdered() - $itemvv->getQtyShipped();
}
if($itemvv->getWeight() != 0){
$weight = $itemvv->getWeight()*$itemvv->getQtyOrdered();
} else {
$weight = 0.5*$itemvv->getQtyOrdered();
}
$totalWeight += $weight;
}
$shipments = Mage::getResourceModel('sales/order_shipment_collection')
->addAttributeToSelect('*')
->addFieldToFilter("order_id",$_order->getId())->join("sales/shipment_comment",'main_table.entity_id=parent_id','comment')->addFieldToFilter('comment', array('like'=>"%{$_order->getIncrementId()}%"))->load();
$bluedart_return_button = false;
if($shipments->count()){
foreach($shipments as $key=>$comment){
if (version_compare(PHP_VERSION, '5.3.0') <= 0) {
$awbno=substr($comment->getComment(),0, strpos($comment->getComment(),"- Order No"));
}
else{
$awbno=strstr($comment->getComment(),"- Order No",true);
}
$awbno=trim($awbno,"AWB No.");
break;
}
if((int) $awbno)
$bluedart_return_button = true;
}
if($_order->canShip()){
$this->_addButton('create_bluedart_shipment', array(
'label' => Mage::helper('Sales')->__('Generate Blue Dart Shipment'),
'onclick' => 'bluedartpop('.$itemscount.')',
'class' => 'go'
), 0, 100, 'header', 'header');
}
elseif(!$_order->canShip() && $bluedart_return_button){
$this->_addButton('create_bluedart_shipment', array(
'label' => Mage::helper('Sales')->__('Return Blue Dart Shipment'),
'onclick' => 'bluedartreturnpop('.$itemscount.')',
'class' => 'go'
), 0, 100, 'header', 'header');
}
parent::__construct();
}
}
app/code/community/Raveinfosys/Deleteorder/Block/Adminhtml/Sales/Order/View.php
class Raveinfosys_Deleteorder_Block_Adminhtml_Sales_Order_View extends Mage_Adminhtml_Block_Sales_Order_View
{
public function __construct() {
parent::__construct();
$message = Mage::helper('sales')->__('Are you sure you want to delete this order?');
$this->_addButton('button_id', array(
'label' => Mage::helper('Sales')->__('Delete Order'),
'onclick' => 'deleteConfirm(\''.$message.'\', \'' . $this->getDeleteUrl() . '\')',
'class' => 'go'
), 0, 100, 'header', 'header');
}
public function getDeleteUrl()
{
return $this->getUrl('*/deleteorder/delete', array('_current'=>true));
}
}
I tried this code in Bluedart module, but that didt worked for me : class Bluedart_Shipment_Block_Sales_Order_View extends Raveinfosys_Deleteorder_Block_Adminhtml_Sales_Order_View