From 7285ec09cfbf4199baf7968c74c7106de6afba33 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Mon, 29 Apr 2024 10:19:40 +0530 Subject: [PATCH 01/16] Fixed: Removed service products from the viewed room type list from the view in AdminCustomerController --- controllers/admin/AdminCustomersController.php | 1 + 1 file changed, 1 insertion(+) diff --git a/controllers/admin/AdminCustomersController.php b/controllers/admin/AdminCustomersController.php index 6c763f10c..a70d9dc1a 100644 --- a/controllers/admin/AdminCustomersController.php +++ b/controllers/admin/AdminCustomersController.php @@ -860,6 +860,7 @@ class AdminCustomersControllerCore extends AdminController FROM '._DB_PREFIX_.'cart_product cp JOIN '._DB_PREFIX_.'cart c ON (c.id_cart = cp.id_cart) JOIN '._DB_PREFIX_.'product p ON (cp.id_product = p.id_product) + AND p.booking_product=1 WHERE c.id_customer = '.(int)$customer->id.' AND NOT EXISTS ( SELECT 1 From c6237cbc008152e2bb43b1895e9d212e7f852893 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Mon, 29 Apr 2024 10:28:03 +0530 Subject: [PATCH 02/16] Removed: Carrier column from the carts in the view of the AdminCustomerController --- .../template/controllers/customers/helpers/view/view.tpl | 2 -- 1 file changed, 2 deletions(-) diff --git a/admin/themes/default/template/controllers/customers/helpers/view/view.tpl b/admin/themes/default/template/controllers/customers/helpers/view/view.tpl index 88da2734e..83bc7d891 100644 --- a/admin/themes/default/template/controllers/customers/helpers/view/view.tpl +++ b/admin/themes/default/template/controllers/customers/helpers/view/view.tpl @@ -277,7 +277,6 @@ {l s='ID'} {l s='Date'} - {l s='Carrier'} {l s='Total'} @@ -290,7 +289,6 @@ {dateFormat date=$cart['date_upd'] full=0} - {$cart['name']} {$cart['total_price']} {/foreach} From 984c6c61f0054bfaebc99a360dad4bc397670637 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Tue, 30 Apr 2024 12:54:06 +0530 Subject: [PATCH 03/16] Changed the text for the amount received from the orders in the view in the AdminCustomerController --- .../template/controllers/customers/helpers/view/view.tpl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/admin/themes/default/template/controllers/customers/helpers/view/view.tpl b/admin/themes/default/template/controllers/customers/helpers/view/view.tpl index 83bc7d891..c37c35276 100644 --- a/admin/themes/default/template/controllers/customers/helpers/view/view.tpl +++ b/admin/themes/default/template/controllers/customers/helpers/view/view.tpl @@ -187,13 +187,15 @@ {assign var=count_ko value=count($orders_ko)}
-
+
{l s='Valid orders:'} {$count_ok} - {l s='for a total amount of %s' sprintf=$total_ok}
-
+
+ {l s=' Total amount recived: %s' sprintf=$total_ok} +
+
{l s='Invalid orders:'} {$count_ko} From a791b81296a1fbdb33b4e84a4cc286a99afec080 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Tue, 30 Apr 2024 13:05:45 +0530 Subject: [PATCH 04/16] Removed: Auto added service products from purchased products list in the view of AdminCustomerController --- classes/Customer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/Customer.php b/classes/Customer.php index a8c4c3609..616d93de7 100644 --- a/classes/Customer.php +++ b/classes/Customer.php @@ -717,7 +717,7 @@ class CustomerCore extends ObjectModel return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' SELECT * FROM `'._DB_PREFIX_.'orders` o LEFT JOIN `'._DB_PREFIX_.'order_detail` od ON o.id_order = od.id_order - WHERE o.valid = 1 AND o.`id_customer` = '.(int)$this->id); + WHERE od.`product_auto_add`= 0 AND o.valid = 1 AND o.`id_customer` = '.(int)$this->id); } public static function getDefaultGroupId($id_customer) From 9ac84143b121ecd459e864525772c8c3e525c36b Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Thu, 2 May 2024 10:20:20 +0530 Subject: [PATCH 05/16] Added nav tabs for the valid and invalid orders in the customer view page for the admin --- .../customers/helpers/view/view.tpl | 141 +++++++++++------- 1 file changed, 83 insertions(+), 58 deletions(-) diff --git a/admin/themes/default/template/controllers/customers/helpers/view/view.tpl b/admin/themes/default/template/controllers/customers/helpers/view/view.tpl index c37c35276..9553067df 100644 --- a/admin/themes/default/template/controllers/customers/helpers/view/view.tpl +++ b/admin/themes/default/template/controllers/customers/helpers/view/view.tpl @@ -203,65 +203,90 @@
- {if $count_ok} - - - - - - - - - - - - - - {foreach $orders_ok AS $key => $order} - - - - - - - - - - {/foreach} - -
{l s='ID'}{l s='Date'}{l s='Payment'}{l s='Status'}{l s='Products'}{l s='Total spent'}
{$order['id_order']}{dateFormat date=$order['date_add'] full=0}{$order['payment']}{$order['order_state']}{$order['nb_products']}{$order['total_paid_real']} - - {l s='View'} - -
+ {if $count_ok || $count_ko} + {/if} - {if $count_ko} - - - - - - - - - - - - - {foreach $orders_ko AS $key => $order} - - - - - - - - - {/foreach} - -
{l s='ID'}{l s='Date'}{l s='Payment'}{l s='Status'}{l s='Products'}{l s='Total spent'}
{$order['id_order']}{dateFormat date=$order['date_add'] full=0}{$order['payment']}{$order['order_state']}{$order['nb_products']}{$order['total_paid_real']}
- {/if} {else}

{l s='%1$s %2$s has not placed any orders yet' sprintf=[$customer->firstname, $customer->lastname]} @@ -305,7 +330,7 @@ {if $products AND count($products)}

- {l s='Purchased products'} {count($products)} + {l s='Room types and services'} {count($products)}
From d5bd7198cd0fd8b7322c255a0e4122a21aab8820 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Mon, 6 May 2024 09:34:53 +0530 Subject: [PATCH 06/16] Added amount paid from all orders in the total amount paid in the view of admin customer --- .../controllers/customer_threads/helpers/view/view.tpl | 8 ++++---- .../controllers/customers/helpers/view/view.tpl | 2 +- classes/order/Order.php | 3 ++- controllers/admin/AdminCustomerThreadsController.php | 8 +++++++- controllers/admin/AdminCustomersController.php | 10 ++++++++-- 5 files changed, 22 insertions(+), 9 deletions(-) diff --git a/admin/themes/default/template/controllers/customer_threads/helpers/view/view.tpl b/admin/themes/default/template/controllers/customer_threads/helpers/view/view.tpl index 31b65cf8a..2d4a2409f 100644 --- a/admin/themes/default/template/controllers/customer_threads/helpers/view/view.tpl +++ b/admin/themes/default/template/controllers/customer_threads/helpers/view/view.tpl @@ -33,7 +33,7 @@ {if isset($next_thread) && $next_thread} {$next_thread.name} - + {/if}
@@ -71,7 +71,7 @@

{if $count_ok} - {l s='[1]%1$d[/1] order(s) validated for a total amount of [2]%2$s[/2]' sprintf=[$count_ok, $total_ok] tags=['', '']} + {l s='[1]%1$d[/1] order(s) validated, total amount paid [2]%2$s[/2]' sprintf=[$count_ok, $total_ok] tags=['', '']} {else} {l s="No orders validated for the moment"} {/if} @@ -115,7 +115,7 @@
{l s="Choose a template"} - --> + --> @@ -159,7 +159,7 @@ }); timer = setInterval("markAsRead()", 3000); }); - + function markAsRead() { $.ajax({ diff --git a/admin/themes/default/template/controllers/customers/helpers/view/view.tpl b/admin/themes/default/template/controllers/customers/helpers/view/view.tpl index 9553067df..a83c3b67b 100644 --- a/admin/themes/default/template/controllers/customers/helpers/view/view.tpl +++ b/admin/themes/default/template/controllers/customers/helpers/view/view.tpl @@ -252,7 +252,7 @@ {/if} {if $count_ko} -

+
diff --git a/classes/order/Order.php b/classes/order/Order.php index a4e7a5e6b..cb692afe1 100644 --- a/classes/order/Order.php +++ b/classes/order/Order.php @@ -962,7 +962,8 @@ class OrderCore extends ObjectModel } $res = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' - SELECT o.*, (SELECT SUM(od.`product_quantity`) FROM `'._DB_PREFIX_.'order_detail` od WHERE od.`id_order` = o.`id_order`) nb_products + SELECT o.*, (SELECT SUM(od.`product_quantity`) FROM `'._DB_PREFIX_.'order_detail` od WHERE od.`id_order` = o.`id_order`) nb_products, + (SELECT MAX(hbd.`date_to`) FROM `'._DB_PREFIX_.'htl_booking_detail` hbd WHERE hbd.`id_order` = o.`id_order`) order_last_date FROM `'._DB_PREFIX_.'orders` o WHERE o.`id_customer` = '.(int)$id_customer. Shop::addSqlRestriction(Shop::SHARE_ORDER).' diff --git a/controllers/admin/AdminCustomerThreadsController.php b/controllers/admin/AdminCustomerThreadsController.php index c7a52fc5e..13a69f79c 100644 --- a/controllers/admin/AdminCustomerThreadsController.php +++ b/controllers/admin/AdminCustomerThreadsController.php @@ -656,10 +656,16 @@ class AdminCustomerThreadsControllerCore extends AdminController $total_ok = 0; $orders_ok = array(); foreach ($orders as $key => $order) { - if ($order['valid']) { + if ($order['valid'] + || strtotime($order['order_last_date']) >= strtotime(date('Y-m-d')) + ) { $orders_ok[] = $order; + } + + if ($order['total_paid_real']) { $total_ok += $order['total_paid_real']/$order['conversion_rate']; } + $orders[$key]['date_add'] = Tools::displayDate($order['date_add']); $orders[$key]['total_paid_real'] = Tools::displayPrice($order['total_paid_real'], new Currency((int)$order['id_currency'])); } diff --git a/controllers/admin/AdminCustomersController.php b/controllers/admin/AdminCustomersController.php index a70d9dc1a..4141325ea 100644 --- a/controllers/admin/AdminCustomersController.php +++ b/controllers/admin/AdminCustomersController.php @@ -829,9 +829,14 @@ class AdminCustomersControllerCore extends AdminController $order['order_state'] = $this->l('There is no status defined for this order.'); } - if ($order['valid']) { - $orders_ok[] = $order; + if ($order['total_paid_real_not_formated']) { $total_ok += $order['total_paid_real_not_formated']/$order['conversion_rate']; + } + + if ($order['valid'] + || strtotime($order['order_last_date']) >= strtotime(date('Y-m-d')) + ) { + $orders_ok[] = $order; } else { $orders_ko[] = $order; } @@ -862,6 +867,7 @@ class AdminCustomersControllerCore extends AdminController JOIN '._DB_PREFIX_.'product p ON (cp.id_product = p.id_product) AND p.booking_product=1 WHERE c.id_customer = '.(int)$customer->id.' + AND p.booking_product = 1 AND NOT EXISTS ( SELECT 1 FROM '._DB_PREFIX_.'orders o From 0d598aec901ad5899adf711e77e56e99ade1dbe4 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Mon, 6 May 2024 11:11:37 +0530 Subject: [PATCH 07/16] Added validation for the cutomer email while customer save/update process in the admin customer controller --- .../admin/AdminCustomersController.php | 30 ++++++++++++------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/controllers/admin/AdminCustomersController.php b/controllers/admin/AdminCustomersController.php index 4141325ea..587a915a7 100644 --- a/controllers/admin/AdminCustomersController.php +++ b/controllers/admin/AdminCustomersController.php @@ -1051,19 +1051,23 @@ class AdminCustomersControllerCore extends AdminController $customer = new Customer(); if (Validate::isEmail($customer_email)) { $customer->getByEmail($customer_email); - } - if ($customer->id) { - $this->errors[] = Tools::displayError('An account already exists for this email address:').' '.$customer_email; + if ($customer->id) { + $this->errors[] = Tools::displayError('An account already exists for this email address:').' '.$customer_email; + $this->display = 'edit'; + return $customer; + } elseif (trim(Tools::getValue('passwd')) == '') { + $this->validateRules(); + $this->errors[] = Tools::displayError('Password can not be empty.'); + $this->display = 'edit'; + } elseif ($customer = parent::processAdd()) { + $this->context->smarty->assign('new_customer', $customer); + return $customer; + } + } else { + $this->errors[] = Tools::displayError('Invalid email address.'); $this->display = 'edit'; - return $customer; - } elseif (trim(Tools::getValue('passwd')) == '') { - $this->validateRules(); - $this->errors[] = Tools::displayError('Password can not be empty.'); - $this->display = 'edit'; - } elseif ($customer = parent::processAdd()) { - $this->context->smarty->assign('new_customer', $customer); - return $customer; } + return false; } @@ -1077,7 +1081,11 @@ class AdminCustomersControllerCore extends AdminController $customer = new Customer(); if (Validate::isEmail($customer_email)) { $customer->getByEmail($customer_email); + } else { + $this->errors[] = Tools::displayError('Invalid email address.'); + $this->display = 'edit'; } + if (($customer->id) && ($customer->id != (int)$this->object->id)) { $this->errors[] = Tools::displayError('An account already exists for this email address:').' '.$customer_email; } From e247502178a51693569411c47d95f416a7129f93 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Thu, 16 May 2024 13:15:24 +0530 Subject: [PATCH 08/16] Added: Confirmation for the admin while trying to remove the voucher from the order --- .../template/controllers/orders/helpers/view/view.tpl | 2 +- js/admin/orders.js | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/admin/themes/default/template/controllers/orders/helpers/view/view.tpl b/admin/themes/default/template/controllers/orders/helpers/view/view.tpl index f28080e92..eefad939f 100644 --- a/admin/themes/default/template/controllers/orders/helpers/view/view.tpl +++ b/admin/themes/default/template/controllers/orders/helpers/view/view.tpl @@ -1065,7 +1065,7 @@ {if $can_edit} {/if} diff --git a/js/admin/orders.js b/js/admin/orders.js index 8a551b4fa..e83da072c 100644 --- a/js/admin/orders.js +++ b/js/admin/orders.js @@ -30,6 +30,12 @@ $(document).ready(function() { // Init all events init(); + $(document).on('click', '.delete-voucher', function(e) { + if (!confirm(txt_confirm)) { + e.preventDefault(); + } + }); + $('img.js-disabled-action').css({"opacity":0.5}); }); From c055ec50be4ebb6a0a202a09eb48c8e8ce4cf962 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Thu, 16 May 2024 13:31:23 +0530 Subject: [PATCH 09/16] Added: voucher deletion confirmation from the customer information on the customr page in the back office --- .../template/controllers/customers/helpers/view/view.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/themes/default/template/controllers/customers/helpers/view/view.tpl b/admin/themes/default/template/controllers/customers/helpers/view/view.tpl index a83c3b67b..5b9cc7bbf 100644 --- a/admin/themes/default/template/controllers/customers/helpers/view/view.tpl +++ b/admin/themes/default/template/controllers/customers/helpers/view/view.tpl @@ -467,7 +467,7 @@ - + From 87e40420052be92ad1235b0d1adc7088887b5ff3 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Wed, 29 May 2024 10:18:58 +0530 Subject: [PATCH 10/16] Revert changes on the valid and invalid orders count and amount --- controllers/admin/AdminCustomerThreadsController.php | 7 +------ controllers/admin/AdminCustomersController.php | 10 ++-------- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/controllers/admin/AdminCustomerThreadsController.php b/controllers/admin/AdminCustomerThreadsController.php index 13a69f79c..f485cf4f4 100644 --- a/controllers/admin/AdminCustomerThreadsController.php +++ b/controllers/admin/AdminCustomerThreadsController.php @@ -656,13 +656,8 @@ class AdminCustomerThreadsControllerCore extends AdminController $total_ok = 0; $orders_ok = array(); foreach ($orders as $key => $order) { - if ($order['valid'] - || strtotime($order['order_last_date']) >= strtotime(date('Y-m-d')) - ) { + if ($order['valid']) { $orders_ok[] = $order; - } - - if ($order['total_paid_real']) { $total_ok += $order['total_paid_real']/$order['conversion_rate']; } diff --git a/controllers/admin/AdminCustomersController.php b/controllers/admin/AdminCustomersController.php index 587a915a7..d88bbd8a6 100644 --- a/controllers/admin/AdminCustomersController.php +++ b/controllers/admin/AdminCustomersController.php @@ -829,14 +829,9 @@ class AdminCustomersControllerCore extends AdminController $order['order_state'] = $this->l('There is no status defined for this order.'); } - if ($order['total_paid_real_not_formated']) { - $total_ok += $order['total_paid_real_not_formated']/$order['conversion_rate']; - } - - if ($order['valid'] - || strtotime($order['order_last_date']) >= strtotime(date('Y-m-d')) - ) { + if ($order['valid']) { $orders_ok[] = $order; + $total_ok += $order['total_paid_real_not_formated']/$order['conversion_rate']; } else { $orders_ko[] = $order; } @@ -867,7 +862,6 @@ class AdminCustomersControllerCore extends AdminController JOIN '._DB_PREFIX_.'product p ON (cp.id_product = p.id_product) AND p.booking_product=1 WHERE c.id_customer = '.(int)$customer->id.' - AND p.booking_product = 1 AND NOT EXISTS ( SELECT 1 FROM '._DB_PREFIX_.'orders o From bef6ef679af4489f62d7d01d5125fa6537e5d5fd Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Wed, 12 Jun 2024 17:42:26 +0530 Subject: [PATCH 11/16] Revert the validations for the customer email in case the email is 0 --- .../admin/AdminCustomersController.php | 33 ++++++++----------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/controllers/admin/AdminCustomersController.php b/controllers/admin/AdminCustomersController.php index d88bbd8a6..2839328c3 100644 --- a/controllers/admin/AdminCustomersController.php +++ b/controllers/admin/AdminCustomersController.php @@ -1035,6 +1035,7 @@ class AdminCustomersControllerCore extends AdminController parent::processBulkDelete(); } + public function processAdd() { if (Tools::getValue('submitFormAjax')) { @@ -1045,23 +1046,19 @@ class AdminCustomersControllerCore extends AdminController $customer = new Customer(); if (Validate::isEmail($customer_email)) { $customer->getByEmail($customer_email); - if ($customer->id) { - $this->errors[] = Tools::displayError('An account already exists for this email address:').' '.$customer_email; - $this->display = 'edit'; - return $customer; - } elseif (trim(Tools::getValue('passwd')) == '') { - $this->validateRules(); - $this->errors[] = Tools::displayError('Password can not be empty.'); - $this->display = 'edit'; - } elseif ($customer = parent::processAdd()) { - $this->context->smarty->assign('new_customer', $customer); - return $customer; - } - } else { - $this->errors[] = Tools::displayError('Invalid email address.'); - $this->display = 'edit'; } - + if ($customer->id) { + $this->errors[] = Tools::displayError('An account already exists for this email address:').' '.$customer_email; + $this->display = 'edit'; + return $customer; + } elseif (trim(Tools::getValue('passwd')) == '') { + $this->validateRules(); + $this->errors[] = Tools::displayError('Password can not be empty.'); + $this->display = 'edit'; + } elseif ($customer = parent::processAdd()) { + $this->context->smarty->assign('new_customer', $customer); + return $customer; + } return false; } @@ -1075,11 +1072,7 @@ class AdminCustomersControllerCore extends AdminController $customer = new Customer(); if (Validate::isEmail($customer_email)) { $customer->getByEmail($customer_email); - } else { - $this->errors[] = Tools::displayError('Invalid email address.'); - $this->display = 'edit'; } - if (($customer->id) && ($customer->id != (int)$this->object->id)) { $this->errors[] = Tools::displayError('An account already exists for this email address:').' '.$customer_email; } From bd9568704d6e23fa6b395d9830d6ee0baa93a9de Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Wed, 12 Jun 2024 18:15:45 +0530 Subject: [PATCH 12/16] Udpated the customer spent amount in customer detail on the orders view page from total orders amount to the total amount paid --- .../default/template/controllers/orders/helpers/view/view.tpl | 2 +- classes/Customer.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/admin/themes/default/template/controllers/orders/helpers/view/view.tpl b/admin/themes/default/template/controllers/orders/helpers/view/view.tpl index eefad939f..5c0e49d17 100644 --- a/admin/themes/default/template/controllers/orders/helpers/view/view.tpl +++ b/admin/themes/default/template/controllers/orders/helpers/view/view.tpl @@ -573,7 +573,7 @@
  {$customer->date_add|date_format:"%d %b, %Y"} ({l s='Member since'})
  {$customerStats['nb_orders']|intval} ({l s='Total valid order placed'})
-
  {displayPrice price=Tools::ps_round(Tools::convertPrice($customerStats['total_orders'], $currency), 2) currency=$currency->id} ({l s='Total spent since registration'})
+
  {displayPrice price=Tools::ps_round(Tools::convertPrice($customerStats['total_spent'], $currency), 2) currency=$currency->id} ({l s='Total spent since registration'})
{if Configuration::get('PS_B2B_ENABLE')}
{$customer->siret} ({l s='Siret'})
{$customer->ape|date_format:"%d %b, %Y"} ({l s='APE'})
diff --git a/classes/Customer.php b/classes/Customer.php index 616d93de7..e2c263a87 100644 --- a/classes/Customer.php +++ b/classes/Customer.php @@ -570,7 +570,8 @@ class CustomerCore extends ObjectModel public function getStats() { $result = Db::getInstance()->getRow(' - SELECT COUNT(`id_order`) AS nb_orders, SUM(`total_paid` / o.`conversion_rate`) AS total_orders + SELECT COUNT(`id_order`) AS nb_orders, SUM(`total_paid` / o.`conversion_rate`) AS total_orders, + SUM(o.`total_paid_real` / o.`conversion_rate`) AS total_spent FROM `'._DB_PREFIX_.'orders` o WHERE o.`id_customer` = '.(int)$this->id.' AND o.valid = 1'); From 91ec85692e2b0377ac109fa848db0f144694127b Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Wed, 12 Jun 2024 18:41:33 +0530 Subject: [PATCH 13/16] Updated the design of the valid and invalid order --- .../customers/helpers/view/view.tpl | 200 +++++++++--------- 1 file changed, 105 insertions(+), 95 deletions(-) diff --git a/admin/themes/default/template/controllers/customers/helpers/view/view.tpl b/admin/themes/default/template/controllers/customers/helpers/view/view.tpl index 5b9cc7bbf..0d40dc84b 100644 --- a/admin/themes/default/template/controllers/customers/helpers/view/view.tpl +++ b/admin/themes/default/template/controllers/customers/helpers/view/view.tpl @@ -185,112 +185,122 @@ {if $orders AND count($orders)} {assign var=count_ok value=count($orders_ok)} {assign var=count_ko value=count($orders_ko)} -
-
-
- - {l s='Valid orders:'} - {$count_ok} -
-
- {l s=' Total amount recived: %s' sprintf=$total_ok} -
-
- - {l s='Invalid orders:'} - {$count_ko} -
-
-
- {if $count_ok || $count_ko}
{l s='ID'} - +
- - - - - - - - - - - - - {foreach $orders_ok AS $key => $order} - - - - - - - - - - {/foreach} - -
{l s='ID'}{l s='Date'}{l s='Payment'}{l s='Status'}{l s='Products'}{l s='Total spent'}
{$order['id_order']}{dateFormat date=$order['date_add'] full=0}{$order['payment']}{$order['order_state']}{$order['nb_products']}{$order['total_paid_real']} - - {l s='View'} - -
- {/if} - - {if $count_ko} - - - - - - - - - - - - - - {foreach $orders_ko AS $key => $order} - - - - - - - - - +
+
+
+ {l s='Total amount received: %s' sprintf=$total_ok} +
+
+
+ {if $count_ok} +
{l s='ID'}{l s='Date'}{l s='Payment'}{l s='Status'}{l s='Products'}{l s='Total spent'}
{$order['id_order']}{dateFormat date=$order['date_add'] full=0}{$order['payment']}{$order['order_state']}{$order['nb_products']}{$order['total_paid_real']} - - {l s='View'} - -
+ + + + + + + + + + + + + {foreach $orders_ok AS $key => $order} + + + + + + + + + {/foreach} - -
{l s='ID'}{l s='Date'}{l s='Payment'}{l s='Status'}{l s='Products'}{l s='Total spent'}
{$order['id_order']}{dateFormat date=$order['date_add'] full=0}{$order['payment']}{$order['order_state']}{$order['nb_products']}{$order['total_paid_real']} + + {l s='View'} + +
- {/if} + + + {else} +

+ {l s='No valid order found!!'} +

+ {/if} +
+ +
+
+
+ {l s='Order total: %s' sprintf=$total_ko} +
+
+
+ {if $count_ko} + + + + + + + + + + + + + + {foreach $orders_ko AS $key => $order} + + + + + + + + + + {/foreach} + +
{l s='ID'}{l s='Date'}{l s='Payment'}{l s='Status'}{l s='Products'}{l s='Total spent'}
{$order['id_order']}{dateFormat date=$order['date_add'] full=0}{$order['payment']}{$order['order_state']}{$order['nb_products']}{$order['total_paid_real']} + + {l s='View'} + +
+ {else} +

+ {l s='No invalid order found!!'} +

+ {/if} +
{/if} {else} -

- {l s='%1$s %2$s has not placed any orders yet' sprintf=[$customer->firstname, $customer->lastname]} -

+

+ {l s='%1$s %2$s has not placed any orders yet' sprintf=[$customer->firstname, $customer->lastname]} +

{/if}
From 523bea4a30ca0e51d9fb0947954880502e016e73 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Wed, 12 Jun 2024 18:47:29 +0530 Subject: [PATCH 14/16] added the missing variables --- controllers/admin/AdminCustomersController.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/controllers/admin/AdminCustomersController.php b/controllers/admin/AdminCustomersController.php index 2839328c3..8446f1184 100644 --- a/controllers/admin/AdminCustomersController.php +++ b/controllers/admin/AdminCustomersController.php @@ -822,6 +822,7 @@ class AdminCustomersControllerCore extends AdminController } $total_ok = 0; + $total_ko = 0; $orders_ok = array(); $orders_ko = array(); foreach ($orders as $order) { @@ -834,6 +835,7 @@ class AdminCustomersControllerCore extends AdminController $total_ok += $order['total_paid_real_not_formated']/$order['conversion_rate']; } else { $orders_ko[] = $order; + $total_ko += $order['total_paid'] / $order['conversion_rate']; } } @@ -933,6 +935,7 @@ class AdminCustomersControllerCore extends AdminController 'orders_ok' => $orders_ok, 'orders_ko' => $orders_ko, 'total_ok' => Tools::displayPrice($total_ok, $this->context->currency->id), + 'total_ko' => Tools::displayPrice($total_ko, $this->context->currency->id), // Products 'products' => $products, // Addresses From 74ff5f7d36eb8498af635d533173287458509b9f Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Mon, 24 Jun 2024 16:54:13 +0530 Subject: [PATCH 15/16] Updated the code for the tabs of valid and invalid orders in the admin customer view page --- .../template/controllers/customers/helpers/view/view.tpl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/admin/themes/default/template/controllers/customers/helpers/view/view.tpl b/admin/themes/default/template/controllers/customers/helpers/view/view.tpl index 0d40dc84b..8d6496f3f 100644 --- a/admin/themes/default/template/controllers/customers/helpers/view/view.tpl +++ b/admin/themes/default/template/controllers/customers/helpers/view/view.tpl @@ -188,15 +188,15 @@ {if $count_ok || $count_ko}