From e481d8c975e9a5937a5201ca43948e161bf8bf26 Mon Sep 17 00:00:00 2001 From: merdan Date: Tue, 5 Jul 2022 15:10:47 +0500 Subject: [PATCH] parse test --- packages/Sarga/Shop/src/Repositories/OrderRepository.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/Sarga/Shop/src/Repositories/OrderRepository.php b/packages/Sarga/Shop/src/Repositories/OrderRepository.php index 6aac442e3..cd15f27c4 100644 --- a/packages/Sarga/Shop/src/Repositories/OrderRepository.php +++ b/packages/Sarga/Shop/src/Repositories/OrderRepository.php @@ -52,9 +52,11 @@ class OrderRepository extends WOrderRepository $order->sub_total = $order->items()->sum('total'); $order->base_sub_total = $order->items()->sum('base_total'); -// dd($order); - $order->grand_total = $order->shipping_amount + $order->sub_total - $order->items->sum('discount_amount') - $order->shipping_discount_amount; - $order->base_grand_total = $order->base_shipping_amount + $order->base_sub_total - $order->items->sum('base_discount_amount') - $order->base_shipping_discount_amount; + $order->discount_amount = $order->items()->sum('discount_amount'); + $order->base_discount_amount = $order->items()->sum('discount_amount'); + + $order->grand_total = $order->shipping_amount + $order->sub_total - $order->discount - $order->shipping_discount_amount; + $order->base_grand_total = $order->base_shipping_amount + $order->base_sub_total - $order->base_discount_amount - $order->base_shipping_discount_amount; $order->save();