diff --git a/core/components/minishop3/src/Services/Order/OrderStatusService.php b/core/components/minishop3/src/Services/Order/OrderStatusService.php index eea6e370..3307fca1 100644 --- a/core/components/minishop3/src/Services/Order/OrderStatusService.php +++ b/core/components/minishop3/src/Services/Order/OrderStatusService.php @@ -146,25 +146,27 @@ public function change(int $orderId, int $statusId, bool $skipNotifications = fa $msOrder->set('status_id', $statusId); - if ($msOrder->save()) { - $this->orderLog->add($msOrder->get('id'), $statusId, 'status'); - - $response = $this->ms3->utils->invokeEvent('msOnChangeOrderStatus', [ - 'msOrder' => $msOrder, - 'old_status' => $oldStatus?->get('id'), - 'status' => $statusId, - ]); - if (!$response['success']) { - return $response['message']; - } + if (!$msOrder->save()) { + return $this->modx->lexicon('ms3_err_unknown'); + } - // Send notifications via NotificationManager (unless skipped) - // Use output buffering to prevent any stray output from Fenom/pdoTools - if (!$skipNotifications) { - ob_start(); - $this->sendNotifications($msOrder, $status, $oldStatus); - ob_end_clean(); - } + $this->orderLog->add($msOrder->get('id'), $statusId, 'status'); + + $response = $this->ms3->utils->invokeEvent('msOnChangeOrderStatus', [ + 'msOrder' => $msOrder, + 'old_status' => $oldStatus?->get('id'), + 'status' => $statusId, + ]); + if (!$response['success']) { + return $response['message']; + } + + // Send notifications via NotificationManager (unless skipped) + // Use output buffering to prevent any stray output from Fenom/pdoTools + if (!$skipNotifications) { + ob_start(); + $this->sendNotifications($msOrder, $status, $oldStatus); + ob_end_clean(); } return true;