magento的订单状态是不可以改变的,现在想要做的是,手动在后台修改订单的状态

1

app\code\core\Mage\Sales\Model\Order.php

970行处:

  if ($shouldProtectState) {
           // if ($this->isStateProtected($state)) {
               // Mage::throwException(
               //     Mage::helper('sales')->__('The Order State "%s" must not be set manually.', $state)
              //  );
           // }
        }

改成这样

然后

2

在文件app/code/core/Mage/Adminhtml/Block/Sales/Order/Grid/php

181行处:

  $this->getMassactionBlock()->addItem('Complete', array(
                 'label'=> Mage::helper('sales')->__('Complete'),
                 'url'  => $this->getUrl('*/sales_order/success'),
            ));

 

3在文件

app/code/core/Mage/Adminhtml/controllers/Sales/OrderController.php

加入方法

 public function successAction()
    {
        $orderIds = $this->getRequest()->getPost('order_ids', array());
        $countSuccessOrder = 0;
        $countNonSuccessOrder = 0;

        foreach ($orderIds as $orderId) {
            $order = Mage::getModel('sales/order')->load($orderId);
            $order->setState(Mage_Sales_Model_Order::STATE_COMPLETE, true)->save();
        }
       
        $this->_redirect('*/*/');
        
    }

即可,在后台的action处就可以看到conplete这个修改方式,然后提交就可以修改了!