Magento添加2个按钮后端orderview


Magento add 2 buttons to backend orderview

我试图添加2个按钮到magento(1.8.1)订单视图后端页面。最后一个(电子邮件)出现了,而第一个没有。当我注释掉第二个按钮时,只有第一个按钮显示出来。

如有任何帮助,不胜感激。

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()));
}

}

In manage to

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

如果您在两个按钮中使用相同的排序顺序,那么请使用不同的排序顺序,例如:-

$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');