From 34aa95c60c618ab4989d0bd5b6d86a83572a4883 Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Fri, 24 Dec 2021 12:09:05 +0530 Subject: [PATCH] changes in calculating advance_paid_amount in orders table --- classes/PaymentModule.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/classes/PaymentModule.php b/classes/PaymentModule.php index c451a8923..1a5517fb4 100644 --- a/classes/PaymentModule.php +++ b/classes/PaymentModule.php @@ -355,7 +355,11 @@ public function validateOrder($id_cart, $id_order_state, $amount_paid, $payment_ // advance payment information $order->is_advance_payment = $this->context->cart->is_advance_payment; - $order->advance_paid_amount = (float)Tools::ps_round((float)$this->context->cart->getOrderTotal(true, Cart::ADVANCE_PAYMENT, $order->product_list, $id_carrier), _PS_PRICE_COMPUTE_PRECISION_); + if ($order->is_advance_payment) { + $order->advance_paid_amount = (float)Tools::ps_round((float)$this->context->cart->getOrderTotal(true, Cart::ADVANCE_PAYMENT, $order->product_list, $id_carrier), _PS_PRICE_COMPUTE_PRECISION_); + } else { + $order->advance_paid_amount = (float)Tools::ps_round((float)$this->context->cart->getOrderTotal(true, Cart::BOTH, $order->product_list, $id_carrier), _PS_PRICE_COMPUTE_PRECISION_); + } // Creating order $result = $order->add();