New answers tagged

0

Ok I see there may not be an answer without digging into Magento's core workflow which is not a good idea, I'm not a fan of that. My solution was to create a new order status "Sent" as a default status assigned to the state "processing" so orders display as sent when sent. Once orders are completed, the order must be invoiced in Magento's back end but ...


2

Try This :- /**Magento/Sales/Model/Order $salesOrder**/ $orderId = 12345; $statusCode = \Magento\Sales\Model\Order::STATE_PROCESSING; $order = $this->salesOrder->load($orderId); $order->setState($order->getState())->setStatus($statusCode); $order->save();


0

Try to implement this check use \Magento\Sales\Api\OrderRepositoryInterface; public function realTest(){ try{ $orderId = 256076; // obtain the order with the order ID $order = $this->_orderRepository->get($orderId); if(!empty($order->getData()){ $...


3

Give a try to below code. With Increment Id $incrementId = 000256076; $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $order = $objectManager->create('\Magento\Sales\Model\Order')->loadByIncrementId($incrementId); $orderState = \Magento\Sales\Model\Order::STATE_PROCESSING; $order->setState($orderState)->setStatus(\...


0

Your code seems to good but Once try to use following code use \Magento\Sales\Api\OrderRepositoryInterface; public function realTest(){ try{ $orderId = 1271; // obtain the order with the order ID $order = $this->_orderRepository->get($orderId); $orderState = \Magento\Sales\Model\Order::...


0

Please try this code of snippet, It will help you <?php namespace Vendor\Module\Controller\Index; use Magento\Framework\App\Action\Action; use Magento\Framework\App\Action\Context; use Magento\Framework\App\ResponseInterface; use Magento\Sales\Model\Order; class Index extends Action { /** * @var \Magento\Framework\Controller\Result\JsonFactory *...


0

Change like this use Magento\Sales\Model\Order; public function __construct( Context $context, \Magento\Sales\Model\Order $orderRepository, \Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory ) { parent::__construct($context); $this->resultJsonFactory = $resultJsonFactory; $this->...


0

use Magento\Sales\Model\Order; $orderId = 1; $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $order = $objectManager->create('\Magento\Sales\Model\Order') ->load($orderId); $orderState = Order::STATE_PROCESSING; $order->setState($orderState)->setStatus(Order::STATE_PROCESSING); $order->save(); Please check with this code....


Top 50 recent answers are included