From bfccc2d78bd06e6b9db52b3d3ab5d96a698d2622 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Sat, 26 Nov 2022 15:39:20 +0530 Subject: [PATCH] Fix currency issue during order creation at back office --- .../orders/_current_cart_details_data.tpl | 115 ------------------ .../template/controllers/orders/form.tpl | 115 ++++++++++++++++++ controllers/admin/AdminCartsController.php | 4 +- controllers/admin/AdminOrdersController.php | 4 + 4 files changed, 121 insertions(+), 117 deletions(-) diff --git a/admin/themes/default/template/controllers/orders/_current_cart_details_data.tpl b/admin/themes/default/template/controllers/orders/_current_cart_details_data.tpl index 93727824a..e2e82c917 100644 --- a/admin/themes/default/template/controllers/orders/_current_cart_details_data.tpl +++ b/admin/themes/default/template/controllers/orders/_current_cart_details_data.tpl @@ -161,118 +161,3 @@ #rooms_extra_demands .room_demand_detail { padding: 15px 15px 0px 15px;} - -{* JS for handling extra demands changes *} - \ No newline at end of file diff --git a/admin/themes/default/template/controllers/orders/form.tpl b/admin/themes/default/template/controllers/orders/form.tpl index 1d80ec936..71c134c46 100644 --- a/admin/themes/default/template/controllers/orders/form.tpl +++ b/admin/themes/default/template/controllers/orders/form.tpl @@ -1691,3 +1691,118 @@
+ +{* JS for handling extra demands changes *} + diff --git a/controllers/admin/AdminCartsController.php b/controllers/admin/AdminCartsController.php index 8b317aa32..25d6d2298 100644 --- a/controllers/admin/AdminCartsController.php +++ b/controllers/admin/AdminCartsController.php @@ -570,12 +570,12 @@ class AdminCartsControllerCore extends AdminController 'cart_detail_data' => $cart_detail_data, )); - $tpl_path = 'default/template/controllers/orders/current_cart_details_data.tpl'; + $tpl_path = 'default/template/controllers/orders/_current_cart_details_data.tpl'; $cart_dtl_tpl = $this->context->smarty->fetch(_PS_BO_ALL_THEMES_DIR_.$tpl_path); $result = $this->ajaxReturnVars(); $result['cart_detail_html'] = $cart_dtl_tpl;//tpl is added to the returned array - echo json_encode($result); + $this->ajaxDie(json_encode($result)); } } public function ajaxProcessUpdateLang() diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index a7e150ecc..947d7f148 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -215,6 +215,7 @@ class AdminOrdersControllerCore extends AdminController $cart_order_exists = $cart->orderExists(); if (!$cart_order_exists) { $this->context->cart = $cart; + $this->context->currency = new Currency((int)$cart->id_currency); $cart_detail_data = array(); $cart_detail_data_obj = new HotelCartBookingData(); if ($cart_detail_data = $cart_detail_data_obj->getCartFormatedBookinInfoByIdCart((int) $id_cart)) { @@ -3291,6 +3292,9 @@ class AdminOrdersControllerCore extends AdminController && ($idRoom = Tools::getValue('id_room')) && ($idCart = Tools::getValue('id_cart')) ) { + $objCart = new Cart($idCart); + $this->context->currency = new Currency($objCart->id_currency); + $objCartBookingData = new HotelCartBookingData(); if ($selectedRoomDemands = $objCartBookingData->getCartExtraDemands( $idCart,