From 6cab863d14c1fa2ce8583cf1093fc36353b017b9 Mon Sep 17 00:00:00 2001 From: "kai.t" Date: Sat, 18 May 2024 01:21:16 +0000 Subject: [PATCH] sync order --- .../IpSupply/SyncOrder/Observer/CheckOrderStatus.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/code/IpSupply/SyncOrder/Observer/CheckOrderStatus.php b/app/code/IpSupply/SyncOrder/Observer/CheckOrderStatus.php index 2e73eb94..d7171ac6 100755 --- a/app/code/IpSupply/SyncOrder/Observer/CheckOrderStatus.php +++ b/app/code/IpSupply/SyncOrder/Observer/CheckOrderStatus.php @@ -37,9 +37,12 @@ class CheckOrderStatus implements ObserverInterface { $order = $observer->getEvent()->getOrder(); - $sync = new \IpSupply\SyncOrder\Sync\Index; - $content = $sync->syncOrder($order); - $this->_saveLog($content); + $listStateToSync = ['complete', 'processing', 'canceled']; + if ($order instanceof \Magento\Sales\Model\Order && in_array($order->getStatus(), $listStateToSync)) { + $sync = new \IpSupply\SyncOrder\Sync\Index; + $content = $sync->syncOrder($order); + $this->_saveLog($content); + } } }