如何在Magento管理订单查看屏幕中将Ship按钮的操作更改为自己的Module / controller / action?

时间:2013-03-26 21:33:16

标签: magento

Magento admin

如何更改Magento后端Ship屏幕中Order view按钮的操作?上图描绘了我的意思是Ship按钮。我想把它指向我自己的控制器/我自己模块的动作。我希望尽可能保持干净,以保持Magento的升级而不会破坏我的模块。

1 个答案:

答案 0 :(得分:2)

尝试创建重写Mage_Adminhtml_Block_Sales_Order_View

的自定义模块

<强> config.xml中:

<global>
    <blocks>
         <adminhtml>
            <rewrite>
                <sales_order_view>Namespace_Module_Block_Adminhtml_Sales_Order_View</sales_order_view>
            </rewrite>
        </adminhtml>
    </blocks>
 </global>

<强>命名空间/模块/块/ Adminhtml /销售/订购/ View.php:

class Namespace_Module_Block_Adminhtml_Sales_Order_View extends Mage_Adminhtml_Block_Sales_Order_View {
        public function getShipUrl()
        {
            //add your custom url
            return $this->getUrl('*/sales_order_shipment/start');
        }
}

请参阅/app/code/core/Mage/Adminhtml/Block/Sales/Order/View.php

了解更多@ How to add new button to order view in Magento admin panel?

如果您还想更改标题更新

    if ($this->_isAllowedAction('ship') && $order->canShip()
        && !$order->getForcedDoShipmentWithInvoice()) {
        $this->_addButton('order_ship', array(
            'label'     => Mage::helper('sales')->__('Ship'),
            'onclick'   => 'setLocation(\'' . $this->getShipUrl() . '\')',
            'class'     => 'go'
        ));
    }
相关问题