user2013454
user2013454

Reputation: 27

Magento add 2 buttons to backend orderview

I'm trying to add 2 buttons to the magento(1.8.1) order view backend page. The last one(afhaalmail) is showing up and the first one isnt. When i comment out the second button only the first one is showing up.

Any help would be appreciated.

class Web4u_DropshipPackinslip_Block_Adminhtml_Sales_Order_View extends Mage_Adminhtml_Block_Sales_Order_View {
public function  __construct() {
    parent::__construct();


    $this->_addButton('button_id2', array(
        'label'     => 'Pakbon Dropship',
        'onclick'   => 'setLocation(\'' . $this->getNewProductReturnUrl() . '\')',
        'class'     => 'go2'
    ), 0, 100, 'header', 'header');

    $this->_addButton('afhaalmail', array(
        'label'     => 'Afhaalmail versturen',
        'onclick'   => 'setLocation(\'' . $this->getNewProductReturnUrl() . '\')',
        'class'     => 'go'
    ), 0, 100, 'header', 'header');



}

 public function getNewProductReturnUrl()
{

    return $this->getUrl('afhaalmail/adminhtml_afhaalmailbackend/index', array('order_id' => mage::registry('sales_order')->getId()));
    //return $this->getUrl('dropshippackinslip/adminhtml_DropshipPackinslipbackend/index', array('order_id' => mage::registry('sales_order')->getId()));
}

}

Upvotes: 0

Views: 206

Answers (1)

Vishal Sharma
Vishal Sharma

Reputation: 1372

In Mangeto

addButton($id, $data, $level = 0, $sortOrder = 0, $area = 'header');

you are using same Sortorder in both buttons so please use the different - different sort order like:-

$this->_addButton('button_id2', array(
    'label'     => 'Pakbon Dropship',
    'onclick'   => 'setLocation(\'' . $this->getNewProductReturnUrl() . '\')',
    'class'     => 'go2'
), 0, 100, 'header', 'header');

$this->_addButton('afhaalmail', array(
    'label'     => 'Afhaalmail versturen',
    'onclick'   => 'setLocation(\'' . $this->getNewProductReturnUrl() . '\')',
    'class'     => 'go'
), 0, 150, 'header', 'header');

Upvotes: 1

Related Questions