From 75a151673d9f28303786dfb58e61d80dc64bc0b0 Mon Sep 17 00:00:00 2001 From: Shreesh Arora Date: Thu, 6 Apr 2023 10:25:36 +0530 Subject: [PATCH 1/2] remove go to payment page option for backdate order --- .../default/template/controllers/orders/form.tpl | 7 ++++++- controllers/admin/AdminCartsController.php | 10 ++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/admin/themes/default/template/controllers/orders/form.tpl b/admin/themes/default/template/controllers/orders/form.tpl index 6bac2c7e5..99b5ab612 100644 --- a/admin/themes/default/template/controllers/orders/form.tpl +++ b/admin/themes/default/template/controllers/orders/form.tpl @@ -1179,7 +1179,12 @@ $('#id_lang option').removeAttr('selected'); $('#id_lang option[value="'+id_lang+'"]').attr('selected', true); $('#send_email_to_customer').attr('rel', jsonSummary.link_order); - $('#go_order_process').attr('href', jsonSummary.link_order); + if (!jsonSummary.is_backdate_order) { + $('#go_order_process').show(); + $('#go_order_process').attr('href', jsonSummary.link_order); + } else { + $('#go_order_process').hide(); + } $('#order_message').val(jsonSummary.order_message); resetBind(); } diff --git a/controllers/admin/AdminCartsController.php b/controllers/admin/AdminCartsController.php index 087e3ca95..926093c40 100644 --- a/controllers/admin/AdminCartsController.php +++ b/controllers/admin/AdminCartsController.php @@ -844,6 +844,14 @@ class AdminCartsControllerCore extends AdminController } } + $cart_detail_data_obj = new HotelCartBookingData(); + $cart_detail_data = $cart_detail_data_obj->getCartFormatedBookinInfoByIdCart((int) $id_cart); + $is_backdate_order = false; + foreach ($cart_detail_data as $cartRoom) { + if (strtotime($cartRoom['date_from']) < strtotime(date('Y-m-d'))) { + $is_backdate_order = true; + } + } $addresses = $this->context->customer->getAddresses((int)$this->context->cart->id_lang); foreach ($addresses as &$data) { @@ -853,6 +861,8 @@ class AdminCartsControllerCore extends AdminController return array( 'summary' => $this->getCartSummary(), + 'cart_detail_data' => $cart_detail_data, + 'is_backdate_order' => $is_backdate_order, 'delivery_option_list' => $this->getDeliveryOptionList(), 'cart' => $this->context->cart, 'currency' => new Currency($this->context->cart->id_currency), From 4e2db505bbe728c904f71d6284cf5213461d2023 Mon Sep 17 00:00:00 2001 From: Shreesh Arora Date: Mon, 10 Apr 2023 18:27:04 +0530 Subject: [PATCH 2/2] update current date variable --- controllers/admin/AdminCartsController.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/controllers/admin/AdminCartsController.php b/controllers/admin/AdminCartsController.php index 926093c40..95da147ce 100644 --- a/controllers/admin/AdminCartsController.php +++ b/controllers/admin/AdminCartsController.php @@ -847,8 +847,9 @@ class AdminCartsControllerCore extends AdminController $cart_detail_data_obj = new HotelCartBookingData(); $cart_detail_data = $cart_detail_data_obj->getCartFormatedBookinInfoByIdCart((int) $id_cart); $is_backdate_order = false; + $currentDate = strtotime(date('Y-m-d')); foreach ($cart_detail_data as $cartRoom) { - if (strtotime($cartRoom['date_from']) < strtotime(date('Y-m-d'))) { + if (strtotime($cartRoom['date_from']) < $currentDate) { $is_backdate_order = true; } }