【问题标题】:Magento add 2 buttons to backend orderviewMagento 向后端订单视图添加 2 个按钮
【发布时间】:2014-07-29 13:08:47
【问题描述】:

我正在尝试向 magento(1.8.1) 订单视图后端页面添加 2 个按钮。 最后一个(afhaalmail)出现了,第一个没有。当我注释掉第二个按钮时,只显示第一个按钮。

任何帮助将不胜感激。

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

}

【问题讨论】:

  • addButton($id, $data, $level = 0, $sortOrder = 0, $area = 'header') ... 所以你把 sortorder 100 放在他们两个中,所以使用不同的 -不同的排序顺序

标签: php magento extends


【解决方案1】:

在芒果中

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-01-19
    • 2011-10-02
    • 2021-10-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多