how to set order status as 'complete' in magento

前端 未结 3 2049
不思量自难忘°
不思量自难忘° 2021-02-03 12:46

how do i set order status as \'complete\' manually.

I am using the following code, but its giving error saying, The Order State \'complete\' must not be set man

3条回答
  •  半阙折子戏
    2021-02-03 13:25

    i found a solution for my self,

    $order = Mage::getModel('sales/order')->loadByIncrementId($order_id);
            $order->setData('state', "complete");
            $order->setStatus("complete");       
            $history = $order->addStatusHistoryComment('Order was set to Complete by our automation tool.', false);
            $history->setIsCustomerNotified(false);
            $order->save();
    

提交回复
热议问题