How to add new button to order view in Magento admin panel?

后端 未结 4 1953
情书的邮戳
情书的邮戳 2021-02-01 05:02

How to add custom button to order view page near \"Back\" and \"Edit\"?

4条回答
  •  [愿得一人]
    2021-02-01 05:14

    If you want to do it quick-and-dirty (i.e. editing core files), open app/code/core/Mage/Adminhtml/Block/Sales/Order/View.php and add something like:

        $this->_addButton('order_reorder', array(
            'label'     => Mage::helper('sales')->__('Print Labels'),
            'onclick'   => 'window.open(\'/printouts/' . $this->getOrder()->getRealOrderId() . '.pdf\')',
        ));
    

    You can place that before this block:

        if ($this->_isAllowedAction('emails') && !$order->isCanceled()) {
            $message = Mage::helper('sales')->__('Are you sure you want to send order email to customer?');
            $this->addButton('send_notification', array(
                'label'     => Mage::helper('sales')->__('Send Email'),
                'onclick'   => "confirmSetLocation('{$message}', '{$this->getEmailUrl()}')",
            ));
        }
    

    Your challenge, should you choose to accept is to create a file in local that is an over-ride of the core file, and to post it here!

提交回复
热议问题