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