From 878c657e41183f0f6c2f94eb5232b5adb8143f6e Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Mon, 29 Jul 2024 16:34:51 +0530 Subject: [PATCH] updated the design for the room types and services on the customer view page for the admin --- .../customers/helpers/view/view.tpl | 114 ++++++++++++++---- classes/order/Order.php | 3 +- .../admin/AdminCustomerThreadsController.php | 1 - .../admin/AdminCustomersController.php | 15 ++- 4 files changed, 102 insertions(+), 31 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 385060654..8aab78130 100644 --- a/admin/themes/default/template/controllers/customers/helpers/view/view.tpl +++ b/admin/themes/default/template/controllers/customers/helpers/view/view.tpl @@ -350,33 +350,95 @@ {/if} {if $products AND count($products)} -
-
- {l s='Room types and services'} {count($products)} +
+
+ {l s='Room types and services'} {count($products)} +
+
- - - - - - - - - - {foreach $products AS $key => $product} - - - - - - {/foreach} - -
{l s='Date'}{l s='Name'}{l s='Quantity'}
{dateFormat date=$product['date_add'] full=0} - - {$product['product_name']} - - {$product['product_quantity']}
-
{/if} {if count($interested)}
diff --git a/classes/order/Order.php b/classes/order/Order.php index 798600bd1..a7d083ff6 100644 --- a/classes/order/Order.php +++ b/classes/order/Order.php @@ -963,8 +963,7 @@ 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 MAX(hbd.`date_to`) FROM `'._DB_PREFIX_.'htl_booking_detail` hbd WHERE hbd.`id_order` = o.`id_order`) order_last_date + SELECT o.*, (SELECT SUM(od.`product_quantity`) FROM `'._DB_PREFIX_.'order_detail` od WHERE od.`id_order` = o.`id_order`) nb_products 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 f485cf4f4..c7a52fc5e 100644 --- a/controllers/admin/AdminCustomerThreadsController.php +++ b/controllers/admin/AdminCustomerThreadsController.php @@ -660,7 +660,6 @@ class AdminCustomerThreadsControllerCore extends AdminController $orders_ok[] = $order; $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 d668f9854..b307b9073 100644 --- a/controllers/admin/AdminCustomersController.php +++ b/controllers/admin/AdminCustomersController.php @@ -854,7 +854,17 @@ class AdminCustomersControllerCore extends AdminController } } - $products = $customer->getBoughtProducts(); + $purchasedServices = array(); + $purchasedRoomTypes = array(); + if ($products = $customer->getBoughtProducts()) { + foreach ($products as $product) { + if ($product['is_booking_product']) { + $purchasedRoomTypes[] = $product; + } else { + $purchasedServices[] = $product; + } + } + } $carts = Cart::getCustomerCarts($customer->id); $total_carts = count($carts); @@ -953,6 +963,8 @@ class AdminCustomersControllerCore extends AdminController 'total_ko' => Tools::displayPrice($total_ko, $this->context->currency->id), // Products 'products' => $products, + 'purchasedRoomTypes' => $purchasedRoomTypes, + 'purchasedServices' => $purchasedServices, // Addresses 'addresses' => $customer->getAddresses($this->default_form_language), // Discounts @@ -1053,7 +1065,6 @@ class AdminCustomersControllerCore extends AdminController parent::processBulkDelete(); } - public function processAdd() { if (Tools::getValue('submitFormAjax')) {