From c10a094ea0b621acf33a4f097e7001d044b9b99a Mon Sep 17 00:00:00 2001 From: Daniel Kerr Date: Fri, 9 Aug 2024 17:21:57 +0800 Subject: [PATCH] https://github.com/opencart/opencart/issues/12661 --- upload/admin/controller/sale/order.php | 118 +++++++++--------- .../admin/view/template/sale/order_info.twig | 59 ++++----- .../catalog/controller/api/payment_method.php | 8 +- .../controller/api/shipping_method.php | 16 +++ 4 files changed, 103 insertions(+), 98 deletions(-) diff --git a/upload/admin/controller/sale/order.php b/upload/admin/controller/sale/order.php index 43d5c609c67..c6731e5b929 100644 --- a/upload/admin/controller/sale/order.php +++ b/upload/admin/controller/sale/order.php @@ -825,65 +825,6 @@ public function info(): void { $data['currencies'] = $this->model_localisation_currency->getCurrencies(); - // Coupon, Voucher, Reward - $data['total_coupon'] = ''; - $data['total_voucher'] = ''; - $data['total_reward'] = 0; - - if ($order_id) { - $order_totals = $this->model_sale_order->getTotals($order_id); - - foreach ($order_totals as $order_total) { - // If coupon, voucher or reward points - $start = strpos($order_total['title'], '('); - $end = strrpos($order_total['title'], ')'); - - if ($start !== false && $end !== false) { - $data['total_' . $order_total['code']] = substr($order_total['title'], $start + 1, $end - ($start + 1)); - } - } - } - - // Reward Points - if (!empty($order_info)) { - $data['points'] = $this->model_sale_order->getRewardTotal($order_id); - } else { - $data['points'] = 0; - } - - // Reward Points - if (!empty($order_info)) { - $data['reward_total'] = $this->model_customer_customer->getTotalRewardsByOrderId($order_id); - } else { - $data['reward_total'] = 0; - } - - // Affiliate - if (!empty($order_info)) { - $data['affiliate_id'] = $order_info['affiliate_id']; - } else { - $data['affiliate_id'] = 0; - } - - if (!empty($order_info)) { - $data['affiliate'] = $order_info['affiliate']; - } else { - $data['affiliate'] = ''; - } - - // Commission - if (!empty($order_info) && (float)$order_info['commission']) { - $data['commission'] = $this->currency->format($order_info['commission'], $this->config->get('config_currency')); - } else { - $data['commission'] = ''; - } - - if (!empty($order_info)) { - $data['commission_total'] = $this->model_customer_customer->getTotalTransactionsByOrderId($order_id); - } else { - $data['commission_total'] = ''; - } - // Addresses if (!empty($order_info)) { $this->load->model('customer/customer'); @@ -1082,6 +1023,65 @@ public function info(): void { $data['shipping_code'] = ''; } + // Coupon, Voucher, Reward + $data['total_coupon'] = ''; + $data['total_voucher'] = ''; + $data['total_reward'] = 0; + + if ($order_id) { + $order_totals = $this->model_sale_order->getTotals($order_id); + + foreach ($order_totals as $order_total) { + // If coupon, voucher or reward points + $start = strpos($order_total['title'], '('); + $end = strrpos($order_total['title'], ')'); + + if ($start !== false && $end !== false) { + $data['total_' . $order_total['code']] = substr($order_total['title'], $start + 1, $end - ($start + 1)); + } + } + } + + // Reward Points + if (!empty($order_info)) { + $data['points'] = $this->model_sale_order->getRewardTotal($order_id); + } else { + $data['points'] = 0; + } + + // Reward Points + if (!empty($order_info)) { + $data['reward_total'] = $this->model_customer_customer->getTotalRewardsByOrderId($order_id); + } else { + $data['reward_total'] = 0; + } + + // Affiliate + if (!empty($order_info)) { + $data['affiliate_id'] = $order_info['affiliate_id']; + } else { + $data['affiliate_id'] = 0; + } + + if (!empty($order_info)) { + $data['affiliate'] = $order_info['affiliate']; + } else { + $data['affiliate'] = ''; + } + + // Commission + if (!empty($order_info) && (float)$order_info['commission']) { + $data['commission'] = $this->currency->format($order_info['commission'], $this->config->get('config_currency')); + } else { + $data['commission'] = ''; + } + + if (!empty($order_info)) { + $data['commission_total'] = $this->model_customer_customer->getTotalTransactionsByOrderId($order_id); + } else { + $data['commission_total'] = ''; + } + // Comment if (!empty($order_info)) { $data['comment'] = nl2br($order_info['comment']); diff --git a/upload/admin/view/template/sale/order_info.twig b/upload/admin/view/template/sale/order_info.twig index 51818d138b4..c712707836c 100644 --- a/upload/admin/view/template/sale/order_info.twig +++ b/upload/admin/view/template/sale/order_info.twig @@ -222,7 +222,6 @@ -
@@ -266,7 +265,6 @@
-
@@ -440,7 +438,6 @@ {% endfor %}
-
{{ text_history }} @@ -491,7 +488,6 @@
-
@@ -541,7 +537,6 @@