From cb60f1084b35797fd38ca956d87b1ad886047f1f Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Thu, 30 Jan 2025 12:46:01 +0530 Subject: [PATCH 01/29] Added: New service product addition while booking edit from order detail page in Back-office --- .../controllers/orders/helpers/view/view.tpl | 1 + ..._services_service_products_tab_content.tpl | 89 +++- controllers/admin/AdminOrdersController.php | 411 ++++++++++++++++-- js/admin/orders.js | 101 ++++- 4 files changed, 549 insertions(+), 53 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 2f5c37c16..8fd68778a 100644 --- a/admin/themes/default/template/controllers/orders/helpers/view/view.tpl +++ b/admin/themes/default/template/controllers/orders/helpers/view/view.tpl @@ -1270,5 +1270,6 @@ {addJsDefL name=txt_booking_document_upload_success}{l s='Document uploaded successfully.' js=1}{/addJsDefL} {addJsDefL name=txt_booking_document_delete_confirm}{l s='Are you sure?' js=1}{/addJsDefL} {addJsDefL name=txt_booking_document_delete_success}{l s='Document deleted successfully.' js=1}{/addJsDefL} + {addJsDefL name='error_found_txt'}{l s='Errors found' js=1}{/addJsDefL} {/strip} {/block} diff --git a/admin/themes/default/template/controllers/orders/modals/_extra_services_service_products_tab_content.tpl b/admin/themes/default/template/controllers/orders/modals/_extra_services_service_products_tab_content.tpl index ffeba9c2c..55cf67041 100644 --- a/admin/themes/default/template/controllers/orders/modals/_extra_services_service_products_tab_content.tpl +++ b/admin/themes/default/template/controllers/orders/modals/_extra_services_service_products_tab_content.tpl @@ -20,10 +20,13 @@
{if isset($orderEdit) && $orderEdit} -

- +

+ + -

+
+
+ {* Already selected room services *}
@@ -93,9 +96,9 @@
-
+
- {if isset($roomTypeServiceProducts) && $roomTypeServiceProducts} + {if isset($serviceProducts) && $serviceProducts} @@ -107,7 +110,7 @@ - {foreach $roomTypeServiceProducts as $product} + {foreach $serviceProducts as $product} + {foreach $serviceProducts as $product} + + + + + + + + {/foreach} + +
@@ -156,6 +159,80 @@ +
+
+
+ + +
+
+ +
+ {$currencySign} + +
+
+
+
+
+ + +
+
+ +
+ + + + + + + +
+
+
+
+
+ + +
+ +
+ + +
+
+ {if $roomTypeTaxRuleGroupExist} +
+
+ {l s='Note: If auto added service is enabled, then tax of the booking\'s room type will be applicable.'} +
+
+ {/if} + + + +
+ {elseif isset($additionalServices) && $additionalServices} diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index 6dfcdaced..44e20dc6e 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -948,23 +948,36 @@ class AdminOrdersControllerCore extends AdminController $smartyVars['additionalServices'] = $additionalServices; } - // get room type additional demands - $objRoomTypeServiceProduct = new RoomTypeServiceProduct(); - if ($roomTypeServiceProducts = $objRoomTypeServiceProduct->getServiceProductsData($idProduct, 1, 0, false, 2, null)) { - if ($additionalServices) { - foreach ($roomTypeServiceProducts as $key => $product) { - if (in_array($product['id_product'], array_column($additionalServices['additional_services'], 'id_product'))) { - unset($roomTypeServiceProducts[$key]); - } + // get all services + $objProduct = new Product(); + if ($serviceProducts = $objProduct->getServiceProducts()) { + foreach ($serviceProducts as $key => $servProduct) { + $serviceProducts[$key]['price_tax_exc'] = $servProduct['price']; + if ($additionalServices + && (in_array($servProduct['id_product'], array_column($additionalServices['additional_services'], 'id_product'))) + ) { + unset($serviceProducts[$key]); } } - $smartyVars['roomTypeServiceProducts'] = $roomTypeServiceProducts; + + $smartyVars['serviceProducts'] = $serviceProducts; } $objOrderReturn = new OrderReturn(); $refundReqBookings = $objOrderReturn->getOrderRefundRequestedBookings($objOrder->id, 0, 1); $smartyVars['refundReqBookings'] = $refundReqBookings; + // check if booking room type tax rule is still exist + $objHotelBookingDetail = new HotelBookingDetail($idHtlBookingDetail); + $objOrderDetail = new OrderDetail($objHotelBookingDetail->id_order_detail); + if (Validate::isLoadedObject($objTaxRuleGroup = new TaxRulesGroup($objOrderDetail->id_tax_rules_group))) { + $smartyVars['roomTypeTaxRuleGroupExist'] = 1; + } else { + $smartyVars['roomTypeTaxRuleGroupExist'] = 0; + } + $taxRulesGroups = TaxRulesGroup::getTaxRulesGroups(true); + $smartyVars['taxRulesGroups'] = $taxRulesGroups; + $this->context->smarty->assign($smartyVars); $modal = array( @@ -6270,22 +6283,39 @@ class AdminOrdersControllerCore extends AdminController $smartyVars['orderEdit'] = $orderEdit; // get room type additional demands - $objRoomTypeServiceProduct = new RoomTypeServiceProduct(); - if ($roomTypeServiceProducts = $objRoomTypeServiceProduct->getServiceProductsData($idProduct, 1, 0, false, 2, null)) { - foreach ($roomTypeServiceProducts as $key => $product) { - if (in_array($product['id_product'], array_column($additionalServices['additional_services'], 'id_product'))) { - unset($roomTypeServiceProducts[$key]); + $objProduct = new Product(); + if ($serviceProducts = $objProduct->getServiceProducts()) { + foreach ($serviceProducts as $key => $servProduct) { + $serviceProducts[$key]['price_tax_exc'] = $servProduct['price']; + if ($additionalServices + && (in_array($servProduct['id_product'], array_column($additionalServices['additional_services'], 'id_product'))) + ) { + unset($serviceProducts[$key]); } } - $smartyVars['roomTypeServiceProducts'] = $roomTypeServiceProducts; + $smartyVars['serviceProducts'] = $serviceProducts; } + + // check if booking room type tax rule is still exist + $objHotelBookingDetail = new HotelBookingDetail($idHtlBookingDetail); + $objOrderDetail = new OrderDetail($objHotelBookingDetail->id_order_detail); + if (Validate::isLoadedObject($objTaxRuleGroup = new TaxRulesGroup($objOrderDetail->id_tax_rules_group))) { + $smartyVars['roomTypeTaxRuleGroupExist'] = 1; + } else { + $smartyVars['roomTypeTaxRuleGroupExist'] = 0; + } + + $taxRulesGroups = TaxRulesGroup::getTaxRulesGroups(true); + $smartyVars['taxRulesGroups'] = $taxRulesGroups; } + $smartyVars['show_active'] = true; $this->context->smarty->assign($smartyVars); $servicesTpl = $this->context->smarty->fetch( _PS_ADMIN_DIR_.'/themes/default/template/controllers/orders/modals/_extra_services_service_products_tab_content.tpl' ); + return $servicesTpl; } @@ -6561,7 +6591,7 @@ class AdminOrdersControllerCore extends AdminController die(json_encode($response)); } - public function ajaxProcessAddRoomAdditionalServices() + public function ajaxProcessAddExistingRoomServices() { $response = array('hasError' => false); // Check tab access is allowed to edit @@ -6581,30 +6611,25 @@ class AdminOrdersControllerCore extends AdminController $qty = Tools::getValue('service_qty'); $price = Tools::getValue('service_price'); foreach ($selectedServices as $key => $service) { - if ($objRoomTypeServiceProduct->isRoomTypeLinkedWithProduct($objHotelBookingDetail->id_product, $service)) { - $objProduct = new Product($service, false, $this->context->language->id); - if ($objProduct->allow_multiple_quantity) { - if (!Validate::isUnsignedInt($qty[$service])) { - $response['hasError'] = true; - $response['errors'][] = sprintf($this->l('The quantity you\'ve entered is invalid for %s.'), $objProduct->name); - } - } else { - $qty[$service] = 1; - } - if (!ValidateCore::isPrice($price[$service])) { + $objProduct = new Product($service, false, $this->context->language->id); + if ($objProduct->allow_multiple_quantity) { + if (!Validate::isUnsignedInt($qty[$service])) { $response['hasError'] = true; - $response['errors'][] = sprintf($this->l('Invalid unit price for %s.'), $objProduct->name); + $response['errors'][] = sprintf($this->l('The quantity you\'ve entered is invalid for %s.'), $objProduct->name); } - $selectedServices[$key] = array( - 'id' => $service, - 'qty' => $qty[$service], - 'price' => $price[$service], - 'name' => $objProduct->name, - ); } else { - $response['hasError'] = true; - $response['errors'][] = sprintf($this->l('The service %s is not avaialable for current room.'), $objProduct->name); + $qty[$service] = 1; } + if (!ValidateCore::isPrice($price[$service])) { + $response['hasError'] = true; + $response['errors'][] = sprintf($this->l('Invalid unit price for %s.'), $objProduct->name); + } + $selectedServices[$key] = array( + 'id' => $service, + 'qty' => $qty[$service], + 'price' => $price[$service], + 'name' => $objProduct->name, + ); } $objHotelCartBookingData = new HotelCartBookingData(); @@ -6802,6 +6827,320 @@ class AdminOrdersControllerCore extends AdminController die(json_encode($response)); } + // Add new custom services to room + public function ajaxProcessAddNewRoomServices() + { + $response = array('hasError' => false); + // Check tab access is allowed to edit + if ($this->tabAccess['edit'] == 1) { + $idBookingDetail = Tools::getValue('id_booking_detail'); + // valiadate services being added + if (Validate::isLoadedObject($objHotelBookingDetail = new HotelBookingDetail($idBookingDetail))) { + $objHotelCartBookingData = new HotelCartBookingData(); + if ($roomHtlCartInfo = $objHotelCartBookingData->getRoomRowByIdProductIdRoomInDateRange( + $objHotelBookingDetail->id_cart, + $objHotelBookingDetail->id_product, + $objHotelBookingDetail->date_from, + $objHotelBookingDetail->date_to, + $objHotelBookingDetail->id_room + )) { + $name = Tools::getValue('new_service_name'); + $price = Tools::getValue('new_service_price'); + $priceCalcMethod = Tools::getValue('new_service_price_calc_method'); + $priceAdditionType = Tools::getValue('new_service_price_addition_type'); + $productQty = Tools::getValue('new_service_qty'); + $idTaxRuleGroup = Tools::getValue('new_service_price_tax_rule_group'); + $autoAdded = Tools::getValue('new_service_auto_added'); + + // adjust values for auto added services + if ($autoAdded) { + $productQty = 1; + // check if booking room type tax rule is still exist + $objOrderDetail = new OrderDetail($objHotelBookingDetail->id_order_detail); + if (Validate::isLoadedObject($objTaxRuleGroup = new TaxRulesGroup($objOrderDetail->id_tax_rules_group))) { + $idTaxRuleGroup = $objOrderDetail->id_tax_rules_group; + } + } else { + $priceAdditionType = 0; + if (empty($productQty)) { + $response['hasError'] = true; + $response['errors'][] = $this->l('Service quantity is required'); + } elseif (!Validate::isUnsignedInt($productQty)) { + $response['hasError'] = true; + $response['errors'][] = $this->l('Invalid service quantity'); + } + } + + // Validate service data provided + if (empty($name)) { + $response['hasError'] = true; + $response['errors'][] = $this->l('Service name is required'); + } elseif (!Validate::isCatalogName($name)) { + $response['hasError'] = true; + $response['errors'][] = $this->l('Invalid service name'); + } + + if (empty($price)) { + $response['hasError'] = true; + $response['errors'][] = $this->l('Service price is required'); + } elseif (!Validate::isPrice($price)) { + $response['hasError'] = true; + $response['errors'][] = $this->l('Invalid service price'); + } + + // if no validation errors then add service + if (!$response['hasError']) { + // ======= START: Create Service product ========= + $objServiceProduct = new Product(); + $objServiceProduct->price_calculation_method = $priceCalcMethod; + $objServiceProduct->service_product_type = Product::SERVICE_PRODUCT_WITH_ROOMTYPE; + $objServiceProduct->id_category_default = Configuration::get('PS_SERVICE_CATEGORY'); + $objServiceProduct->name[Configuration::get('PS_LANG_DEFAULT')] = $name; + $objServiceProduct->id_shop_default = Configuration::get('PS_SHOP_DEFAULT'); + $objServiceProduct->allow_multiple_quantity = !$autoAdded; + $objServiceProduct->id_tax_rules_group = $idTaxRuleGroup; + $objServiceProduct->price = $price; + $objServiceProduct->wholesale_price = 0; + $languages = Language::getLanguages(false); + foreach ($languages as $lang) { + $objServiceProduct->link_rewrite[$lang['id_lang']] = Tools::link_rewrite($name); + } + $objServiceProduct->available_for_order = true; + $objServiceProduct->show_price = true; + $objServiceProduct->is_virtual = true; + $objServiceProduct->auto_add_to_cart = $autoAdded; + $objServiceProduct->price_addition_type = $priceAdditionType; + $objServiceProduct->booking_product = false; + $objServiceProduct->show_at_front = false; + $objServiceProduct->indexed = false; + $objServiceProduct->minimal_quantity = 1; + $objServiceProduct->active = true; + + // ======= Create Service product END ========= + if ($objServiceProduct->save()) { + // If service product is create successfully the start adding the product in cart and order + $objServiceProduct = new Product($objServiceProduct->id, false, $objOrder->id_lang); + $objOrder = new Order($objHotelBookingDetail->id_order); + + // Create new cart + $objCart = new Cart(); + $objCart->id_shop_group = $objOrder->id_shop_group; + $objCart->id_shop = $objOrder->id_shop; + $objCart->id_customer = $objOrder->id_customer; + $objCart->id_carrier = $objOrder->id_carrier; + $objCart->id_address_delivery = $objOrder->id_address_delivery; + $objCart->id_address_invoice = $objOrder->id_address_invoice; + $objCart->id_currency = $objOrder->id_currency; + $objCart->id_lang = $objOrder->id_lang; + $objCart->secure_key = $objOrder->secure_key; + if ($objCart->add()) { + $this->context->cart = $objCart; + $this->context->customer = new Customer($objOrder->id_customer); + // set context currency So that we can get prices in the order currency + $this->context->currency = new Currency($objOrder->id_currency); + + $objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail(); + if ($objRoomTypeServiceProductCartDetail->addServiceProductInCart( + $objServiceProduct->id, + $productQty, + $objCart->id, + $roomHtlCartInfo['id'] + )) { + if ($productList = $objCart->getProducts()) { + $totalPriceChangeTaxExcl = 0; + $totalPriceChangeTaxIncl = 0; + $unitPriceTaxIncl = 0; + $unitPriceTaxExcl = 0; + + $objRoomTypeServiceProductPrice = new RoomTypeServiceProductPrice(); + $cartProductProcessed = 1; + $numDays = 1; + if (Product::getProductPriceCalculation($objServiceProduct->id) == Product::PRICE_CALCULATION_METHOD_PER_DAY) { + $numDays = HotelHelper::getNumberOfDays($objHotelBookingDetail->date_from, $objHotelBookingDetail->date_to); + } + foreach ($productList as &$product) { + // This is used to get the actual quanity of the service as it is calculated incorrectly if the service is per night + if ($idRoomTypeServProductCart = $objRoomTypeServiceProductCartDetail->alreadyExists( + $product['id_product'], + $objCart->id, + $roomHtlCartInfo['id']) + ) { + // Lets create a specific price for the service to match the price provided by the user + $objSpecificPrice = new SpecificPrice(); + $objSpecificPrice->id_shop = 0; + $objSpecificPrice->id_shop_group = 0; + $objSpecificPrice->id_cart = $objCart->id; + $objSpecificPrice->id_currency = $objOrder->id_currency; + $objSpecificPrice->id_country = 0; + $objSpecificPrice->id_group = 0; + $objSpecificPrice->id_customer = $objOrder->id_customer; + $objSpecificPrice->id_product = $objServiceProduct->id; + $objSpecificPrice->id_product_attribute = 0; + $objSpecificPrice->price = $price; + $objSpecificPrice->from_quantity = 1; + $objSpecificPrice->reduction = 0; + $objSpecificPrice->reduction_type = 'amount'; + $objSpecificPrice->reduction_tax = 0; + $objSpecificPrice->from = '0000-00-00 00:00:00'; + $objSpecificPrice->to = '0000-00-00 00:00:00'; + if ($objSpecificPrice->add()) { + if (Validate::isLoadedObject($objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail((int) $idRoomTypeServProductCart))) { + $unitPriceTaxExcl = $objRoomTypeServiceProductPrice->getServicePrice( + (int)$product['id_product'], + 0, + 1, + $objHotelBookingDetail->date_from, + $objHotelBookingDetail->date_to, + false, + $objCart->id + ) / $numDays; + + $unitPriceTaxIncl = $objRoomTypeServiceProductPrice->getServicePrice( + (int)$product['id_product'], + 0, + 1, + $objHotelBookingDetail->date_from, + $objHotelBookingDetail->date_to, + true, + $objCart->id + ) / $numDays; + + $totalPriceChangeTaxExcl += $totalPriceTaxExcl = Tools::processPriceRounding( + ($unitPriceTaxExcl * $numDays), + $objRoomTypeServiceProductCartDetail->quantity, + $objOrder->round_type, + $objOrder->round_mode + ); + $totalPriceChangeTaxIncl += $totalPriceTaxIncl = Tools::processPriceRounding( + ($unitPriceTaxIncl * $numDays), + $objRoomTypeServiceProductCartDetail->quantity, + $objOrder->round_type, + $objOrder->round_mode + ); + + $product['total'] = $totalPriceTaxExcl; + $product['total_wt'] = $totalPriceTaxIncl; + + $cartProductProcessed = 1; + } else { + $cartProductProcessed = 0; + break; + } + } else { + $cartProductProcessed = 0; + break; + } + } else { + $cartProductProcessed = 0; + break; + } + } + + // If all cart products processed then only we will proceed further + if ($cartProductProcessed) { + $objOrderInvoice = new OrderInvoice($objOrderDetail->id_order_invoice); + + // add in order detail table + $orderDetail = new OrderDetail(); + $orderDetail->createList($objOrder, $objCart, $objOrder->getCurrentOrderState(), $productList, (isset($objOrderInvoice) ? $objOrderInvoice->id : 0), true); + + // Add in room type service product order detail + $objRoomTypeServiceProductOrderDetail = new RoomTypeServiceProductOrderDetail(); + $objRoomTypeServiceProductOrderDetail->id_product = $objServiceProduct->id; + $objRoomTypeServiceProductOrderDetail->id_order = $objHotelBookingDetail->id_order; + $objRoomTypeServiceProductOrderDetail->id_order_detail = $orderDetail->id; + $objRoomTypeServiceProductOrderDetail->id_cart = $objCart->id; + $objRoomTypeServiceProductOrderDetail->id_htl_booking_detail = $objHotelBookingDetail->id; + $objRoomTypeServiceProductOrderDetail->unit_price_tax_excl = $unitPriceTaxExcl; + $objRoomTypeServiceProductOrderDetail->unit_price_tax_incl = $unitPriceTaxIncl; + $objRoomTypeServiceProductOrderDetail->total_price_tax_excl = $totalPriceTaxExcl; + $objRoomTypeServiceProductOrderDetail->total_price_tax_incl = $totalPriceTaxIncl; + $objRoomTypeServiceProductOrderDetail->name = $name; + $objRoomTypeServiceProductOrderDetail->quantity = $productQty; + $objRoomTypeServiceProductOrderDetail->auto_added = $autoAdded; + $objRoomTypeServiceProductOrderDetail->save(); + + // update totals amount of order + $objOrder->total_products = Tools::ps_round((float)($objOrder->total_products + $totalPriceChangeTaxExcl), _PS_PRICE_COMPUTE_PRECISION_); + $objOrder->total_products_wt = Tools::ps_round((float)($objOrder->total_products_wt + $totalPriceChangeTaxIncl), _PS_PRICE_COMPUTE_PRECISION_); + + $objOrder->total_paid = Tools::ps_round($objOrder->getOrderTotal(), _PS_PRICE_COMPUTE_PRECISION_); + $objOrder->total_paid_tax_incl = Tools::ps_round($objOrder->getOrderTotal(), _PS_PRICE_COMPUTE_PRECISION_); + $objOrder->total_paid_tax_excl = Tools::ps_round($objOrder->getOrderTotal(false), _PS_PRICE_COMPUTE_PRECISION_); + + // update invoice total + if (isset($objOrderInvoice) && Validate::isLoadedObject($objOrderInvoice)) { + $objOrderInvoice->total_paid_tax_excl += Tools::ps_round((float)$totalPriceChangeTaxExcl, _PS_PRICE_COMPUTE_PRECISION_); + $objOrderInvoice->total_paid_tax_incl += Tools::ps_round((float)$totalPriceChangeTaxIncl, _PS_PRICE_COMPUTE_PRECISION_); + $objOrderInvoice->save(); + } + + // discounts calculation for order + $objOrder->total_discounts += (float)abs($objCart->getOrderTotal(true, Cart::ONLY_DISCOUNTS)); + $objOrder->total_discounts_tax_excl += (float)abs($objCart->getOrderTotal(false, Cart::ONLY_DISCOUNTS)); + $objOrder->total_discounts_tax_incl += (float)abs($objCart->getOrderTotal(true, Cart::ONLY_DISCOUNTS)); + + // Save changes of order + if ($objOrder->update()) { + $response['service_panel'] = $this->processRenderServicesPanel( + $objOrder->id, + $objHotelBookingDetail->id_product, + $objHotelBookingDetail->date_from, + $objHotelBookingDetail->date_to, + $objHotelBookingDetail->id_room, + $objHotelBookingDetail->id, + true + ); + } else { + $response['hasError'] = true; + $response['errors'][] = $this->l('Some error occurred while updating the order1'); + } + + // at last delete the specific price created for the service + if (Validate::isLoadedObject($objSpecificPrice)) { + $objSpecificPrice->delete(); + unset($objSpecificPrice); + } + + // at last delete the created service + $objServiceProduct->delete(); + } else { + $response['hasError'] = true; + $response['errors'][] = $this->l('Some error occurred while updating the order11'); + } + } else { + $response['hasError'] = true; + $response['errors'][] = $this->l('Unable to add service to the room1'); + } + } else { + $response['hasError'] = true; + $response['errors'][] = $this->l('Unable to add service to the room11'); + } + } else { + $response['hasError'] = true; + $response['errors'][] = $this->l('Unable to add service to the room111'); + } + } else { + $response['hasError'] = true; + $response['errors'][] = $this->l('Unable to add service to the room1111'); + } + } + } else { + $response['hasError'] = true; + $response['errors'][] = $this->l('Unable to add service to the room11111'); + } + } else { + $response['hasError'] = true; + $response['errors'][] = $this->l('Room not found'); + } + } else { + $response['hasError'] = true; + $response['errors'][] = $this->l('You do not have permission to edit this order.'); + } + + die(json_encode($response)); + } + // Process when admin changes extra demands of any room while order creation process form.tpl public function ajaxProcessChangeRoomDemands() { diff --git a/js/admin/orders.js b/js/admin/orders.js index ac24e8167..dca14a2d9 100644 --- a/js/admin/orders.js +++ b/js/admin/orders.js @@ -1344,22 +1344,100 @@ $(document).ready(function() { $('#back_to_demands_btn').hide(); }); - $(document).on('click', '#btn_new_room_service', function() { - $('.room_services_container').show(); - $('#save_service_service').show(); - $('#back_to_service_btn').show(); - $('.room_ordered_services').hide(); - $('#btn_new_room_service').hide(); - }); // click on back button on created facilities while additional facilities edit $(document).on('click', '#back_to_service_btn', function() { $('.room_ordered_services').show(); + $('#btn_new_existing_room_service').show(); $('#btn_new_room_service').show(); - $('.room_services_container').hide(); + $('#add_existing_room_services_form').hide(); + $('#add_new_room_services_form').hide(); $('#save_service_service').hide(); $('#back_to_service_btn').hide(); }); + // Start: New custom service oprations + + $(document).on('click', '#btn_new_existing_room_service', function() { + $('#add_existing_room_services_form').show(); + $('#add_new_room_services_form').hide(); + $('#save_service_service').show(); + $('#back_to_service_btn').show(); + $('.room_ordered_services').hide(); + $('#btn_new_existing_room_service').hide(); + $('#btn_new_room_service').hide(); + $('#add_new_room_services_form').hide(); + }); + + // Add new custom service: Show hide new custom service form + $(document).on('click', '#btn_new_room_service', function() { + $('#add_existing_room_services_form').hide(); + $('#add_new_room_services_form').show(); + $('#add_new_room_services_form').show(); + $('#back_to_service_btn').show(); + $('.room_ordered_services').hide(); + $('#btn_new_existing_room_service').hide(); + $('#btn_new_room_service').hide(); + }); + + // Add new custom service: change auto added option + $(document).on('change', '#add_new_room_services_form input[name="new_service_auto_added"]', function() { + var room_type_tax_rule_group_exist = $("#room_type_tax_rule_group_exist").val(); + if ($(this).val() == 1) { + $("#new_service_price_addition_type_container").show(); + $("#new_service_qty_container").hide(); + if (room_type_tax_rule_group_exist) { + $("#new_service_price_tax_rule_container").hide(); + } + } else { + $("#new_service_price_addition_type_container").hide(); + $("#new_service_qty_container").show(); + $("#new_service_price_tax_rule_container").show(); + } + }); + + // Add new custom service to the room + $(document).on('submit', '#add_new_room_services_form', function(e) { + e.preventDefault(); + var form_data = new FormData(this); + form_data.append('ajax', true); + form_data.append('action', 'addNewRoomServices'); + + $(".loading_overlay").show(); + $.ajax({ + type: 'POST', + headers: { + "cache-control": "no-cache" + }, + url: admin_order_tab_link, + dataType: 'JSON', + cache: false, + data: form_data, + processData: false, + contentType: false, + success: function(jsonData) { + if (!jsonData.hasError) { + if (jsonData.service_panel) { + $('#room_type_service_product_desc').replaceWith(jsonData.service_panel); + } + showSuccessMessage(txtExtraDemandSucc); + } else { + var errorHtml = error_found_txt + ':
'; + errorHtml += '
    '; + $.each(jsonData.errors, function(key, errorMsg) { + errorHtml += '
  1. ' + errorMsg + '
  2. '; + }); + errorHtml += '
'; + showErrorMessage(errorHtml); + } + }, + complete: function() { + $(".loading_overlay").hide(); + } + }); + }); + + // End: New custom service oprations + $(document).on('change', '#edit-room-booking-modal .room_ordered_services .qty', function(e) { let quantityInputField = this; let maximumQuantity = parseInt($(quantityInputField).attr('data-max-quantity')); @@ -1379,18 +1457,19 @@ $(document).ready(function() { updateAdditionalServices($(this).closest('tr')); }); - $(document).on('focusout', '#edit-room-booking-modal #add_room_services_form .qty', function(e) { + $(document).on('focusout', '#edit-room-booking-modal #add_existing_room_services_form .qty', function(e) { var qty_wntd = $(this).val(); if (qty_wntd == '' || !$.isNumeric(qty_wntd) || qty_wntd < 1) { $(this).val(1); } }); - $(document).on('submit', '#add_room_services_form', function(e) { + // Add existing available service to the room + $(document).on('submit', '#add_existing_room_services_form', function(e) { e.preventDefault(); var form_data = new FormData(this); form_data.append('ajax', true); - form_data.append('action', 'addRoomAdditionalServices'); + form_data.append('action', 'addExistingRoomServices'); $(".loading_overlay").show(); $.ajax({ From 63fc3ea22237d356e072e92933b2151a380c47f8 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Sat, 15 Feb 2025 18:30:49 +0530 Subject: [PATCH 02/29] Added suggestion for the guest to select guest detail while using booking for someone else feature --- classes/CartCustomerGuestDetail.php | 42 +++++- controllers/front/OrderOpcController.php | 34 +++++ install/data/db_structure.sql | 6 + .../hotel-reservation-theme/css/order-opc.css | 25 ++++ .../hotel-reservation-theme/js/order-opc.js | 128 +++++++++++++++++- 5 files changed, 232 insertions(+), 3 deletions(-) diff --git a/classes/CartCustomerGuestDetail.php b/classes/CartCustomerGuestDetail.php index 2d4ae2fa6..f26e4c795 100644 --- a/classes/CartCustomerGuestDetail.php +++ b/classes/CartCustomerGuestDetail.php @@ -54,6 +54,46 @@ class CartCustomerGuestDetailCore extends ObjectModel ); } + public function add($auto_date = true, $null_values = false) + { + if ($res = parent::add($auto_date, $null_values)) { + $objCart = new Cart($this->id_cart); + Db::getInstance()->insert('customer_guest_detail_mapping', array( + 'id_customer' => (int) $objCart->id_customer, + 'id_customer_guest_detail' => (int)$this->id + )); + } + + return $res; + } + + public function delete() + { + if ($res = parent::delete()) { + $objCart = new Cart($this->id_cart); + Db::getInstance()->delete('customer_guest_detail_mapping', + '`id_customer` = '.(int) $objCart->id_customer.' + AND `id_customer_guest_detail`='.(int) $this->id + ); + } + + return $res; + } + + public function getCustomerRelatedGuestDetails($idCustomer, $firstname = false, $lastname = false, $email = false) + { + return Db::getInstance()->executeS(' + SELECT cgd.`id_customer_guest_detail`, cgd.`email`, cgd.`firstname`, cgd.`lastname`, cgd.`phone`, cgd.`id_cart` + FROM `'._DB_PREFIX_.'customer_guest_detail_mapping` cgdm + LEFT JOIN `'._DB_PREFIX_.'cart_customer_guest_detail` cgd + ON (cgdm.`id_customer_guest_detail` = cgd.`id_customer_guest_detail`) + WHERE cgdm.`id_customer` = '.(int)$idCustomer. + (($firstname !== false && $firstname != '') ? ' AND cgd.`firstname` LIKE "%'.$firstname.'%"' : ' '). + (($lastname !== false && $lastname != '') ? ' AND cgd.`lastname` LIKE "%'.$lastname.'%"' : ' '). + (($email !== false && $email != '') ? ' AND cgd.`email` LIKE "%'.$email.'%"' : ' ') + ); + } + public static function getCustomerGuestDetail($id_customer_guest_detail) { return Db::getInstance()->getRow(' @@ -121,4 +161,4 @@ class CartCustomerGuestDetailCore extends ObjectModel return $isValid; } -} \ No newline at end of file +} diff --git a/controllers/front/OrderOpcController.php b/controllers/front/OrderOpcController.php index 61b602ec3..59eaf1dff 100644 --- a/controllers/front/OrderOpcController.php +++ b/controllers/front/OrderOpcController.php @@ -391,6 +391,10 @@ class OrderOpcControllerCore extends ParentOrderController $this->ajaxDie($this->submitCustomerGuestDetail()); exit; break; + case 'getCustomerGuestDetail': + $this->ajaxDie($this->getCustomerGuestDetail()); + exit; + break; default: throw new PrestaShopException('Unknown method "'.Tools::getValue('method').'"'); } @@ -1069,6 +1073,36 @@ class OrderOpcControllerCore extends ParentOrderController die('0'); } + public function getCustomerGuestDetail() + { + $response = array('status' => false); + $firstname = trim(Tools::getValue('firstname')); + $lastname = trim(Tools::getValue('lastname')); + $email = trim(Tools::getValue('email')); + $objCartCustomerGuestDetail = new CartCustomerGuestDetailCore(); + if ($guestDetails = $objCartCustomerGuestDetail->getCustomerRelatedGuestDetails( + $this->context->cart->id_customer, + $firstname, + $lastname, + $email, + )) { + $response['status'] = true; + $detailsExist = array(); + foreach ($guestDetails as $guestKey => $guestDetail) { + $joinKey = trim($guestDetail['firstname']).trim($guestDetail['lastname']).trim($guestDetail['email']); + if ($guestDetail['id_cart'] == $this->context->cart->id || isset($detailsExist[$joinKey])) { + unset($guestDetails[$guestKey]); + } + $detailsExist[$joinKey] = true; + } + + $response['guestDetails'] = $guestDetails; + } + + return json_encode($response); + } + + public function submitCustomerGuestDetail() { $customerGuestDetail = Tools::getValue('customer_guest_detail'); diff --git a/install/data/db_structure.sql b/install/data/db_structure.sql index de57c4024..b21a85bfd 100644 --- a/install/data/db_structure.sql +++ b/install/data/db_structure.sql @@ -699,6 +699,12 @@ CREATE TABLE `PREFIX_cart_customer_guest_detail` ( PRIMARY KEY (`id_customer_guest_detail`) ) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8 COLLATION; +CREATE TABLE `PREFIX_customer_guest_detail_mapping` ( + `id_customer_guest_detail` int(10) unsigned NOT NULL, + `id_customer` int(10) unsigned NOT NULL, + PRIMARY KEY (`id_customer_guest_detail`, `id_customer`) +) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8 COLLATION; + CREATE TABLE `PREFIX_customization` ( `id_customization` int(10) unsigned NOT NULL auto_increment, `id_product_attribute` int(10) unsigned NOT NULL DEFAULT '0', diff --git a/themes/hotel-reservation-theme/css/order-opc.css b/themes/hotel-reservation-theme/css/order-opc.css index b3f1c7b6e..d32358148 100644 --- a/themes/hotel-reservation-theme/css/order-opc.css +++ b/themes/hotel-reservation-theme/css/order-opc.css @@ -682,3 +682,28 @@ line-height: 19px; color: #333; margin-bottom: 15px; } + +/* Customer guest suggetions Css */ +.customer_guest_detail_ul { + overflow-x: hidden; + overflow-y: auto; + max-height: 200px; + background: #fff; + margin: 0; + margin-top: 2px; + font-size: 14px; + z-index: 10; + box-shadow: 0 4px 5px rgba(0, 0, 0, 0.15); + position: absolute; + width: 90%;} + +.customer_guest_detail_li { + white-space: nowrap; + padding: 15px;} +.customer_guest_detail_li.active { + color: #fff; + background-color: #379bf0;} +.customer_guest_detail_li:hover { + cursor: pointer; + background-color: #379bf0; + color: #fff;} diff --git a/themes/hotel-reservation-theme/js/order-opc.js b/themes/hotel-reservation-theme/js/order-opc.js index c828b6051..c8af2ab06 100644 --- a/themes/hotel-reservation-theme/js/order-opc.js +++ b/themes/hotel-reservation-theme/js/order-opc.js @@ -116,15 +116,139 @@ $(document).ready(function() validateCustomerGuestDetailForm(); } - $('#customer_guest_detail_form').on('change', function(e) { + function submitCustomerGuestDetailForm(postData) { $.ajax({ type: 'POST', url: orderOpcUrl, async: false, cache: false, dataType : "json", - data: $(this).serialize()+'&method=submitCustomerGuestDetail&ajax=true&token=' + static_token + data: postData }); + } + + $('#customer_guest_detail_form').on('change', function(e) { + let postData = $(this).serialize()+'&method=submitCustomerGuestDetail&ajax=true&token=' + static_token; + submitCustomerGuestDetailForm(postData); + }); + function setCustomerGuestDetailForm(guestDetail) { + $('#customer_guest_detail_firstname').val(guestDetail.firstname); + $('#customer_guest_detail_lastname').val(guestDetail.lastname); + $('#customer_guest_detail_email').val(guestDetail.email); + $('#customer_guest_detail_phone').val(guestDetail.phone); + validateCustomerGuestDetailForm(); + let postData = $('#customer_guest_detail_form').serialize()+'&method=submitCustomerGuestDetail&ajax=true&token=' + static_token; + submitCustomerGuestDetailForm(postData); + $('.customer_guest_detail_ul').remove(); + } + + $(document).on('keyup', function(e) { + if (!$(e.target).attr('id') == 'customer_guest_detail_firstname' + || !$(e.target).attr('id') == 'customer_guest_detail_lastname' + || !$(e.target).attr('id') == 'customer_guest_detail_email' + ) { + $('.customer_guest_detail_ul').remove(); + } + }); + + $(document).on('click', function(e) { + if ($(e.target).hasClass('customer_guest_detail_li')) { + let guestDetail = $(e.target).data('guest_detail'); + setCustomerGuestDetailForm(guestDetail); + } + + $('.customer_guest_detail_ul').remove(); + }); + let debounceTimeout; + $(document).on('keyup', '#customer_guest_detail_firstname, #customer_guest_detail_lastname, #customer_guest_detail_email', function(e) { + var keyCode = e.keyCode || e.which; + if (keyCode == 40 || keyCode == 38) { + let activeElem = $(".customer_guest_detail_ul .active"); + let newActiveElem; + if (activeElem.length) { + if (keyCode == 40) { + newActiveElem = activeElem.next("li"); + if (!newActiveElem.length) { + newActiveElem = $(".customer_guest_detail_ul li:first"); // Loop back to first + } + } else if (keyCode == 38) { + newActiveElem = activeElem.prev("li"); + if (!newActiveElem.length) { + newActiveElem = $(".customer_guest_detail_ul li:last"); // Loop back to last + } + } + } else { + newActiveElem = keyCode == 40 ? $(".customer_guest_detail_ul li:first") : $(".customer_guest_detail_ul li:last"); + } + + activeElem.removeClass("active"); + newActiveElem.addClass("active"); + + return; + } else if (keyCode == 13) { + if ($('.customer_guest_detail_ul .active').length != 0) { + let guestDetail = $('.customer_guest_detail_ul .active').data('guest_detail'); + setCustomerGuestDetailForm(guestDetail); + } + } else if (!((keyCode < 65 || keyCode > 122) && (keyCode < 48 || keyCode > 57) && (keyCode != 8))) { + $('.customer_guest_detail_ul').remove(); + clearTimeout(debounceTimeout); // Clear the existing timeout + debounceTimeout = setTimeout(() => { + let firstName = $('#customer_guest_detail_firstname').val(); + let lastName = $('#customer_guest_detail_lastname').val(); + let email = $('#customer_guest_detail_email').val(); + let targetElem = $(this); + customerGuestDetailAjax = $.ajax({ + type: 'POST', + url: orderOpcUrl, + async: false, + cache: false, + dataType : "json", + data: { + token : static_token, + ajax : true, + method : 'getCustomerGuestDetail', + firstname : firstName, + lastname : lastName, + email : email, + }, + success: function(data) { + if (data.status) { + let listElem = $('
    ').addClass('customer_guest_detail_ul'); + $.each(data.guestDetails, function(index, guestDetail) { + let itemElem = $('
  • ').addClass('customer_guest_detail_li').text(guestDetail.firstname + ' '+ guestDetail.lastname + ' ('+ guestDetail.email+')'); + $(itemElem).attr('data-guest_detail', JSON.stringify(guestDetail)); + $(listElem).append(itemElem); + }); + + $(targetElem).closest('.form-group').append($(listElem).prop('outerHTML')); + } + } + }); + }, 200); + } + }); + + $(document).on('keydown', '.customer_guest_detail_ul li', function(e) { + if (e.which == 40 || e.which == 38) { + var ulElement = $(this).closest('ul'); + var ulLength = ulElement.find('li').length; + $(this).blur(); + ulElement.scrollTop($(this).index() * $(this).outerHeight()); + if (e.which == 40) { + if ($(this).index() != (ulLength - 1)) { + $(this).next('li.customer_guest_detail_li').focus(); + } else { + ulElement.find('li:first').focus(); + } + } else if (e.which == 38) { + if ($(this).index()) { + $(this).prev('li.customer_guest_detail_li').focus(); + } else { + ulElement.find('li:last').focus(); + } + } + } }); // GUEST CHECKOUT / NEW ACCOUNT MANAGEMENT From dcefbb4afad0d74c95e22001de9ef9f54127c230 Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Mon, 17 Feb 2025 19:50:54 +0530 Subject: [PATCH 03/29] Added: Allow editing the price of a service while creating an order from back-office --- .../orders/_cart_booking_demands.tpl | 8 ++- .../template/controllers/orders/form.tpl | 22 ++++++- controllers/admin/AdminCartsController.php | 4 ++ controllers/admin/AdminOrdersController.php | 63 +++++++++++++++++-- .../classes/RoomTypeServiceProduct.php | 12 ++-- .../RoomTypeServiceProductCartDetail.php | 26 ++++---- 6 files changed, 110 insertions(+), 25 deletions(-) diff --git a/admin/themes/default/template/controllers/orders/_cart_booking_demands.tpl b/admin/themes/default/template/controllers/orders/_cart_booking_demands.tpl index 3ab29983b..28dfcb1b2 100644 --- a/admin/themes/default/template/controllers/orders/_cart_booking_demands.tpl +++ b/admin/themes/default/template/controllers/orders/_cart_booking_demands.tpl @@ -153,7 +153,13 @@
    {if ($product.show_price && !isset($restricted_country_mode)) || isset($groups)} - {convertPrice price=$product.price_tax_exc} +
    + + {$cartCurrency->sign} + + +
    + {convertPrice price=$product.price_tax_exc} {/if}
    diff --git a/admin/themes/default/template/controllers/orders/form.tpl b/admin/themes/default/template/controllers/orders/form.tpl index 105e6b608..a71077f66 100644 --- a/admin/themes/default/template/controllers/orders/form.tpl +++ b/admin/themes/default/template/controllers/orders/form.tpl @@ -1614,6 +1614,11 @@ updateServiceProducts(this); }); + // when the price of a service product is changed and focus is out + $(document).on('change', '.service_cart_price_input', function() { + updateServiceProducts(this); + }); + $(document).on('focusout', '#rooms_type_extra_demands .qty', function(e) { var qty_wntd = $(this).val(); if (qty_wntd == '' || !$.isNumeric(qty_wntd)) { @@ -1684,10 +1689,20 @@ function updateServiceProducts(element) { - var operator = $(element).is(':checked') ? 'up' : 'down'; - var id_product = $(element).val(); - var id_cart_booking = $(element).data('id_cart_booking'); var qty = $(element).closest('.room_demand_block').find('input.qty').val(); + var dataElement = $(element).closest('.room_demand_block').find('.change_room_type_service_product'); + var operator = $(dataElement).is(':checked') ? 'up' : 'down'; + var id_product = $(dataElement).val(); + var id_cart_booking = $(dataElement).data('id_cart_booking'); + var service_price = $("#service_cart_price_"+id_cart_booking+"_"+id_product).val(); + if (operator == 'up') { + $("#service_cart_price_"+id_cart_booking+"_"+id_product+"_input").show(); + $("#service_cart_price_"+id_cart_booking+"_"+id_product+"_txt").hide(); + } else { + $("#service_cart_price_"+id_cart_booking+"_"+id_product+"_input").hide(); + $("#service_cart_price_"+id_cart_booking+"_"+id_product+"_txt").show(); + } + if (typeof(qty) == 'undefined') { qty = 1; } @@ -1704,6 +1719,7 @@ id_product: id_product, id_cart_booking: id_cart_booking, qty: qty, + price: service_price, action: 'updateServiceProduct', ajax: true }, diff --git a/controllers/admin/AdminCartsController.php b/controllers/admin/AdminCartsController.php index 2ce84593f..04c7b91a3 100644 --- a/controllers/admin/AdminCartsController.php +++ b/controllers/admin/AdminCartsController.php @@ -1121,7 +1121,11 @@ class AdminCartsControllerCore extends AdminController null ); } + + $objCart = new Cart($idCart); + $cartCurrency = new Currency($objCart->id_currency); $this->context->smarty->assign(array( + 'cartCurrency' => $cartCurrency, 'roomTypeServiceProducts' => $roomTypeServiceProducts, 'selectedRoomServiceProduct' => $selectedRoomServiceProduct )); diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index 44e20dc6e..1973eaf7c 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -7436,6 +7436,7 @@ class AdminOrdersControllerCore extends AdminController $idServiceProduct = Tools::getValue('id_product'); $idCartBooking = Tools::getValue('id_cart_booking'); $qty = Tools::getValue('qty'); + $price = Tools::getValue('price'); if (Validate::isLoadedObject($objHotelCartBookingData = new HotelCartBookingData($idCartBooking))) { $objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail(); @@ -7447,13 +7448,17 @@ class AdminOrdersControllerCore extends AdminController if (Validate::isLoadedObject($objProduct = new Product($idServiceProduct))) { if ($objProduct->allow_multiple_quantity) { if (!Validate::isUnsignedInt($qty)) { - $this->errors[] = Tools::displayError('The quantity code you\'ve entered is invalid.'); + $this->errors[] = Tools::displayError('The quantity you\'ve entered is invalid.'); // } elseif ($objProduct->max_quantity && $qty > $objProduct->max_quantity) { // $this->errors[] = Tools::displayError(sprintf('cannot add more than %d quantity.', $objProduct->max_quantity)); } } else { $qty = 1; } + // validate price + if ($price && !ValidateCore::isPrice($price)) { + $this->errors[] = Tools::displayError('Invalid service unit price.'); + } } else { $this->errors[] = Tools::displayError('This Service is not available.'); } @@ -7470,9 +7475,59 @@ class AdminOrdersControllerCore extends AdminController $objHotelCartBookingData->id_cart, $operator )) { - $this->ajaxDie(json_encode(array( - 'hasError' => false - ))); + $objCart = new Cart($objHotelCartBookingData->id_cart); + $originalPrice = Product::getPriceStatic($idServiceProduct, false); + // if price is different than the original service price then update the price + if ($operator == 'up' && $originalPrice != $price) { + if ($specificPriceInfo = SpecificPrice::getSpecificPrice( + (int)$idServiceProduct, + 0, + $objCart->id_currency, + 0, + 0, + 1, + 0, + $objCart->id_customer, + $objCart->id + )) { + $objSpecificPrice = new SpecificPrice($specificPriceInfo['id_specific_price']); + } else { + $objSpecificPrice = new SpecificPrice(); + } + $objSpecificPrice->id_shop = 0; + $objSpecificPrice->id_shop_group = 0; + $objSpecificPrice->id_cart = $objCart->id; + $objSpecificPrice->id_currency = $objCart->id_currency; + $objSpecificPrice->id_country = 0; + $objSpecificPrice->id_group = 0; + $objSpecificPrice->id_customer = $objCart->id_customer; + $objSpecificPrice->id_product = $idServiceProduct; + $objSpecificPrice->id_product_attribute = 0; + $objSpecificPrice->price = $price; + $objSpecificPrice->from_quantity = 1; + $objSpecificPrice->reduction = 0; + $objSpecificPrice->reduction_type = 'amount'; + $objSpecificPrice->reduction_tax = 0; + $objSpecificPrice->from = '0000-00-00 00:00:00'; + $objSpecificPrice->to = '0000-00-00 00:00:00'; + if ($objSpecificPrice->save()) { + $this->ajaxDie(json_encode(array( + 'hasError' => false + ))); + } else { + $this->errors[] = Tools::displayError('Some error has been occurred. Please try reloading the page.'); + } + } else { + // delete specific price if price is same as original price + if (SpecificPrice::deleteByIdCart($objCart->id, $idServiceProduct)) { + $this->ajaxDie(json_encode(array( + 'hasError' => false, + 'down' => 1, + ))); + } else { + $this->errors[] = Tools::displayError('Unable to update services. Please try reloading the page.'); + } + } } else { $this->errors[] = Tools::displayError('Unable to update services. Please try reloading the page.'); } diff --git a/modules/hotelreservationsystem/classes/RoomTypeServiceProduct.php b/modules/hotelreservationsystem/classes/RoomTypeServiceProduct.php index 7c80b17e1..f9575f1e2 100644 --- a/modules/hotelreservationsystem/classes/RoomTypeServiceProduct.php +++ b/modules/hotelreservationsystem/classes/RoomTypeServiceProduct.php @@ -169,8 +169,9 @@ class RoomTypeServiceProduct extends ObjectModel public function getServiceProductsData($idProductRoomType, $p = 1, $n = 0, $front = false, $available_for_order = 2, $auto_add_to_cart = 0, $subCategory = false, $idLang = false) { + $context = Context::getContext(); if (!$idLang) { - $idLang = Context::getContext()->language->id; + $idLang = $context->language->id; } $objProduct = new Product($idProductRoomType); if ($serviceProducts = $objProduct->getProductServiceProducts( @@ -194,7 +195,8 @@ class RoomTypeServiceProduct extends ObjectModel 1, null, null, - false + false, + $context->cart->id ); $serviceProduct['price_tax_incl'] = $objRoomTypeServiceProductPrice->getServicePrice( @@ -203,7 +205,8 @@ class RoomTypeServiceProduct extends ObjectModel 1, null, null, - true + true, + $context->cart->id ); $useTax = Product::$_taxCalculationMethod == PS_TAX_EXC ? false : true; $serviceProduct['price_without_reduction'] = $objRoomTypeServiceProductPrice->getServicePrice( @@ -212,7 +215,8 @@ class RoomTypeServiceProduct extends ObjectModel 1, null, null, - $useTax + $useTax, + $context->cart->id ); $serviceProduct['images'] = Image::getImages((int)Context::getContext()->language->id, $serviceProduct['id_product']); } diff --git a/modules/hotelreservationsystem/classes/RoomTypeServiceProductCartDetail.php b/modules/hotelreservationsystem/classes/RoomTypeServiceProductCartDetail.php index fec2fed2c..59f03b65b 100644 --- a/modules/hotelreservationsystem/classes/RoomTypeServiceProductCartDetail.php +++ b/modules/hotelreservationsystem/classes/RoomTypeServiceProductCartDetail.php @@ -287,7 +287,7 @@ class RoomTypeServiceProductCartDetail extends ObjectModel $product['date_from'], $product['date_to'], $useTax, - false, + $idCart, $id_address ); @@ -304,7 +304,7 @@ class RoomTypeServiceProductCartDetail extends ObjectModel $product['date_from'], $product['date_to'], $useTax, - false, + $idCart, $id_address ); @@ -315,7 +315,7 @@ class RoomTypeServiceProductCartDetail extends ObjectModel $product['date_from'], $product['date_to'], false, - false, + $idCart, $id_address ); @@ -326,7 +326,7 @@ class RoomTypeServiceProductCartDetail extends ObjectModel $product['date_from'], $product['date_to'], true, - false, + $idCart, $id_address ); $selectedServiceProducts[$product['htl_cart_booking_id']]['selected_products_info'][$product['id_product']] = array( @@ -344,7 +344,7 @@ class RoomTypeServiceProductCartDetail extends ObjectModel $product['date_from'], $product['date_to'], false, - false, + $idCart, $id_address ) / $numdays), 'unit_price_tax_incl' => ($objRoomTypeServiceProductPrice->getServicePrice( @@ -354,7 +354,7 @@ class RoomTypeServiceProductCartDetail extends ObjectModel $product['date_from'], $product['date_to'], true, - false, + $idCart, $id_address ) / $numdays), 'total_price' => $servicePrice, @@ -386,7 +386,7 @@ class RoomTypeServiceProductCartDetail extends ObjectModel $product['date_from'], $product['date_to'], $useTax, - false, + $idCart, $id_address ); @@ -397,7 +397,7 @@ class RoomTypeServiceProductCartDetail extends ObjectModel $product['date_from'], $product['date_to'], false, - false, + $idCart, $id_address ); @@ -408,7 +408,7 @@ class RoomTypeServiceProductCartDetail extends ObjectModel $product['date_from'], $product['date_to'], true, - false, + $idCart, $id_address ); if ($idProduct) { @@ -426,7 +426,7 @@ class RoomTypeServiceProductCartDetail extends ObjectModel $product['date_from'], $product['date_to'], false, - false, + $idCart, $id_address ) / $numdays; $selectedServiceProducts[$product['htl_cart_booking_id']]['unit_price_tax_incl'] = $objRoomTypeServiceProductPrice->getServicePrice( @@ -436,7 +436,7 @@ class RoomTypeServiceProductCartDetail extends ObjectModel $product['date_from'], $product['date_to'], true, - false, + $idCart, $id_address ) / $numdays; $selectedServiceProducts[$product['htl_cart_booking_id']]['total_price'] = $servicePrice; @@ -458,7 +458,7 @@ class RoomTypeServiceProductCartDetail extends ObjectModel null, null, false, - false, + $idCart, $id_address ) / $numdays), 'unit_price_tax_incl' => ($objRoomTypeServiceProductPrice->getServicePrice( @@ -468,7 +468,7 @@ class RoomTypeServiceProductCartDetail extends ObjectModel null, null, true, - false, + $idCart, $id_address ) / $numdays), 'total_price' => $servicePrice, From 279366f80fb9613baa614a13155d2f5597d295de Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Sat, 22 Feb 2025 14:31:07 +0530 Subject: [PATCH 04/29] Changes for mersing add and edit pages commits and add service functionality in add order page --- .../orders/_cart_booking_demands.tpl | 191 ++---- .../orders/_current_cart_details_data.tpl | 21 +- .../template/controllers/orders/form.tpl | 126 +++- .../_add_order_extra_services_tab_content.tpl | 170 +++++ ..._services_service_products_tab_content.tpl | 146 ++--- config/defines.inc.php | 2 +- controllers/admin/AdminCartsController.php | 365 ++++++++--- .../admin/AdminOrderPreferencesController.php | 16 +- controllers/admin/AdminOrdersController.php | 583 +++++++++--------- install/data/xml/configuration.xml | 6 + .../classes/HotelCartBookingData.php | 4 +- 11 files changed, 1043 insertions(+), 587 deletions(-) create mode 100644 admin/themes/default/template/controllers/orders/modals/_add_order_extra_services_tab_content.tpl diff --git a/admin/themes/default/template/controllers/orders/_cart_booking_demands.tpl b/admin/themes/default/template/controllers/orders/_cart_booking_demands.tpl index 28dfcb1b2..4db298378 100644 --- a/admin/themes/default/template/controllers/orders/_cart_booking_demands.tpl +++ b/admin/themes/default/template/controllers/orders/_cart_booking_demands.tpl @@ -18,82 +18,77 @@ *}
+ + + + + + + + + + {foreach $roomTypeDemands as $idGlobalDemand => $demand} + + + + + + + {/foreach} + +
{l s='Name'}{l s='Options'}{l s='Unit Price (tax excl.)'}
+ + +

{$demand['name']|escape:'html':'UTF-8'}

+
+ {if isset($demand['adv_option']) && $demand['adv_option']} + + {else} + -- + + {/if} + + + {if isset($selected_adv_option) && isset($demand['adv_option'][$selected_adv_option]['price_tax_excl'])}{convertPrice price = $demand['adv_option'][$selected_adv_option]['price_tax_excl']|escape:'html':'UTF-8'}{else if isset($demand['adv_option']) && $demand['adv_option']}{convertPrice price = $demand['adv_option'][$demand['adv_option']|@key]['price_tax_excl']}{else}{convertPrice price = $demand['price_tax_excl']|escape:'html':'UTF-8'}{/if} + + {if $demand['price_calc_method'] == HotelRoomTypeGlobalDemand::WK_PRICE_CALC_METHOD_EACH_DAY} + {l s='/ night'} + {/if} +
{/if} @@ -103,78 +98,16 @@ {/if} - {if isset($roomTypeServiceProducts) && $roomTypeServiceProducts} -
-
-

{l s='Add below services to the rooms for better hotel experience'}

-
-
- {assign var=roomCount value=1} -
-
- - - {if isset($selectedRoomServiceProduct['room_num']) && $selectedRoomServiceProduct['room_num']} - {l s='Room'} {$selectedRoomServiceProduct['room_num']|escape:'html':'UTF-8'} - {else} - {l s='Room'} {$roomCount|escape:'html':'UTF-8'} - {/if} - -
-
- {if isset($roomTypeServiceProducts) && $roomTypeServiceProducts} - {foreach $roomTypeServiceProducts as $product} -
-
-
-
- -
-
-

{$product['name']|escape:'html':'UTF-8'}

- {if $product.allow_multiple_quantity} -
- -

- {l s='Maximum allowed quantity: %s' sprintf=$product.max_quantity} -

-
- {/if} -
-
-
-
- {if $product['auto_add_to_cart'] && $product['price_addition_type'] == Product::PRICE_ADDITION_TYPE_INDEPENDENT} - {l s='Convenience fee'} - {/if} - {if $product['auto_add_to_cart'] && $product['price_addition_type'] == Product::PRICE_ADDITION_TYPE_WITH_ROOM} - {l s='Auto added'} - {/if} -
-
- {if ($product.show_price && !isset($restricted_country_mode)) || isset($groups)} -
- - {$cartCurrency->sign} - - -
- {convertPrice price=$product.price_tax_exc} - {/if} -
-
- {/foreach} - {/if} -
-
-
-
- {/if} + + {include file='controllers/orders/modals/_add_order_extra_services_tab_content.tpl'} - + + {if isset($loaderImg) && $loaderImg} +
+ +
+ {/if} 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 3bb29c765..5c355a4f5 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 @@ -145,7 +145,7 @@ {if (isset($data.extra_demands) && $data.extra_demands) || isset($data.additional_service) && $data.additional_service}
- +  {l s='Services'} {/if} @@ -210,22 +210,13 @@ color:#979797; font-size:12px;} /*Extra demands CSS*/ - #rooms_type_extra_demands .modal-header { - padding-bottom: 0px} - #rooms_extra_demands { - font-size: 16px;} - #rooms_extra_demands .room_demands_container { - border: 1px solid #ddd;} - #rooms_extra_demands .demand_header { - padding: 10px; - color: #333; - border-bottom: 1px solid #ddd;} #rooms_extra_demands .rooms_extra_demands_head { margin-bottom: 18px;} #rooms_extra_demands .room_demand_block { margin-bottom: 15px; - color: #333; - font-size: 14px;} - #rooms_extra_demands .room_demand_detail { - padding: 15px 15px 0px 15px;} + color: #333;} + #room_type_service_product_desc #back_to_service_btn { + display: none;} + #add_new_room_services_block { + display: none;} diff --git a/admin/themes/default/template/controllers/orders/form.tpl b/admin/themes/default/template/controllers/orders/form.tpl index a71077f66..0cc2edc0b 100644 --- a/admin/themes/default/template/controllers/orders/form.tpl +++ b/admin/themes/default/template/controllers/orders/form.tpl @@ -177,7 +177,7 @@ $('body').on('click', '.delete_service_product', function(){ if (confirm("{l s='Are you sure?'}")) { - + $(".loading_overlay").show(); $.ajax({ type:"POST", url: "{$link->getAdminLink('AdminOrders')|addslashes}", @@ -204,7 +204,10 @@ { alert("l s='Some error occured.please try again.'}"); } - } + }, + complete: function(){ + $(".loading_overlay").hide(); + } }); $(this).closest("tr").remove(); } @@ -1499,6 +1502,9 @@ var idRoom = $(this).attr('id_room'); var dateFrom = $(this).attr('date_from'); var dateTo = $(this).attr('date_to'); + var idHotelCartBooking = $(this).attr('id_hotel_cart_booking'); + + $(".loading_overlay").show(); $.ajax({ type: 'POST', dataType: 'JSON', @@ -1513,17 +1519,29 @@ id_room: idRoom, id_cart: idCart, id_product: idProduct, + id_hotel_cart_booking: idHotelCartBooking, action: 'getRoomTypeCartDemands', ajax: true }, success: function(response) { - if (response.status) { - $('#customer_cart_details').after(response.html_exta_demands); + if (response.hasError) { + var errorHtml = error_found_txt + ':
'; + errorHtml += '
    '; + $.each(response.errors, function(key, errorMsg) { + errorHtml += '
  1. ' + errorMsg + '
  2. '; + }); + errorHtml += '
'; + showErrorMessage(errorHtml); + } else { + $('#customer_cart_details').after(response.html_exta_demands); // $('#rooms_type_extra_demands').find('#room_type_demands_desc').html(''); // $('#rooms_type_extra_demands').find('#room_type_demands_desc').append(response.html_exta_demands); $('#rooms_type_extra_demands').modal('show'); - } + } }, + complete: function() { + $(".loading_overlay").hide(); + } }); }); $(document).on('hidden.bs.modal', '#rooms_type_extra_demands', function (e) { @@ -1542,6 +1560,7 @@ }); }); var idBookingCart = $(this).attr('id_cart_booking'); + $(".loading_overlay").show(); $.ajax({ type: 'POST', dataType: 'JSON', @@ -1563,7 +1582,10 @@ } else { showErrorMessage(txtExtraDemandErr); } - } + }, + complete: function() { + $(".loading_overlay").hide(); + } }); }); @@ -1584,6 +1606,7 @@ }); }); var idBookingCart = $(this).closest('.room_demand_block').find('.id_room_type_demand').attr('id_cart_booking'); + $(".loading_overlay").show(); $.ajax({ type: 'POST', dataType: 'JSON', @@ -1605,7 +1628,10 @@ } else { showErrorMessage(txtExtraDemandErr); } - } + }, + complete: function() { + $(".loading_overlay").hide(); + } }); } }); @@ -1687,6 +1713,75 @@ } }); + // click on back button on created facilities while additional facilities edit + $(document).on('click', '#back_to_service_btn', function() { + $('#room_type_services_desc').show(); + $('#add_new_room_services_block').hide(); + $('#back_to_service_btn').hide(); + }); + + // Add new custom service: Show hide new custom service form + $(document).on('click', '#btn_new_room_service', function() { + $('#add_new_room_services_block').show(); + $('#back_to_service_btn').show(); + $('#room_type_services_desc').hide(); + }); + + // Add new custom service: change auto added option + $(document).on('change', '#add_new_room_services_form input[name="new_service_auto_added"]', function() { + var room_type_tax_rule_group_exist = $("#room_type_tax_rule_group_exist").val(); + if ($(this).val() == 1) { + $("#new_service_price_tax_rule_container").hide(); + $("#new_service_price_addition_type_container").show(); + $("#new_service_qty_container").hide(); + } else { + $("#new_service_price_addition_type_container").hide(); + $("#new_service_qty_container").show(); + $("#new_service_price_tax_rule_container").show(); + } + }); + + // Add new custom service to the room + $(document).on('submit', '#add_new_room_services_form', function(e) { + e.preventDefault(); + var form_data = new FormData(this); + form_data.append('ajax', true); + form_data.append('action', 'addNewRoomServices'); + + $(".loading_overlay").show(); + $.ajax({ + type: 'POST', + headers: { + "cache-control": "no-cache" + }, + url: "{$link->getAdminLink('AdminCarts')|addslashes}", + dataType: 'JSON', + cache: false, + data: form_data, + processData: false, + contentType: false, + success: function(jsonData) { + if (!jsonData.hasError) { + if (jsonData.service_panel) { + $('#room_type_service_product_desc').replaceWith(jsonData.service_panel); + } + showSuccessMessage(txtExtraDemandSucc); + } else { + var errorHtml = error_found_txt + ':
'; + errorHtml += '
    '; + $.each(jsonData.errors, function(key, errorMsg) { + errorHtml += '
  1. ' + errorMsg + '
  2. '; + }); + errorHtml += '
'; + showErrorMessage(errorHtml); + } + }, + complete: function() { + $(".loading_overlay").hide(); + } + }); + }); + function updateServiceProducts(element) { var qty = $(element).closest('.room_demand_block').find('input.qty').val(); @@ -1695,17 +1790,12 @@ var id_product = $(dataElement).val(); var id_cart_booking = $(dataElement).data('id_cart_booking'); var service_price = $("#service_cart_price_"+id_cart_booking+"_"+id_product).val(); - if (operator == 'up') { - $("#service_cart_price_"+id_cart_booking+"_"+id_product+"_input").show(); - $("#service_cart_price_"+id_cart_booking+"_"+id_product+"_txt").hide(); - } else { - $("#service_cart_price_"+id_cart_booking+"_"+id_product+"_input").hide(); - $("#service_cart_price_"+id_cart_booking+"_"+id_product+"_txt").show(); - } if (typeof(qty) == 'undefined') { qty = 1; } + + $(".loading_overlay").show(); $.ajax({ type: 'POST', headers: { @@ -1730,7 +1820,10 @@ showErrorMessage(jsonData.errors); } - } + }, + complete: function() { + $(".loading_overlay").hide(); + } }); } @@ -2293,8 +2386,7 @@ {addJsDefL name='max_children_txt'}{l s='Maximum children occupancy reached' js=1}{/addJsDefL} {addJsDefL name='no_children_allowed_txt'}{l s='Only adults can be accommodated' js=1}{/addJsDefL} {addJsDefL name='invalid_occupancy_txt'}{l s='Invalid occupancy(adults/children) found.' js=1}{/addJsDefL} - - + {addJsDefL name='error_found_txt'}{l s='Errors found' js=1}{/addJsDefL} {/strip}
diff --git a/admin/themes/default/template/controllers/orders/modals/_add_order_extra_services_tab_content.tpl b/admin/themes/default/template/controllers/orders/modals/_add_order_extra_services_tab_content.tpl new file mode 100644 index 000000000..4f91abc10 --- /dev/null +++ b/admin/themes/default/template/controllers/orders/modals/_add_order_extra_services_tab_content.tpl @@ -0,0 +1,170 @@ +{* +* Since 2010 Webkul. +* +* NOTICE OF LICENSE +* +* All right is reserved, +* Please go through this link for complete license : https://store.webkul.com/license.html +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade this module to newer +* versions in the future. If you wish to customize this module for your +* needs please refer to https://store.webkul.com/customisation-guidelines/ for more information. +* +* @author Webkul IN +* @copyright Since 2010 Webkul IN +* @license https://store.webkul.com/license.html +*} + +
+ {if $customServiceAllowed} +
+ + +
+
+ {/if} + {if isset($serviceProducts) && $serviceProducts} +
+ {assign var=roomCount value=1} +
+
+ {if isset($serviceProducts) && $serviceProducts} + + + + + + + + + + + + {foreach $serviceProducts as $product} + + + + + + + + {/foreach} + +
{l s='Name'}{l s='Quantity'}{l s='Unit Price (tax excl.)'}
+ + +

{$product['name']|escape:'html':'UTF-8'}

+
+ {if $product['auto_add_to_cart'] && $product['price_addition_type'] == Product::PRICE_ADDITION_TYPE_INDEPENDENT} + {l s='Convenience fee'} + {/if} + {if $product['auto_add_to_cart'] && $product['price_addition_type'] == Product::PRICE_ADDITION_TYPE_WITH_ROOM} + {l s='Auto added'} + {/if} + + {if $product.allow_multiple_quantity} +
+ +

+ {l s='Maximum allowed quantity: %s' sprintf=$product.max_quantity} +

+
+ {else} + -- + {/if} +
+ {if ($product.show_price && !isset($restricted_country_mode)) || isset($groups)} +
+ + {$cartCurrency->sign} + + + {if Product::PRICE_CALCULATION_METHOD_PER_DAY == $product['price_calculation_method']} + {l s='/ night'} + {/if} +
+ {/if} +
+ {/if} +
+
+
+ {/if} + + {if $customServiceAllowed} +
+
+
+
+ + +
+
+ +
+ {$cartCurrency->sign} + +
+
+
+
+
+ + +
+
+ +
+ + + + + + + +
+
+
+
+
+ + +
+ +
+ + +
+
+ +
+
+ {l s='Note: If auto added service is enabled, then tax of the booking\'s room type will be applicable.'} +
+
+ +
+
+ {/if} +
diff --git a/admin/themes/default/template/controllers/orders/modals/_extra_services_service_products_tab_content.tpl b/admin/themes/default/template/controllers/orders/modals/_extra_services_service_products_tab_content.tpl index 55cf67041..f9bd1718c 100644 --- a/admin/themes/default/template/controllers/orders/modals/_extra_services_service_products_tab_content.tpl +++ b/admin/themes/default/template/controllers/orders/modals/_extra_services_service_products_tab_content.tpl @@ -21,7 +21,9 @@ {if isset($orderEdit) && $orderEdit}
- + {if $customServiceAllowed} + + {/if}
@@ -159,79 +161,81 @@ -
-
-
- - -
-
- -
- {$currencySign} - -
-
-
-
-
- - -
-
- -
- - - - - - - -
-
-
-
-
- - -
- -
- - -
-
- {if $roomTypeTaxRuleGroupExist} + {if $customServiceAllowed} +
-
- {l s='Note: If auto added service is enabled, then tax of the booking\'s room type will be applicable.'} +
+ + +
+
+ +
+ {$currencySign} + +
- {/if} - - - - +
+
+ + +
+
+ +
+ + + + + + + +
+
+
+
+
+ + +
+ +
+ + +
+
+ {if $roomTypeTaxRuleGroupExist} +
+
+ {l s='Note: If auto added service is enabled, then tax of the booking\'s room type will be applicable.'} +
+
+ {/if} + + + + + {/if} {elseif isset($additionalServices) && $additionalServices} diff --git a/config/defines.inc.php b/config/defines.inc.php index 4a86b1930..3e319225f 100644 --- a/config/defines.inc.php +++ b/config/defines.inc.php @@ -26,7 +26,7 @@ /* Debug only */ if (!defined('_PS_MODE_DEV_')) { - define('_PS_MODE_DEV_', false); + define('_PS_MODE_DEV_', true); } /* Compatibility warning */ define('_PS_DISPLAY_COMPATIBILITY_WARNING_', false); diff --git a/controllers/admin/AdminCartsController.php b/controllers/admin/AdminCartsController.php index 04c7b91a3..23cb039b7 100644 --- a/controllers/admin/AdminCartsController.php +++ b/controllers/admin/AdminCartsController.php @@ -1064,84 +1064,107 @@ class AdminCartsControllerCore extends AdminController // Process to get extra demands of any room while order creation process form.tpl public function ajaxProcessGetRoomTypeCartDemands() { - $response = array('status' => false); - if ($idProduct = Tools::getValue('id_product')) { - if (($dateFrom = Tools::getValue('date_from')) - && ($dateTo = Tools::getValue('date_to')) - && ($idRoom = Tools::getValue('id_room')) - && ($idCart = Tools::getValue('id_cart')) - ) { - $objCartBookingData = new HotelCartBookingData(); - if ($selectedRoomDemands = $objCartBookingData->getCartExtraDemands( - $idCart, - $idProduct, - $idRoom, - $dateFrom, - $dateTo - )) { - // get room type additional demands - $objRoomDemands = new HotelRoomTypeDemand(); - if ($roomTypeDemands = $objRoomDemands->getRoomTypeDemands($idProduct)) { - foreach ($roomTypeDemands as &$demand) { - // if demand has advance options then set demand price as first advance option price. - if (isset($demand['adv_option']) && $demand['adv_option']) { - $demand['price'] = current($demand['adv_option'])['price']; - } + $response['hasError'] = false; + $response['errors'] = []; + if (($idProduct = Tools::getValue('id_product')) + && ($dateFrom = Tools::getValue('date_from')) + && ($dateTo = Tools::getValue('date_to')) + && ($idRoom = Tools::getValue('id_room')) + && ($idCart = Tools::getValue('id_cart')) + && ($idHotelCartBooking = Tools::getValue('id_hotel_cart_booking')) + ) { + $objCartBookingData = new HotelCartBookingData(); + if ($selectedRoomDemands = $objCartBookingData->getCartExtraDemands( + $idCart, + $idProduct, + $idRoom, + $dateFrom, + $dateTo + )) { + // get room type additional demands + $objRoomDemands = new HotelRoomTypeDemand(); + if ($roomTypeDemands = $objRoomDemands->getRoomTypeDemands($idProduct)) { + foreach ($roomTypeDemands as &$demand) { + // if demand has advance options then set demand price as first advance option price. + if (isset($demand['adv_option']) && $demand['adv_option']) { + $demand['price'] = current($demand['adv_option'])['price']; } - foreach ($selectedRoomDemands as &$selectedDemand) { - $objRoom = new HotelRoomInformation($selectedDemand['id_room']); - $selectedDemand['room_num'] = $objRoom->room_num; - if (isset($selectedDemand['extra_demands']) && $selectedDemand['extra_demands']) { - $extraDmd = array(); - foreach ($selectedDemand['extra_demands'] as $sDemand) { - $selectedDemand['selected_global_demands'][] = $sDemand['id_global_demand']; - $extraDmd[$sDemand['id_global_demand'].'-'.$sDemand['id_option']] = $sDemand; - } - $selectedDemand['extra_demands'] = $extraDmd; + } + foreach ($selectedRoomDemands as &$selectedDemand) { + $objRoom = new HotelRoomInformation($selectedDemand['id_room']); + $selectedDemand['room_num'] = $objRoom->room_num; + if (isset($selectedDemand['extra_demands']) && $selectedDemand['extra_demands']) { + $extraDmd = array(); + foreach ($selectedDemand['extra_demands'] as $sDemand) { + $selectedDemand['selected_global_demands'][] = $sDemand['id_global_demand']; + $extraDmd[$sDemand['id_global_demand'].'-'.$sDemand['id_option']] = $sDemand; } + $selectedDemand['extra_demands'] = $extraDmd; } - $this->context->smarty->assign('roomTypeDemands', $roomTypeDemands); - $this->context->smarty->assign('selectedRoomDemands', $selectedRoomDemands); + } + $this->context->smarty->assign('roomTypeDemands', $roomTypeDemands); + $this->context->smarty->assign('selectedRoomDemands', $selectedRoomDemands); + } + } + + if (Configuration::get('PS_ALLOW_ADD_ALL_SERVICES_IN_BOOKING')) { + // get all services + $objProduct = new Product(); + $serviceProducts = $objProduct->getServiceProducts(); + } else { + $objRoomTypeServiceProduct = new RoomTypeServiceProduct(); + $serviceProducts = $objRoomTypeServiceProduct->getServiceProductsData($idProduct, 1, 0, false, 2, null); + } + + if ($serviceProducts) { + $objRoomTypeServPrice = new RoomTypeServiceProductPrice(); + foreach ($serviceProducts as $key => $servProduct) { + $serviceProducts[$key]['price_tax_exc'] = $objRoomTypeServPrice->getServicePrice($servProduct['id_product'], 0, 1, null, null, false, $idCart); + if ($additionalServices + && (in_array($servProduct['id_product'], array_column($additionalServices['additional_services'], 'id_product'))) + ) { + unset($serviceProducts[$key]); } } - $objRoomTypeServiceProduct = new RoomTypeServiceProduct(); - $objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail(); - $roomTypeServiceProducts = $objRoomTypeServiceProduct->getServiceProductsData($idProduct, 1, 0, false, 2, null); - if ($selectedRoomServiceProduct = $objCartBookingData->getRoomRowByIdProductIdRoomInDateRange( - $idCart, - $idProduct, - $dateFrom, - $dateTo, - $idRoom - )) { - $selectedRoomServiceProduct['selected_service'] = $objRoomTypeServiceProductCartDetail->getRoomServiceProducts( - $selectedRoomServiceProduct['id'], - 0, - null, - null - ); - } + } - $objCart = new Cart($idCart); - $cartCurrency = new Currency($objCart->id_currency); - $this->context->smarty->assign(array( - 'cartCurrency' => $cartCurrency, - 'roomTypeServiceProducts' => $roomTypeServiceProducts, - 'selectedRoomServiceProduct' => $selectedRoomServiceProduct - )); - $htlCartBoookingata = $objCartBookingData->getRoomRowByIdProductIdRoomInDateRange( - $idCart, - $idProduct, - $dateFrom, - $dateTo, - $idRoom + if ($selectedRoomServiceProduct = $objCartBookingData->getRoomRowByIdProductIdRoomInDateRange( + $idCart, + $idProduct, + $dateFrom, + $dateTo, + $idRoom + )) { + $objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail(); + $selectedRoomServiceProduct['selected_service'] = $objRoomTypeServiceProductCartDetail->getRoomServiceProducts( + $selectedRoomServiceProduct['id'], + 0, + null, + null ); } + + $objCart = new Cart($idCart); + $cartCurrency = new Currency($objCart->id_currency); + $taxRulesGroups = TaxRulesGroup::getTaxRulesGroups(true); + $this->context->smarty->assign(array( + 'taxRulesGroups' => $taxRulesGroups, + 'id_hotel_cart_booking' => $idHotelCartBooking, + 'cartCurrency' => $cartCurrency, + 'serviceProducts' => $serviceProducts, + 'selectedRoomServiceProduct' => $selectedRoomServiceProduct, + 'customServiceAllowed' => Configuration::get('PS_ALLOW_CREATE_CUSTOM_SERVICES_IN_BOOKING'), + 'loaderImg' => $this->context->link->getMediaLink(_PS_IMG_.'admin/ajax-loader.gif') + )); + + $response['html_exta_demands'] = $this->context->smarty->fetch( + _PS_ADMIN_DIR_.'/themes/default/template/controllers/orders/_cart_booking_demands.tpl' + ); + } else { + $response['hasError'] = true; + $response['errors'][] = $this->l('Some error occurred. please try again.'); } - $response['status'] = true; - $response['html_exta_demands'] = $this->context->smarty->fetch( - _PS_ADMIN_DIR_.'/themes/default/template/controllers/orders/_cart_booking_demands.tpl' - ); + $this->ajaxDie(json_encode($response)); } @@ -1227,4 +1250,208 @@ class AdminCartsControllerCore extends AdminController $list = $helper->generateList($this->_list, $this->fields_list); return $list; } + + // Add new custom services to room + public function ajaxProcessAddNewRoomServices() + { + $response = array('hasError' => false); + // Check tab access is allowed to edit + if ($this->tabAccess['edit'] == 1) { + if (Configuration::get('PS_ALLOW_CREATE_CUSTOM_SERVICES_IN_BOOKING')) { + $idHotelCartBooking = Tools::getValue('id_hotel_cart_booking'); + // valiadate services being added + if (Validate::isLoadedObject($objHtlCartBooking = new HotelCartBookingData($idHotelCartBooking))) { + $name = Tools::getValue('new_service_name'); + $price = Tools::getValue('new_service_price'); + $priceCalcMethod = Tools::getValue('new_service_price_calc_method'); + $priceAdditionType = Tools::getValue('new_service_price_addition_type'); + $productQty = Tools::getValue('new_service_qty'); + $idTaxRuleGroup = Tools::getValue('new_service_price_tax_rule_group'); + $autoAdded = Tools::getValue('new_service_auto_added'); + + // adjust values for auto added services + if ($autoAdded) { + $productQty = 1; + $objRoomType = new Product($objHtlCartBooking->id_product); + if (Validate::isLoadedObject($objTaxRuleGroup = new TaxRulesGroup($objRoomType->id_tax_rules_group))) { + $idTaxRuleGroup = $objRoomType->id_tax_rules_group; + } + } else { + $priceAdditionType = 0; + if (empty($productQty)) { + $response['hasError'] = true; + $response['errors'][] = $this->l('Service quantity is required'); + } elseif (!Validate::isUnsignedInt($productQty)) { + $response['hasError'] = true; + $response['errors'][] = $this->l('Invalid service quantity'); + } + } + + // Validate service data provided + if (empty($name)) { + $response['hasError'] = true; + $response['errors'][] = $this->l('Service name is required'); + } elseif (!Validate::isCatalogName($name)) { + $response['hasError'] = true; + $response['errors'][] = $this->l('Invalid service name'); + } + + if (empty($price)) { + $response['hasError'] = true; + $response['errors'][] = $this->l('Service price is required'); + } elseif (!Validate::isPrice($price)) { + $response['hasError'] = true; + $response['errors'][] = $this->l('Invalid service price'); + } + + // if no validation errors then add service + if (!$response['hasError']) { + // ======= START: Create Service product ========= + $objServiceProduct = new Product(); + $objServiceProduct->price_calculation_method = $priceCalcMethod; + $objServiceProduct->service_product_type = Product::SERVICE_PRODUCT_WITH_ROOMTYPE; + $objServiceProduct->id_category_default = Configuration::get('PS_SERVICE_CATEGORY'); + $objServiceProduct->name[Configuration::get('PS_LANG_DEFAULT')] = $name; + $objServiceProduct->id_shop_default = Configuration::get('PS_SHOP_DEFAULT'); + $objServiceProduct->allow_multiple_quantity = !$autoAdded; + $objServiceProduct->id_tax_rules_group = $idTaxRuleGroup; + $objServiceProduct->price = $price; + $objServiceProduct->wholesale_price = 0; + $languages = Language::getLanguages(false); + foreach ($languages as $lang) { + $objServiceProduct->link_rewrite[$lang['id_lang']] = Tools::link_rewrite($name); + } + $objServiceProduct->available_for_order = true; + $objServiceProduct->show_price = true; + $objServiceProduct->is_virtual = true; + $objServiceProduct->auto_add_to_cart = $autoAdded; + $objServiceProduct->price_addition_type = $priceAdditionType; + $objServiceProduct->booking_product = false; + $objServiceProduct->show_at_front = false; + $objServiceProduct->indexed = false; + $objServiceProduct->minimal_quantity = 1; + $objServiceProduct->active = true; + $objServiceProduct->max_quantity = 99999; + + // ======= Create Service product END ========= + if ($objServiceProduct->save()) { + // If service product is create successfully the start adding the product in cart and order + $objCart = new Cart($objHtlCartBooking->id_cart); + $objServiceProduct = new Product($objServiceProduct->id, false, $objCart->id_lang); + + $objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail(); + if ($objRoomTypeServiceProductCartDetail->addServiceProductInCart( + $objServiceProduct->id, + $productQty, + $objCart->id, + $objHtlCartBooking->id + )) { + // Lets create a specific price for the service to match the price provided by the user + $objSpecificPrice = new SpecificPrice(); + $objSpecificPrice->id_shop = 0; + $objSpecificPrice->id_shop_group = 0; + $objSpecificPrice->id_cart = $objCart->id; + $objSpecificPrice->id_currency = $objCart->id_currency; + $objSpecificPrice->id_country = 0; + $objSpecificPrice->id_group = 0; + $objSpecificPrice->id_customer = $objCart->id_customer; + $objSpecificPrice->id_product = $objServiceProduct->id; + $objSpecificPrice->id_product_attribute = 0; + $objSpecificPrice->price = $price; + $objSpecificPrice->from_quantity = 1; + $objSpecificPrice->reduction = 0; + $objSpecificPrice->reduction_type = 'amount'; + $objSpecificPrice->reduction_tax = 0; + $objSpecificPrice->from = '0000-00-00 00:00:00'; + $objSpecificPrice->to = '0000-00-00 00:00:00'; + if ($objSpecificPrice->add()) { + $response['service_panel'] = $this->getBookingServicesTabContent($objHtlCartBooking->id); + } else { + $response['hasError'] = true; + $response['errors'][] = $this->l('Some error occurred while adding service to the room'); + } + } else { + $response['hasError'] = true; + $response['errors'][] = $this->l('Unable to add service to the room'); + } + } else { + $response['hasError'] = true; + $response['errors'][] = $this->l('Unable to add service to the room'); + } + } + } else { + $response['hasError'] = true; + $response['errors'][] = $this->l('Room not found'); + } + } else { + $response['hasError'] = true; + $response['errors'][] = $this->l('Adding a new custom service is not allowed.'); + } + } else { + $response['hasError'] = true; + $response['errors'][] = $this->l('You do not have permission to edit this order.'); + } + + die(json_encode($response)); + } + + public function getBookingServicesTabContent($idHotelCartBooking) + { + $servicesTpl = ''; + if (Validate::isLoadedObject($objCartBookingData = new HotelCartBookingData($idHotelCartBooking))) { + if (Configuration::get('PS_ALLOW_ADD_ALL_SERVICES_IN_BOOKING')) { + // get all services + $objProduct = new Product(); + $serviceProducts = $objProduct->getServiceProducts(); + } else { + $objRoomTypeServiceProduct = new RoomTypeServiceProduct(); + $serviceProducts = $objRoomTypeServiceProduct->getServiceProductsData($objCartBookingData->id_product, 1, 0, false, 2, null); + } + + if ($serviceProducts) { + foreach ($serviceProducts as $key => $servProduct) { + $serviceProducts[$key]['price_tax_exc'] = $servProduct['price']; + if ($additionalServices + && (in_array($servProduct['id_product'], array_column($additionalServices['additional_services'], 'id_product'))) + ) { + unset($serviceProducts[$key]); + } + } + } + + if ($selectedRoomServiceProduct = $objCartBookingData->getRoomRowByIdProductIdRoomInDateRange( + $objCartBookingData->id_cart, + $objCartBookingData->id_product, + $objCartBookingData->date_from, + $objCartBookingData->date_to, + $objCartBookingData->id_room + )) { + $objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail(); + $selectedRoomServiceProduct['selected_service'] = $objRoomTypeServiceProductCartDetail->getRoomServiceProducts( + $selectedRoomServiceProduct['id'], + 0, + null, + null + ); + } + + $objCart = new Cart($objCartBookingData->id_cart); + $cartCurrency = new Currency($objCart->id_currency); + $taxRulesGroups = TaxRulesGroup::getTaxRulesGroups(true); + $this->context->smarty->assign(array( + 'id_hotel_cart_booking' => $idHotelCartBooking, + 'taxRulesGroups' => $taxRulesGroups, + 'cartCurrency' => $cartCurrency, + 'serviceProducts' => $serviceProducts, + 'selectedRoomServiceProduct' => $selectedRoomServiceProduct, + 'customServiceAllowed' => Configuration::get('PS_ALLOW_CREATE_CUSTOM_SERVICES_IN_BOOKING'), + )); + + $servicesTpl = $this->context->smarty->fetch( + _PS_ADMIN_DIR_.'/themes/default/template/controllers/orders/modals/_add_order_extra_services_tab_content.tpl' + ); + } + + return $servicesTpl; + } } diff --git a/controllers/admin/AdminOrderPreferencesController.php b/controllers/admin/AdminOrderPreferencesController.php index 241ed1c29..5aff0476f 100644 --- a/controllers/admin/AdminOrderPreferencesController.php +++ b/controllers/admin/AdminOrderPreferencesController.php @@ -197,7 +197,7 @@ class AdminOrderPreferencesControllerCore extends AdminController 'type' => 'bool' ), 'PS_ORDER_LIST_PRICE_DISPLAY_CURRENCY' => array( - 'title' => $this->l('Display order list prices in'), + 'title' => $this->l('Display order list prices in Back Office'), 'hint' => $this->l('Choose the currency in which you want the prices in the order list to be displayed.'), 'desc' => $this->l('\'Order currency\' is the currency in which customer created the order and \'Default currency\' is the currency configured in localization.'), 'validation' => 'isInt', @@ -222,6 +222,20 @@ class AdminOrderPreferencesControllerCore extends AdminController 'class' => 'fixed-width-xl', 'suffix' => $this->l('day(s)'), ), + 'PS_ALLOW_ADD_ALL_SERVICES_IN_BOOKING' => array( + 'title' => $this->l('Allow to add all services in a booking'), + 'hint' => $this->l('Enable to allow all services created to be added in a booking while adding or editing a booking. Disable to allow only attached services with room type.'), + 'desc' => $this->l('If enabled, only attached services with room type will be available to be added to a booking.'), + 'cast' => 'intval', + 'type' => 'bool' + ), + 'PS_ALLOW_CREATE_CUSTOM_SERVICES_IN_BOOKING' => array( + 'title' => $this->l('Allow to create custom service for a booking'), + 'hint' => $this->l('Enable to allow to create custom service while adding or editing a booking.'), + 'desc' => $this->l('If disabled, a custom service can not be created while adding or editing a booking.'), + 'cast' => 'intval', + 'type' => 'bool' + ), ), 'submit' => array('title' => $this->l('Save')) ), diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index 1973eaf7c..237e31b4d 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -387,7 +387,8 @@ class AdminOrdersControllerCore extends AdminController $this->context->currency = new Currency((int)$cart->id_currency); // validate cart for removing invalid data from cart before new order creation - $this->errors = array_merge($this->errors, HotelCartBookingData::validateCartBookings()); + // remove not linked services with room types from cart if not allowed to book them + $this->errors = array_merge($this->errors, HotelCartBookingData::validateCartBookings(!Configuration::get('PS_ALLOW_ADD_ALL_SERVICES_IN_BOOKING'))); $cart_detail_data = array(); $cart_detail_data_obj = new HotelCartBookingData(); @@ -948,9 +949,16 @@ class AdminOrdersControllerCore extends AdminController $smartyVars['additionalServices'] = $additionalServices; } - // get all services - $objProduct = new Product(); - if ($serviceProducts = $objProduct->getServiceProducts()) { + if (Configuration::get('PS_ALLOW_ADD_ALL_SERVICES_IN_BOOKING')) { + // get all services + $objProduct = new Product(); + $serviceProducts = $objProduct->getServiceProducts(); + } else { + $objRoomTypeServiceProduct = new RoomTypeServiceProduct(); + $serviceProducts = $objRoomTypeServiceProduct->getServiceProductsData($idProduct, 1, 0, false, 2, null); + } + + if ($serviceProducts) { foreach ($serviceProducts as $key => $servProduct) { $serviceProducts[$key]['price_tax_exc'] = $servProduct['price']; if ($additionalServices @@ -959,10 +967,10 @@ class AdminOrdersControllerCore extends AdminController unset($serviceProducts[$key]); } } - - $smartyVars['serviceProducts'] = $serviceProducts; } + $smartyVars['serviceProducts'] = $serviceProducts; + $objOrderReturn = new OrderReturn(); $refundReqBookings = $objOrderReturn->getOrderRefundRequestedBookings($objOrder->id, 0, 1); $smartyVars['refundReqBookings'] = $refundReqBookings; @@ -978,6 +986,9 @@ class AdminOrdersControllerCore extends AdminController $taxRulesGroups = TaxRulesGroup::getTaxRulesGroups(true); $smartyVars['taxRulesGroups'] = $taxRulesGroups; + $smartyVars['customServiceAllowed'] = Configuration::get('PS_ALLOW_CREATE_CUSTOM_SERVICES_IN_BOOKING'); + + $this->context->smarty->assign($smartyVars); $modal = array( @@ -2781,9 +2792,9 @@ class AdminOrdersControllerCore extends AdminController $product['amount_refund'] = Tools::displayPrice($resume['amount_tax_incl'], $currency); // if the current stock requires a warning - if ($product['current_stock'] <= 0 && $display_out_of_stock_warning) { - $this->displayWarning($this->l('This booked room type is not found: ').' '.$product['product_name']); - } + // if ($product['current_stock'] <= 0 && $display_out_of_stock_warning) { + // $this->displayWarning($this->l('This booked room type is not found: ').' '.$product['product_name']); + // } if ($product['id_warehouse'] != 0) { $warehouse = new Warehouse((int)$product['id_warehouse']); $product['warehouse_name'] = $warehouse->name; @@ -6282,9 +6293,16 @@ class AdminOrdersControllerCore extends AdminController $smartyVars['orderEdit'] = $orderEdit; - // get room type additional demands - $objProduct = new Product(); - if ($serviceProducts = $objProduct->getServiceProducts()) { + if (Configuration::get('PS_ALLOW_ADD_ALL_SERVICES_IN_BOOKING')) { + // get all services + $objProduct = new Product(); + $serviceProducts = $objProduct->getServiceProducts(); + } else { + $objRoomTypeServiceProduct = new RoomTypeServiceProduct(); + $serviceProducts = $objRoomTypeServiceProduct->getServiceProductsData($idProduct, 1, 0, false, 2, null); + } + + if ($serviceProducts) { foreach ($serviceProducts as $key => $servProduct) { $serviceProducts[$key]['price_tax_exc'] = $servProduct['price']; if ($additionalServices @@ -6293,9 +6311,11 @@ class AdminOrdersControllerCore extends AdminController unset($serviceProducts[$key]); } } - $smartyVars['serviceProducts'] = $serviceProducts; } + $smartyVars['serviceProducts'] = $serviceProducts; + $smartyVars['customServiceAllowed'] = Configuration::get('PS_ALLOW_CREATE_CUSTOM_SERVICES_IN_BOOKING'); + // check if booking room type tax rule is still exist $objHotelBookingDetail = new HotelBookingDetail($idHtlBookingDetail); $objOrderDetail = new OrderDetail($objHotelBookingDetail->id_order_detail); @@ -6833,195 +6853,200 @@ class AdminOrdersControllerCore extends AdminController $response = array('hasError' => false); // Check tab access is allowed to edit if ($this->tabAccess['edit'] == 1) { - $idBookingDetail = Tools::getValue('id_booking_detail'); - // valiadate services being added - if (Validate::isLoadedObject($objHotelBookingDetail = new HotelBookingDetail($idBookingDetail))) { - $objHotelCartBookingData = new HotelCartBookingData(); - if ($roomHtlCartInfo = $objHotelCartBookingData->getRoomRowByIdProductIdRoomInDateRange( - $objHotelBookingDetail->id_cart, - $objHotelBookingDetail->id_product, - $objHotelBookingDetail->date_from, - $objHotelBookingDetail->date_to, - $objHotelBookingDetail->id_room - )) { - $name = Tools::getValue('new_service_name'); - $price = Tools::getValue('new_service_price'); - $priceCalcMethod = Tools::getValue('new_service_price_calc_method'); - $priceAdditionType = Tools::getValue('new_service_price_addition_type'); - $productQty = Tools::getValue('new_service_qty'); - $idTaxRuleGroup = Tools::getValue('new_service_price_tax_rule_group'); - $autoAdded = Tools::getValue('new_service_auto_added'); + if (Configuration::get('PS_ALLOW_CREATE_CUSTOM_SERVICES_IN_BOOKING')) { + $idBookingDetail = Tools::getValue('id_booking_detail'); + // valiadate services being added + if (Validate::isLoadedObject($objHotelBookingDetail = new HotelBookingDetail($idBookingDetail))) { + $objHotelCartBookingData = new HotelCartBookingData(); + if ($roomHtlCartInfo = $objHotelCartBookingData->getRoomRowByIdProductIdRoomInDateRange( + $objHotelBookingDetail->id_cart, + $objHotelBookingDetail->id_product, + $objHotelBookingDetail->date_from, + $objHotelBookingDetail->date_to, + $objHotelBookingDetail->id_room + )) { + $name = Tools::getValue('new_service_name'); + $price = Tools::getValue('new_service_price'); + $priceCalcMethod = Tools::getValue('new_service_price_calc_method'); + $priceAdditionType = Tools::getValue('new_service_price_addition_type'); + $productQty = Tools::getValue('new_service_qty'); + $idTaxRuleGroup = Tools::getValue('new_service_price_tax_rule_group'); + $autoAdded = Tools::getValue('new_service_auto_added'); - // adjust values for auto added services - if ($autoAdded) { - $productQty = 1; - // check if booking room type tax rule is still exist - $objOrderDetail = new OrderDetail($objHotelBookingDetail->id_order_detail); - if (Validate::isLoadedObject($objTaxRuleGroup = new TaxRulesGroup($objOrderDetail->id_tax_rules_group))) { - $idTaxRuleGroup = $objOrderDetail->id_tax_rules_group; + // adjust values for auto added services + if ($autoAdded) { + $productQty = 1; + // check if booking room type tax rule is still exist + $objOrderDetail = new OrderDetail($objHotelBookingDetail->id_order_detail); + if (Validate::isLoadedObject($objTaxRuleGroup = new TaxRulesGroup($objOrderDetail->id_tax_rules_group))) { + $idTaxRuleGroup = $objOrderDetail->id_tax_rules_group; + } + } else { + $priceAdditionType = 0; + if (empty($productQty)) { + $response['hasError'] = true; + $response['errors'][] = $this->l('Service quantity is required'); + } elseif (!Validate::isUnsignedInt($productQty)) { + $response['hasError'] = true; + $response['errors'][] = $this->l('Invalid service quantity'); + } } - } else { - $priceAdditionType = 0; - if (empty($productQty)) { + + // Validate service data provided + if (empty($name)) { $response['hasError'] = true; - $response['errors'][] = $this->l('Service quantity is required'); - } elseif (!Validate::isUnsignedInt($productQty)) { + $response['errors'][] = $this->l('Service name is required'); + } elseif (!Validate::isCatalogName($name)) { $response['hasError'] = true; - $response['errors'][] = $this->l('Invalid service quantity'); + $response['errors'][] = $this->l('Invalid service name'); } - } - // Validate service data provided - if (empty($name)) { - $response['hasError'] = true; - $response['errors'][] = $this->l('Service name is required'); - } elseif (!Validate::isCatalogName($name)) { - $response['hasError'] = true; - $response['errors'][] = $this->l('Invalid service name'); - } - - if (empty($price)) { - $response['hasError'] = true; - $response['errors'][] = $this->l('Service price is required'); - } elseif (!Validate::isPrice($price)) { - $response['hasError'] = true; - $response['errors'][] = $this->l('Invalid service price'); - } - - // if no validation errors then add service - if (!$response['hasError']) { - // ======= START: Create Service product ========= - $objServiceProduct = new Product(); - $objServiceProduct->price_calculation_method = $priceCalcMethod; - $objServiceProduct->service_product_type = Product::SERVICE_PRODUCT_WITH_ROOMTYPE; - $objServiceProduct->id_category_default = Configuration::get('PS_SERVICE_CATEGORY'); - $objServiceProduct->name[Configuration::get('PS_LANG_DEFAULT')] = $name; - $objServiceProduct->id_shop_default = Configuration::get('PS_SHOP_DEFAULT'); - $objServiceProduct->allow_multiple_quantity = !$autoAdded; - $objServiceProduct->id_tax_rules_group = $idTaxRuleGroup; - $objServiceProduct->price = $price; - $objServiceProduct->wholesale_price = 0; - $languages = Language::getLanguages(false); - foreach ($languages as $lang) { - $objServiceProduct->link_rewrite[$lang['id_lang']] = Tools::link_rewrite($name); + if (empty($price)) { + $response['hasError'] = true; + $response['errors'][] = $this->l('Service price is required'); + } elseif (!Validate::isPrice($price)) { + $response['hasError'] = true; + $response['errors'][] = $this->l('Invalid service price'); } - $objServiceProduct->available_for_order = true; - $objServiceProduct->show_price = true; - $objServiceProduct->is_virtual = true; - $objServiceProduct->auto_add_to_cart = $autoAdded; - $objServiceProduct->price_addition_type = $priceAdditionType; - $objServiceProduct->booking_product = false; - $objServiceProduct->show_at_front = false; - $objServiceProduct->indexed = false; - $objServiceProduct->minimal_quantity = 1; - $objServiceProduct->active = true; - // ======= Create Service product END ========= - if ($objServiceProduct->save()) { - // If service product is create successfully the start adding the product in cart and order - $objServiceProduct = new Product($objServiceProduct->id, false, $objOrder->id_lang); - $objOrder = new Order($objHotelBookingDetail->id_order); + // if no validation errors then add service + if (!$response['hasError']) { + // ======= START: Create Service product ========= + $objServiceProduct = new Product(); + $objServiceProduct->price_calculation_method = $priceCalcMethod; + $objServiceProduct->service_product_type = Product::SERVICE_PRODUCT_WITH_ROOMTYPE; + $objServiceProduct->id_category_default = Configuration::get('PS_SERVICE_CATEGORY'); + $objServiceProduct->name[Configuration::get('PS_LANG_DEFAULT')] = $name; + $objServiceProduct->id_shop_default = Configuration::get('PS_SHOP_DEFAULT'); + $objServiceProduct->allow_multiple_quantity = !$autoAdded; + $objServiceProduct->id_tax_rules_group = $idTaxRuleGroup; + $objServiceProduct->price = $price; + $objServiceProduct->wholesale_price = 0; + $languages = Language::getLanguages(false); + foreach ($languages as $lang) { + $objServiceProduct->link_rewrite[$lang['id_lang']] = Tools::link_rewrite($name); + } + $objServiceProduct->available_for_order = true; + $objServiceProduct->show_price = true; + $objServiceProduct->is_virtual = true; + $objServiceProduct->auto_add_to_cart = $autoAdded; + $objServiceProduct->price_addition_type = $priceAdditionType; + $objServiceProduct->booking_product = false; + $objServiceProduct->show_at_front = false; + $objServiceProduct->indexed = false; + $objServiceProduct->minimal_quantity = 1; + $objServiceProduct->active = true; - // Create new cart - $objCart = new Cart(); - $objCart->id_shop_group = $objOrder->id_shop_group; - $objCart->id_shop = $objOrder->id_shop; - $objCart->id_customer = $objOrder->id_customer; - $objCart->id_carrier = $objOrder->id_carrier; - $objCart->id_address_delivery = $objOrder->id_address_delivery; - $objCart->id_address_invoice = $objOrder->id_address_invoice; - $objCart->id_currency = $objOrder->id_currency; - $objCart->id_lang = $objOrder->id_lang; - $objCart->secure_key = $objOrder->secure_key; - if ($objCart->add()) { - $this->context->cart = $objCart; - $this->context->customer = new Customer($objOrder->id_customer); - // set context currency So that we can get prices in the order currency - $this->context->currency = new Currency($objOrder->id_currency); + // ======= Create Service product END ========= + if ($objServiceProduct->save()) { + // If service product is create successfully the start adding the product in cart and order + $objOrder = new Order($objHotelBookingDetail->id_order); + $objServiceProduct = new Product($objServiceProduct->id, false, $objOrder->id_lang); - $objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail(); - if ($objRoomTypeServiceProductCartDetail->addServiceProductInCart( - $objServiceProduct->id, - $productQty, - $objCart->id, - $roomHtlCartInfo['id'] - )) { - if ($productList = $objCart->getProducts()) { - $totalPriceChangeTaxExcl = 0; - $totalPriceChangeTaxIncl = 0; - $unitPriceTaxIncl = 0; - $unitPriceTaxExcl = 0; + // Create new cart + $objCart = new Cart(); + $objCart->id_shop_group = $objOrder->id_shop_group; + $objCart->id_shop = $objOrder->id_shop; + $objCart->id_customer = $objOrder->id_customer; + $objCart->id_carrier = $objOrder->id_carrier; + $objCart->id_address_delivery = $objOrder->id_address_delivery; + $objCart->id_address_invoice = $objOrder->id_address_invoice; + $objCart->id_currency = $objOrder->id_currency; + $objCart->id_lang = $objOrder->id_lang; + $objCart->secure_key = $objOrder->secure_key; + if ($objCart->add()) { + $this->context->cart = $objCart; + $this->context->customer = new Customer($objOrder->id_customer); + // set context currency So that we can get prices in the order currency + $this->context->currency = new Currency($objOrder->id_currency); - $objRoomTypeServiceProductPrice = new RoomTypeServiceProductPrice(); - $cartProductProcessed = 1; - $numDays = 1; - if (Product::getProductPriceCalculation($objServiceProduct->id) == Product::PRICE_CALCULATION_METHOD_PER_DAY) { - $numDays = HotelHelper::getNumberOfDays($objHotelBookingDetail->date_from, $objHotelBookingDetail->date_to); - } - foreach ($productList as &$product) { - // This is used to get the actual quanity of the service as it is calculated incorrectly if the service is per night - if ($idRoomTypeServProductCart = $objRoomTypeServiceProductCartDetail->alreadyExists( - $product['id_product'], - $objCart->id, - $roomHtlCartInfo['id']) - ) { - // Lets create a specific price for the service to match the price provided by the user - $objSpecificPrice = new SpecificPrice(); - $objSpecificPrice->id_shop = 0; - $objSpecificPrice->id_shop_group = 0; - $objSpecificPrice->id_cart = $objCart->id; - $objSpecificPrice->id_currency = $objOrder->id_currency; - $objSpecificPrice->id_country = 0; - $objSpecificPrice->id_group = 0; - $objSpecificPrice->id_customer = $objOrder->id_customer; - $objSpecificPrice->id_product = $objServiceProduct->id; - $objSpecificPrice->id_product_attribute = 0; - $objSpecificPrice->price = $price; - $objSpecificPrice->from_quantity = 1; - $objSpecificPrice->reduction = 0; - $objSpecificPrice->reduction_type = 'amount'; - $objSpecificPrice->reduction_tax = 0; - $objSpecificPrice->from = '0000-00-00 00:00:00'; - $objSpecificPrice->to = '0000-00-00 00:00:00'; - if ($objSpecificPrice->add()) { - if (Validate::isLoadedObject($objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail((int) $idRoomTypeServProductCart))) { - $unitPriceTaxExcl = $objRoomTypeServiceProductPrice->getServicePrice( - (int)$product['id_product'], - 0, - 1, - $objHotelBookingDetail->date_from, - $objHotelBookingDetail->date_to, - false, - $objCart->id - ) / $numDays; + $objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail(); + if ($objRoomTypeServiceProductCartDetail->addServiceProductInCart( + $objServiceProduct->id, + $productQty, + $objCart->id, + $roomHtlCartInfo['id'] + )) { + if ($productList = $objCart->getProducts()) { + $totalPriceChangeTaxExcl = 0; + $totalPriceChangeTaxIncl = 0; + $unitPriceTaxIncl = 0; + $unitPriceTaxExcl = 0; - $unitPriceTaxIncl = $objRoomTypeServiceProductPrice->getServicePrice( - (int)$product['id_product'], - 0, - 1, - $objHotelBookingDetail->date_from, - $objHotelBookingDetail->date_to, - true, - $objCart->id - ) / $numDays; + $objRoomTypeServiceProductPrice = new RoomTypeServiceProductPrice(); + $cartProductProcessed = 1; + $numDays = 1; + if (Product::getProductPriceCalculation($objServiceProduct->id) == Product::PRICE_CALCULATION_METHOD_PER_DAY) { + $numDays = HotelHelper::getNumberOfDays($objHotelBookingDetail->date_from, $objHotelBookingDetail->date_to); + } + foreach ($productList as &$product) { + // This is used to get the actual quanity of the service as it is calculated incorrectly if the service is per night + if ($idRoomTypeServProductCart = $objRoomTypeServiceProductCartDetail->alreadyExists( + $product['id_product'], + $objCart->id, + $roomHtlCartInfo['id']) + ) { + // Lets create a specific price for the service to match the price provided by the user + $objSpecificPrice = new SpecificPrice(); + $objSpecificPrice->id_shop = 0; + $objSpecificPrice->id_shop_group = 0; + $objSpecificPrice->id_cart = $objCart->id; + $objSpecificPrice->id_currency = $objOrder->id_currency; + $objSpecificPrice->id_country = 0; + $objSpecificPrice->id_group = 0; + $objSpecificPrice->id_customer = $objOrder->id_customer; + $objSpecificPrice->id_product = $objServiceProduct->id; + $objSpecificPrice->id_product_attribute = 0; + $objSpecificPrice->price = $price; + $objSpecificPrice->from_quantity = 1; + $objSpecificPrice->reduction = 0; + $objSpecificPrice->reduction_type = 'amount'; + $objSpecificPrice->reduction_tax = 0; + $objSpecificPrice->from = '0000-00-00 00:00:00'; + $objSpecificPrice->to = '0000-00-00 00:00:00'; + if ($objSpecificPrice->add()) { + if (Validate::isLoadedObject($objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail((int) $idRoomTypeServProductCart))) { + $unitPriceTaxExcl = $objRoomTypeServiceProductPrice->getServicePrice( + (int)$product['id_product'], + 0, + 1, + $objHotelBookingDetail->date_from, + $objHotelBookingDetail->date_to, + false, + $objCart->id + ) / $numDays; - $totalPriceChangeTaxExcl += $totalPriceTaxExcl = Tools::processPriceRounding( - ($unitPriceTaxExcl * $numDays), - $objRoomTypeServiceProductCartDetail->quantity, - $objOrder->round_type, - $objOrder->round_mode - ); - $totalPriceChangeTaxIncl += $totalPriceTaxIncl = Tools::processPriceRounding( - ($unitPriceTaxIncl * $numDays), - $objRoomTypeServiceProductCartDetail->quantity, - $objOrder->round_type, - $objOrder->round_mode - ); + $unitPriceTaxIncl = $objRoomTypeServiceProductPrice->getServicePrice( + (int)$product['id_product'], + 0, + 1, + $objHotelBookingDetail->date_from, + $objHotelBookingDetail->date_to, + true, + $objCart->id + ) / $numDays; - $product['total'] = $totalPriceTaxExcl; - $product['total_wt'] = $totalPriceTaxIncl; + $totalPriceChangeTaxExcl += $totalPriceTaxExcl = Tools::processPriceRounding( + ($unitPriceTaxExcl * $numDays), + $objRoomTypeServiceProductCartDetail->quantity, + $objOrder->round_type, + $objOrder->round_mode + ); + $totalPriceChangeTaxIncl += $totalPriceTaxIncl = Tools::processPriceRounding( + ($unitPriceTaxIncl * $numDays), + $objRoomTypeServiceProductCartDetail->quantity, + $objOrder->round_type, + $objOrder->round_mode + ); - $cartProductProcessed = 1; + $product['total'] = $totalPriceTaxExcl; + $product['total_wt'] = $totalPriceTaxIncl; + + $cartProductProcessed = 1; + } else { + $cartProductProcessed = 0; + break; + } } else { $cartProductProcessed = 0; break; @@ -7030,108 +7055,107 @@ class AdminOrdersControllerCore extends AdminController $cartProductProcessed = 0; break; } - } else { - $cartProductProcessed = 0; - break; - } - } - - // If all cart products processed then only we will proceed further - if ($cartProductProcessed) { - $objOrderInvoice = new OrderInvoice($objOrderDetail->id_order_invoice); - - // add in order detail table - $orderDetail = new OrderDetail(); - $orderDetail->createList($objOrder, $objCart, $objOrder->getCurrentOrderState(), $productList, (isset($objOrderInvoice) ? $objOrderInvoice->id : 0), true); - - // Add in room type service product order detail - $objRoomTypeServiceProductOrderDetail = new RoomTypeServiceProductOrderDetail(); - $objRoomTypeServiceProductOrderDetail->id_product = $objServiceProduct->id; - $objRoomTypeServiceProductOrderDetail->id_order = $objHotelBookingDetail->id_order; - $objRoomTypeServiceProductOrderDetail->id_order_detail = $orderDetail->id; - $objRoomTypeServiceProductOrderDetail->id_cart = $objCart->id; - $objRoomTypeServiceProductOrderDetail->id_htl_booking_detail = $objHotelBookingDetail->id; - $objRoomTypeServiceProductOrderDetail->unit_price_tax_excl = $unitPriceTaxExcl; - $objRoomTypeServiceProductOrderDetail->unit_price_tax_incl = $unitPriceTaxIncl; - $objRoomTypeServiceProductOrderDetail->total_price_tax_excl = $totalPriceTaxExcl; - $objRoomTypeServiceProductOrderDetail->total_price_tax_incl = $totalPriceTaxIncl; - $objRoomTypeServiceProductOrderDetail->name = $name; - $objRoomTypeServiceProductOrderDetail->quantity = $productQty; - $objRoomTypeServiceProductOrderDetail->auto_added = $autoAdded; - $objRoomTypeServiceProductOrderDetail->save(); - - // update totals amount of order - $objOrder->total_products = Tools::ps_round((float)($objOrder->total_products + $totalPriceChangeTaxExcl), _PS_PRICE_COMPUTE_PRECISION_); - $objOrder->total_products_wt = Tools::ps_round((float)($objOrder->total_products_wt + $totalPriceChangeTaxIncl), _PS_PRICE_COMPUTE_PRECISION_); - - $objOrder->total_paid = Tools::ps_round($objOrder->getOrderTotal(), _PS_PRICE_COMPUTE_PRECISION_); - $objOrder->total_paid_tax_incl = Tools::ps_round($objOrder->getOrderTotal(), _PS_PRICE_COMPUTE_PRECISION_); - $objOrder->total_paid_tax_excl = Tools::ps_round($objOrder->getOrderTotal(false), _PS_PRICE_COMPUTE_PRECISION_); - - // update invoice total - if (isset($objOrderInvoice) && Validate::isLoadedObject($objOrderInvoice)) { - $objOrderInvoice->total_paid_tax_excl += Tools::ps_round((float)$totalPriceChangeTaxExcl, _PS_PRICE_COMPUTE_PRECISION_); - $objOrderInvoice->total_paid_tax_incl += Tools::ps_round((float)$totalPriceChangeTaxIncl, _PS_PRICE_COMPUTE_PRECISION_); - $objOrderInvoice->save(); } - // discounts calculation for order - $objOrder->total_discounts += (float)abs($objCart->getOrderTotal(true, Cart::ONLY_DISCOUNTS)); - $objOrder->total_discounts_tax_excl += (float)abs($objCart->getOrderTotal(false, Cart::ONLY_DISCOUNTS)); - $objOrder->total_discounts_tax_incl += (float)abs($objCart->getOrderTotal(true, Cart::ONLY_DISCOUNTS)); + // If all cart products processed then only we will proceed further + if ($cartProductProcessed) { + $objOrderInvoice = new OrderInvoice($objOrderDetail->id_order_invoice); - // Save changes of order - if ($objOrder->update()) { - $response['service_panel'] = $this->processRenderServicesPanel( - $objOrder->id, - $objHotelBookingDetail->id_product, - $objHotelBookingDetail->date_from, - $objHotelBookingDetail->date_to, - $objHotelBookingDetail->id_room, - $objHotelBookingDetail->id, - true - ); + // add in order detail table + $orderDetail = new OrderDetail(); + $orderDetail->createList($objOrder, $objCart, $objOrder->getCurrentOrderState(), $productList, (isset($objOrderInvoice) ? $objOrderInvoice->id : 0), true); + + // Add in room type service product order detail + $objRoomTypeServiceProductOrderDetail = new RoomTypeServiceProductOrderDetail(); + $objRoomTypeServiceProductOrderDetail->id_product = $objServiceProduct->id; + $objRoomTypeServiceProductOrderDetail->id_order = $objHotelBookingDetail->id_order; + $objRoomTypeServiceProductOrderDetail->id_order_detail = $orderDetail->id; + $objRoomTypeServiceProductOrderDetail->id_cart = $objCart->id; + $objRoomTypeServiceProductOrderDetail->id_htl_booking_detail = $objHotelBookingDetail->id; + $objRoomTypeServiceProductOrderDetail->unit_price_tax_excl = $unitPriceTaxExcl; + $objRoomTypeServiceProductOrderDetail->unit_price_tax_incl = $unitPriceTaxIncl; + $objRoomTypeServiceProductOrderDetail->total_price_tax_excl = $totalPriceTaxExcl; + $objRoomTypeServiceProductOrderDetail->total_price_tax_incl = $totalPriceTaxIncl; + $objRoomTypeServiceProductOrderDetail->name = $name; + $objRoomTypeServiceProductOrderDetail->quantity = $productQty; + $objRoomTypeServiceProductOrderDetail->auto_added = $autoAdded; + $objRoomTypeServiceProductOrderDetail->save(); + + // update totals amount of order + $objOrder->total_products = Tools::ps_round((float)($objOrder->total_products + $totalPriceChangeTaxExcl), _PS_PRICE_COMPUTE_PRECISION_); + $objOrder->total_products_wt = Tools::ps_round((float)($objOrder->total_products_wt + $totalPriceChangeTaxIncl), _PS_PRICE_COMPUTE_PRECISION_); + + $objOrder->total_paid = Tools::ps_round($objOrder->getOrderTotal(), _PS_PRICE_COMPUTE_PRECISION_); + $objOrder->total_paid_tax_incl = Tools::ps_round($objOrder->getOrderTotal(), _PS_PRICE_COMPUTE_PRECISION_); + $objOrder->total_paid_tax_excl = Tools::ps_round($objOrder->getOrderTotal(false), _PS_PRICE_COMPUTE_PRECISION_); + + // update invoice total + if (isset($objOrderInvoice) && Validate::isLoadedObject($objOrderInvoice)) { + $objOrderInvoice->total_paid_tax_excl += Tools::ps_round((float)$totalPriceChangeTaxExcl, _PS_PRICE_COMPUTE_PRECISION_); + $objOrderInvoice->total_paid_tax_incl += Tools::ps_round((float)$totalPriceChangeTaxIncl, _PS_PRICE_COMPUTE_PRECISION_); + $objOrderInvoice->save(); + } + + // discounts calculation for order + $objOrder->total_discounts += (float)abs($objCart->getOrderTotal(true, Cart::ONLY_DISCOUNTS)); + $objOrder->total_discounts_tax_excl += (float)abs($objCart->getOrderTotal(false, Cart::ONLY_DISCOUNTS)); + $objOrder->total_discounts_tax_incl += (float)abs($objCart->getOrderTotal(true, Cart::ONLY_DISCOUNTS)); + + // Save changes of order + if ($objOrder->update()) { + $response['service_panel'] = $this->processRenderServicesPanel( + $objOrder->id, + $objHotelBookingDetail->id_product, + $objHotelBookingDetail->date_from, + $objHotelBookingDetail->date_to, + $objHotelBookingDetail->id_room, + $objHotelBookingDetail->id, + true + ); + } else { + $response['hasError'] = true; + $response['errors'][] = $this->l('Some error occurred while updating the order'); + } + + // at last delete the specific price created for the service + if (Validate::isLoadedObject($objSpecificPrice)) { + $objSpecificPrice->delete(); + unset($objSpecificPrice); + } } else { $response['hasError'] = true; - $response['errors'][] = $this->l('Some error occurred while updating the order1'); + $response['errors'][] = $this->l('Some error occurred while updating the order'); } - - // at last delete the specific price created for the service - if (Validate::isLoadedObject($objSpecificPrice)) { - $objSpecificPrice->delete(); - unset($objSpecificPrice); - } - - // at last delete the created service - $objServiceProduct->delete(); } else { $response['hasError'] = true; - $response['errors'][] = $this->l('Some error occurred while updating the order11'); + $response['errors'][] = $this->l('Unable to add service to the room'); } } else { $response['hasError'] = true; - $response['errors'][] = $this->l('Unable to add service to the room1'); + $response['errors'][] = $this->l('Unable to add service to the room'); } } else { $response['hasError'] = true; - $response['errors'][] = $this->l('Unable to add service to the room11'); + $response['errors'][] = $this->l('Unable to add service to the room'); } } else { $response['hasError'] = true; - $response['errors'][] = $this->l('Unable to add service to the room111'); + $response['errors'][] = $this->l('Unable to add service to the room'); } - } else { - $response['hasError'] = true; - $response['errors'][] = $this->l('Unable to add service to the room1111'); + // at last delete the created service + $objServiceProduct->delete(); } + } else { + $response['hasError'] = true; + $response['errors'][] = $this->l('Unable to add service to the room'); } } else { $response['hasError'] = true; - $response['errors'][] = $this->l('Unable to add service to the room11111'); + $response['errors'][] = $this->l('Room not found'); } } else { $response['hasError'] = true; - $response['errors'][] = $this->l('Room not found'); + $response['errors'][] = $this->l('Adding a new custom service is not allowed.'); } } else { $response['hasError'] = true; @@ -7442,28 +7466,23 @@ class AdminOrdersControllerCore extends AdminController $objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail(); if ($operator == 'up') { - $objRoomTypeServiceProduct = new RoomTypeServiceProduct(); - if ($objRoomTypeServiceProduct->isRoomTypeLinkedWithProduct($objHotelCartBookingData->id_product, $idServiceProduct)) { - // validate quanitity - if (Validate::isLoadedObject($objProduct = new Product($idServiceProduct))) { - if ($objProduct->allow_multiple_quantity) { - if (!Validate::isUnsignedInt($qty)) { - $this->errors[] = Tools::displayError('The quantity you\'ve entered is invalid.'); - // } elseif ($objProduct->max_quantity && $qty > $objProduct->max_quantity) { - // $this->errors[] = Tools::displayError(sprintf('cannot add more than %d quantity.', $objProduct->max_quantity)); - } - } else { - $qty = 1; - } - // validate price - if ($price && !ValidateCore::isPrice($price)) { - $this->errors[] = Tools::displayError('Invalid service unit price.'); + // validate quanitity + if (Validate::isLoadedObject($objProduct = new Product($idServiceProduct))) { + if ($objProduct->allow_multiple_quantity) { + if (!Validate::isUnsignedInt($qty)) { + $this->errors[] = Tools::displayError('The quantity you\'ve entered is invalid.'); + // } elseif ($objProduct->max_quantity && $qty > $objProduct->max_quantity) { + // $this->errors[] = Tools::displayError(sprintf('cannot add more than %d quantity.', $objProduct->max_quantity)); } } else { - $this->errors[] = Tools::displayError('This Service is not available.'); + $qty = 1; + } + // validate price + if ($price && !ValidateCore::isPrice($price)) { + $this->errors[] = Tools::displayError('Invalid service unit price.'); } } else { - $this->errors[] = Tools::displayError('This Service is not available with selected room.'); + $this->errors[] = Tools::displayError('This Service is not available.'); } } diff --git a/install/data/xml/configuration.xml b/install/data/xml/configuration.xml index 490e2b691..139a9e920 100644 --- a/install/data/xml/configuration.xml +++ b/install/data/xml/configuration.xml @@ -230,6 +230,12 @@ 1 + + 1 + + + 1 + 0 diff --git a/modules/hotelreservationsystem/classes/HotelCartBookingData.php b/modules/hotelreservationsystem/classes/HotelCartBookingData.php index 0cd9c678d..5647f8890 100644 --- a/modules/hotelreservationsystem/classes/HotelCartBookingData.php +++ b/modules/hotelreservationsystem/classes/HotelCartBookingData.php @@ -929,7 +929,7 @@ class HotelCartBookingData extends ObjectModel } // validate cart data if not available then remove from cart - public static function validateCartBookings() + public static function validateCartBookings($checkServiceRoomLink = true) { $context = Context::getContext(); $errors = array(); @@ -965,7 +965,7 @@ class HotelCartBookingData extends ObjectModel } else { if (!$product->active) { $objRoomTypeServiceProductCartDetail->removeServiceProductByIdHtlCartBooking($service['htl_cart_booking_id'], $service['id_product']); - } else { + } elseif ($checkServiceRoomLink) { if (!$objRoomTypeServiceProduct->isRoomTypeLinkedWithProduct($service['id_product_room_type'], $service['id_product'])) { $objRoomTypeServiceProductCartDetail->removeServiceProductByIdHtlCartBooking($service['htl_cart_booking_id'], $service['id_product']); } From 7d638ad08d61a9ae9926291bfa6cafd74e23ba8a Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Mon, 24 Feb 2025 18:44:56 +0530 Subject: [PATCH 05/29] Testing issues resolved in Service product add while adding or editing a booking --- .../controllers/orders/_cart_booking_demands.tpl | 11 +++++------ .../default/template/controllers/orders/form.tpl | 6 ++---- .../_extra_services_service_products_tab_content.tpl | 4 ++-- config/defines.inc.php | 2 +- controllers/admin/AdminCartsController.php | 2 +- controllers/admin/AdminOrderPreferencesController.php | 2 +- controllers/admin/AdminOrdersController.php | 2 +- 7 files changed, 13 insertions(+), 16 deletions(-) diff --git a/admin/themes/default/template/controllers/orders/_cart_booking_demands.tpl b/admin/themes/default/template/controllers/orders/_cart_booking_demands.tpl index 4db298378..e2e384fc2 100644 --- a/admin/themes/default/template/controllers/orders/_cart_booking_demands.tpl +++ b/admin/themes/default/template/controllers/orders/_cart_booking_demands.tpl @@ -101,13 +101,12 @@ {include file='controllers/orders/modals/_add_order_extra_services_tab_content.tpl'} + {if isset($loaderImg) && $loaderImg} +
+ +
+ {/if} - - {if isset($loaderImg) && $loaderImg} -
- -
- {/if} diff --git a/admin/themes/default/template/controllers/orders/form.tpl b/admin/themes/default/template/controllers/orders/form.tpl index 0cc2edc0b..a8b5fa0ab 100644 --- a/admin/themes/default/template/controllers/orders/form.tpl +++ b/admin/themes/default/template/controllers/orders/form.tpl @@ -1641,11 +1641,11 @@ }); // when the price of a service product is changed and focus is out - $(document).on('change', '.service_cart_price_input', function() { + $(document).on('change', '#room_type_services_desc .service_cart_price_input', function() { updateServiceProducts(this); }); - $(document).on('focusout', '#rooms_type_extra_demands .qty', function(e) { + $(document).on('change', '#rooms_type_extra_demands .qty', function(e) { var qty_wntd = $(this).val(); if (qty_wntd == '' || !$.isNumeric(qty_wntd)) { $(this).val(1); @@ -1818,14 +1818,12 @@ showSuccessMessage(txtExtraDemandSucc); } else { showErrorMessage(jsonData.errors); - } }, complete: function() { $(".loading_overlay").hide(); } }); - } }); diff --git a/admin/themes/default/template/controllers/orders/modals/_extra_services_service_products_tab_content.tpl b/admin/themes/default/template/controllers/orders/modals/_extra_services_service_products_tab_content.tpl index f9bd1718c..cd6b39e74 100644 --- a/admin/themes/default/template/controllers/orders/modals/_extra_services_service_products_tab_content.tpl +++ b/admin/themes/default/template/controllers/orders/modals/_extra_services_service_products_tab_content.tpl @@ -229,11 +229,11 @@ {/if} + + - - {/if} diff --git a/config/defines.inc.php b/config/defines.inc.php index 3e319225f..4a86b1930 100644 --- a/config/defines.inc.php +++ b/config/defines.inc.php @@ -26,7 +26,7 @@ /* Debug only */ if (!defined('_PS_MODE_DEV_')) { - define('_PS_MODE_DEV_', true); + define('_PS_MODE_DEV_', false); } /* Compatibility warning */ define('_PS_DISPLAY_COMPATIBILITY_WARNING_', false); diff --git a/controllers/admin/AdminCartsController.php b/controllers/admin/AdminCartsController.php index 23cb039b7..6d8dc6e27 100644 --- a/controllers/admin/AdminCartsController.php +++ b/controllers/admin/AdminCartsController.php @@ -1330,7 +1330,7 @@ class AdminCartsControllerCore extends AdminController $objServiceProduct->show_at_front = false; $objServiceProduct->indexed = false; $objServiceProduct->minimal_quantity = 1; - $objServiceProduct->active = true; + $objServiceProduct->active = false; $objServiceProduct->max_quantity = 99999; // ======= Create Service product END ========= diff --git a/controllers/admin/AdminOrderPreferencesController.php b/controllers/admin/AdminOrderPreferencesController.php index 5aff0476f..b434e368b 100644 --- a/controllers/admin/AdminOrderPreferencesController.php +++ b/controllers/admin/AdminOrderPreferencesController.php @@ -225,7 +225,7 @@ class AdminOrderPreferencesControllerCore extends AdminController 'PS_ALLOW_ADD_ALL_SERVICES_IN_BOOKING' => array( 'title' => $this->l('Allow to add all services in a booking'), 'hint' => $this->l('Enable to allow all services created to be added in a booking while adding or editing a booking. Disable to allow only attached services with room type.'), - 'desc' => $this->l('If enabled, only attached services with room type will be available to be added to a booking.'), + 'desc' => $this->l('If disabled, only attached services with room type will be available to be added to a booking.'), 'cast' => 'intval', 'type' => 'bool' ), diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index 1d475dc69..9d10c73c3 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -7479,7 +7479,7 @@ class AdminOrdersControllerCore extends AdminController $qty = 1; } // validate price - if ($price && !ValidateCore::isPrice($price)) { + if (!ValidateCore::isPrice($price)) { $this->errors[] = Tools::displayError('Invalid service unit price.'); } } else { From 07dc47727e9d9e221948262652ba65765937684c Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Tue, 25 Feb 2025 19:55:50 +0530 Subject: [PATCH 06/29] Updated: Selected services in booking will not individually updated but updated together with update button --- .../template/controllers/orders/form.tpl | 2 +- ..._services_service_products_tab_content.tpl | 139 ++--- controllers/admin/AdminCartsController.php | 108 ++++ controllers/admin/AdminOrdersController.php | 521 ++++++++---------- .../admin/AdminPPreferencesController.php | 2 +- js/admin/orders.js | 100 ++-- 6 files changed, 445 insertions(+), 427 deletions(-) diff --git a/admin/themes/default/template/controllers/orders/form.tpl b/admin/themes/default/template/controllers/orders/form.tpl index a8b5fa0ab..abfb41c1b 100644 --- a/admin/themes/default/template/controllers/orders/form.tpl +++ b/admin/themes/default/template/controllers/orders/form.tpl @@ -1801,7 +1801,7 @@ headers: { "cache-control": "no-cache" }, - url: "{$link->getAdminLink('AdminOrders')|addslashes}", + url: "{$link->getAdminLink('AdminCarts')|addslashes}", dataType: 'JSON', cache: false, data: { diff --git a/admin/themes/default/template/controllers/orders/modals/_extra_services_service_products_tab_content.tpl b/admin/themes/default/template/controllers/orders/modals/_extra_services_service_products_tab_content.tpl index cd6b39e74..01bfc973e 100644 --- a/admin/themes/default/template/controllers/orders/modals/_extra_services_service_products_tab_content.tpl +++ b/admin/themes/default/template/controllers/orders/modals/_extra_services_service_products_tab_content.tpl @@ -32,72 +32,81 @@ {* Already selected room services *}
-
- - - - - - - - - - - - {if isset($additionalServices) && $additionalServices} - {foreach $additionalServices['additional_services'] as $service} - - - - - - - - - {/foreach} - {else} - - - - {/if} - -
{l s='Name'}{l s='Quantity'}{l s='Unit Price (tax excl.)'}{l s='Total Price (tax excl.)'}{l s='Action'}
-
{$service['name']|escape:'html':'UTF-8'}
-
- {if $service['product_auto_add'] && $service['product_price_addition_type'] == Product::PRICE_ADDITION_TYPE_WITH_ROOM} - {l s='Auto added'}
- {/if} - {if $service['product_auto_add'] && $service['product_price_addition_type'] == Product::PRICE_ADDITION_TYPE_INDEPENDENT} - {l s='Convenience fee'} - {/if} -
- {if $service['allow_multiple_quantity']} -
- - {if $service['max_quantity']} -

- {l s='Maximum allowed quantity: %s' sprintf=$service['max_quantity']} -

- {/if} -
- {else} - -- - {/if} -
-
- {$currencySign} - - {if Product::PRICE_CALCULATION_METHOD_PER_DAY == $service.product_price_calculation_method} - {l s='/ night'} - {/if} -
- {* {if $service['product_price_calculation_method'] == Product::PRICE_CALCULATION_METHOD_PER_DAY} - {l s='/ night'} - {/if} *} -
{displayPrice price=$service['total_price_tax_excl']|escape:'html':'UTF-8' currency=$orderCurrency}
- {l s='No services added yet.'} -
+
+ + + + + + + + + + + + + {if isset($additionalServices) && $additionalServices} + {foreach $additionalServices['additional_services'] as $service} + + + + + + + + + {/foreach} + {else} + + + + {/if} + +
{l s='Name'}{l s='Quantity'}{l s='Unit Price (tax excl.)'}{l s='Total Price (tax excl.)'}{l s='Action'}
+
{$service['name']|escape:'html':'UTF-8'}
+ +
+ {if $service['product_auto_add'] && $service['product_price_addition_type'] == Product::PRICE_ADDITION_TYPE_WITH_ROOM} + {l s='Auto added'}
+ {/if} + {if $service['product_auto_add'] && $service['product_price_addition_type'] == Product::PRICE_ADDITION_TYPE_INDEPENDENT} + {l s='Convenience fee'} + {/if} +
+ {if $service['allow_multiple_quantity']} +
+ + {if $service['max_quantity']} +

+ {l s='Maximum allowed quantity: %s' sprintf=$service['max_quantity']} +

+ {/if} +
+ {else} + -- + {/if} +
+
+ {$currencySign} + + {if Product::PRICE_CALCULATION_METHOD_PER_DAY == $service.product_price_calculation_method} + {l s='/ night'} + {/if} +
+ {* {if $service['product_price_calculation_method'] == Product::PRICE_CALCULATION_METHOD_PER_DAY} + {l s='/ night'} + {/if} *} +
{displayPrice price=$service['total_price_tax_excl']|escape:'html':'UTF-8' currency=$orderCurrency}
+ {l s='No services added yet.'} +
+ + +
+ + {* add already available service interface *}
{if isset($serviceProducts) && $serviceProducts} diff --git a/controllers/admin/AdminCartsController.php b/controllers/admin/AdminCartsController.php index 6d8dc6e27..efae86aea 100644 --- a/controllers/admin/AdminCartsController.php +++ b/controllers/admin/AdminCartsController.php @@ -1454,4 +1454,112 @@ class AdminCartsControllerCore extends AdminController return $servicesTpl; } + + + public function ajaxProcessUpdateServiceProduct() + { + $operator = Tools::getValue('operator', 'up'); + $idServiceProduct = Tools::getValue('id_product'); + $idCartBooking = Tools::getValue('id_cart_booking'); + $qty = Tools::getValue('qty'); + $price = Tools::getValue('price'); + + if (Validate::isLoadedObject($objHotelCartBookingData = new HotelCartBookingData($idCartBooking))) { + $objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail(); + + if ($operator == 'up') { + // validate quanitity + if (Validate::isLoadedObject($objProduct = new Product($idServiceProduct))) { + if ($objProduct->allow_multiple_quantity) { + if (!Validate::isUnsignedInt($qty)) { + $this->errors[] = Tools::displayError('The quantity you\'ve entered is invalid.'); + // } elseif ($objProduct->max_quantity && $qty > $objProduct->max_quantity) { + // $this->errors[] = Tools::displayError(sprintf('cannot add more than %d quantity.', $objProduct->max_quantity)); + } + } else { + $qty = 1; + } + // validate price + if (!ValidateCore::isPrice($price)) { + $this->errors[] = Tools::displayError('Invalid service unit price.'); + } + } else { + $this->errors[] = Tools::displayError('This Service is not available.'); + } + } + + if (empty($this->errors)) { + if ($objRoomTypeServiceProductCartDetail->updateCartServiceProduct( + $idCartBooking, + $idServiceProduct, + $qty, + $objHotelCartBookingData->id_cart, + $operator + )) { + $objCart = new Cart($objHotelCartBookingData->id_cart); + $originalPrice = Product::getPriceStatic($idServiceProduct, false); + // if price is different than the original service price then update the price + if ($operator == 'up' && $originalPrice != $price) { + if ($specificPriceInfo = SpecificPrice::getSpecificPrice( + (int)$idServiceProduct, + 0, + $objCart->id_currency, + 0, + 0, + 1, + 0, + $objCart->id_customer, + $objCart->id + )) { + $objSpecificPrice = new SpecificPrice($specificPriceInfo['id_specific_price']); + } else { + $objSpecificPrice = new SpecificPrice(); + } + $objSpecificPrice->id_shop = 0; + $objSpecificPrice->id_shop_group = 0; + $objSpecificPrice->id_cart = $objCart->id; + $objSpecificPrice->id_currency = $objCart->id_currency; + $objSpecificPrice->id_country = 0; + $objSpecificPrice->id_group = 0; + $objSpecificPrice->id_customer = $objCart->id_customer; + $objSpecificPrice->id_product = $idServiceProduct; + $objSpecificPrice->id_product_attribute = 0; + $objSpecificPrice->price = $price; + $objSpecificPrice->from_quantity = 1; + $objSpecificPrice->reduction = 0; + $objSpecificPrice->reduction_type = 'amount'; + $objSpecificPrice->reduction_tax = 0; + $objSpecificPrice->from = '0000-00-00 00:00:00'; + $objSpecificPrice->to = '0000-00-00 00:00:00'; + if ($objSpecificPrice->save()) { + $this->ajaxDie(json_encode(array( + 'hasError' => false + ))); + } else { + $this->errors[] = Tools::displayError('Some error has been occurred. Please try reloading the page.'); + } + } else { + // delete specific price if price is same as original price + if (SpecificPrice::deleteByIdCart($objCart->id, $idServiceProduct)) { + $this->ajaxDie(json_encode(array( + 'hasError' => false, + 'down' => 1, + ))); + } else { + $this->errors[] = Tools::displayError('Unable to update services. Please try reloading the page.'); + } + } + } else { + $this->errors[] = Tools::displayError('Unable to update services. Please try reloading the page.'); + } + + } + } else { + $this->errors[] = Tools::displayError('Room not found. Please try reloading the page.'); + } + $this->ajaxDie(json_encode(array( + 'hasError' => true, + 'errors' => $this->errors + ))); + } } diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index 9d10c73c3..39f2ba0d6 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -6395,214 +6395,154 @@ class AdminOrdersControllerCore extends AdminController return $servicesTpl; } - public function ajaxProcessUpdateRoomAdditionalServices() + public function ajaxProcessUpdateSelectedRoomServices() { $response = array('hasError' => false); // Check tab access is allowed to edit if ($this->tabAccess['edit'] == 1) { - $id_room_type_service_product_order_detail = Tools::getValue('id_room_type_service_product_order_detail'); - $quantity = Tools::getValue('qty'); - $unitPrice = Tools::getValue('unit_price'); + if ($selectedServicesOrderDetails = Tools::getValue('id_service_product_order_detail')) { + $serviceQuantities = Tools::getValue('service_qty'); + $serviceUnitPrices = Tools::getValue('service_price'); - if (Validate::isLoadedObject($objRoomTypeServiceProductOrderDetail = new RoomTypeServiceProductOrderDetail($id_room_type_service_product_order_detail))) { - $objOrderDetail = new OrderDetail($objRoomTypeServiceProductOrderDetail->id_order_detail); - if (!$objOrderDetail->product_allow_multiple_quantity && $quantity > 1) { - $response['hasError'] = true; - $response['errors'] = $this->l('cannot order multiple quanitity for this service'); - } else if (!Validate::isUnsignedInt($quantity)) { - $response['hasError'] = true; - $response['errors'] = $this->l('Invalid quantity provided'); - } - - if (!ValidateCore::isPrice($unitPrice)) { - $response['hasError'] = true; - $response['errors'] = $this->l('Invalid unit price'); - } - - $objHotelBookingDetail = new HotelBookingDetail($objRoomTypeServiceProductOrderDetail->id_htl_booking_detail); - $res = true; - if (!$response['hasError']) { - $order = new Order($objRoomTypeServiceProductOrderDetail->id_order); - - $oldUnitPriceTaxExcl = $objRoomTypeServiceProductOrderDetail->unit_price_tax_excl; - $oldUnitPriceTaxIncl = $objRoomTypeServiceProductOrderDetail->unit_price_tax_incl; - - $oldTotalPriceTaxExcl = $objRoomTypeServiceProductOrderDetail->total_price_tax_excl; - $oldTotalPriceTaxIncl = $objRoomTypeServiceProductOrderDetail->total_price_tax_incl; - - $oldQuantity = $objRoomTypeServiceProductOrderDetail->quantity; - - if ($oldUnitPriceTaxExcl > 0) { - $oldTaxMultiplier = $oldUnitPriceTaxIncl / $oldUnitPriceTaxExcl; - } else { - $oldTaxMultiplier = 1; - } - if ($quantity <= 0) { - $quantity = 1; - } - - $objRoomTypeServiceProductOrderDetail->quantity = $quantity; - $objRoomTypeServiceProductOrderDetail->unit_price_tax_excl = $unitPrice; - $objRoomTypeServiceProductOrderDetail->unit_price_tax_incl = $unitPrice * $oldTaxMultiplier; - - $numDays = 1; - if ($objOrderDetail->product_price_calculation_method == Product::PRICE_CALCULATION_METHOD_PER_DAY) { - $numDays = HotelHelper::getNumberOfDays( - $objHotelBookingDetail->date_from, - $objHotelBookingDetail->date_to - ); - } - $objRoomTypeServiceProductOrderDetail->total_price_tax_excl = Tools::processPriceRounding( - ($objRoomTypeServiceProductOrderDetail->unit_price_tax_excl * $numDays), - $quantity, - $order->round_type, - $order->round_mode - ); - $objRoomTypeServiceProductOrderDetail->total_price_tax_incl = Tools::processPriceRounding( - ($objRoomTypeServiceProductOrderDetail->unit_price_tax_incl * $numDays), - $quantity, - $order->round_type, - $order->round_mode - ); - - if ($res &= $objRoomTypeServiceProductOrderDetail->save()) { - $priceDiffTaxExcl = $objRoomTypeServiceProductOrderDetail->total_price_tax_excl - $oldTotalPriceTaxExcl; - $priceDiffTaxIncl = $objRoomTypeServiceProductOrderDetail->total_price_tax_incl - $oldTotalPriceTaxIncl; - - $quantityDiff = $objRoomTypeServiceProductOrderDetail->quantity - $oldQuantity; - - $objOrderDetail->product_quantity += $quantityDiff; - $objOrderDetail->total_price_tax_excl += $priceDiffTaxExcl; - $objOrderDetail->total_price_tax_incl += $priceDiffTaxIncl; - - $objOrderDetail->unit_price_tax_excl = ($objOrderDetail->total_price_tax_excl / $objOrderDetail->product_quantity); - $objOrderDetail->unit_price_tax_incl = ($objOrderDetail->total_price_tax_incl / $objOrderDetail->product_quantity); - - $res &= $objOrderDetail->updateTaxAmount($order); - - $res &= $objOrderDetail->update(); - - if ($objOrderDetail->id_order_invoice != 0) { - // values changes as values are calculated accoding to the quantity of the product by webkul - $order_invoice = new OrderInvoice($objOrderDetail->id_order_invoice); - $order_invoice->total_paid_tax_excl = Tools::ps_round((float)($order_invoice->total_paid_tax_excl + $priceDiffTaxExcl), _PS_PRICE_COMPUTE_PRECISION_); - $order_invoice->total_paid_tax_incl = Tools::ps_round((float)($order_invoice->total_paid_tax_incl + $priceDiffTaxIncl), _PS_PRICE_COMPUTE_PRECISION_); - $res &= $order_invoice->update(); + // Validate selected services + foreach ($selectedServicesOrderDetails as $idRoomTypeServiceProductOrderDetail) { + if (Validate::isLoadedObject($objRoomTypeServiceOrderDetail = new RoomTypeServiceProductOrderDetail($idRoomTypeServiceProductOrderDetail))) { + $objOrderDetail = new OrderDetail($objRoomTypeServiceOrderDetail->id_order_detail); + if ($objOrderDetail->product_allow_multiple_quantity) { + if (!isset($serviceQuantities[$idRoomTypeServiceProductOrderDetail])) { + $response['hasError'] = true; + $response['errors'] = $this->l('Quantity not provided for service').': '.$objRoomTypeServiceOrderDetail->name; + } else if (!Validate::isUnsignedInt($serviceQuantities[$idRoomTypeServiceProductOrderDetail])) { + $response['hasError'] = true; + $response['errors'] = $this->l('Invalid quantity provided for service').': '.$objRoomTypeServiceOrderDetail->name; + } + } elseif ($serviceQuantities[$idRoomTypeServiceProductOrderDetail] > 1) { + $response['hasError'] = true; + $response['errors'] = $this->l('Can not order multiple quanitity for service').': '.$objRoomTypeServiceOrderDetail->name; } - $order->total_products = Tools::ps_round((float)($order->total_products + $priceDiffTaxExcl), _PS_PRICE_COMPUTE_PRECISION_); - $order->total_products = $order->total_products > 0 ? $order->total_products : 0; - - $order->total_products_wt = Tools::ps_round((float)($order->total_products_wt + $priceDiffTaxIncl), _PS_PRICE_COMPUTE_PRECISION_); - $order->total_products_wt = $order->total_products_wt > 0 ? $order->total_products_wt : 0; - - $order->total_paid = Tools::ps_round($order->getOrderTotal(), _PS_PRICE_COMPUTE_PRECISION_); - $order->total_paid_tax_incl = Tools::ps_round($order->getOrderTotal(), _PS_PRICE_COMPUTE_PRECISION_); - $order->total_paid_tax_excl = Tools::ps_round($order->getOrderTotal(false), _PS_PRICE_COMPUTE_PRECISION_); - - $res &= $order->update(); - } - } - if (!$res) { - $response['hasError'] = true; - $response['errors'] = $this->l('Error while updating service, please try refresing the page'); - } - - $response['service_panel']= $servicesBlock = $this->processRenderServicesPanel( - $objOrderDetail->id_order, - $objHotelBookingDetail->id_product, - $objHotelBookingDetail->date_from, - $objHotelBookingDetail->date_to, - $objHotelBookingDetail->id_room, - $objHotelBookingDetail->id, - true - ); - } else { - $response['hasError'] = true; - $response['errors'] = $this->l('Additional service not found'); - } - } else { - $response['hasError'] = true; - $response['errors'] = $this->l('You do not have permission to edit this order.'); - } - - die(json_encode($response)); - } - - public function ajaxProcessDeleteRoomAdditionalService() - { - $response = array('hasError' => false); - // Check tab access is allowed to edit - if ($this->tabAccess['edit'] == 1) { - $id_room_type_service_product_order_detail = Tools::getValue('id_room_type_service_product_order_detail'); - - if (Validate::isLoadedObject($objRoomTypeServiceProductOrderDetail = new RoomTypeServiceProductOrderDetail($id_room_type_service_product_order_detail))) { - $objOrderDetail = new OrderDetail($objRoomTypeServiceProductOrderDetail->id_order_detail); - $priceTaxExcl = $objRoomTypeServiceProductOrderDetail->total_price_tax_excl; - $priceTaxIncl = $objRoomTypeServiceProductOrderDetail->total_price_tax_incl; - $quantity = $objRoomTypeServiceProductOrderDetail->quantity; - $res = true; - $objHotelBookingDetail = new HotelBookingDetail($objRoomTypeServiceProductOrderDetail->id_htl_booking_detail); - - if ($res &= $objRoomTypeServiceProductOrderDetail->delete()) { - $order = new Order($objRoomTypeServiceProductOrderDetail->id_order); - if ($quantity >= $objOrderDetail->product_quantity) { - $objOrderDetail->delete(); + if (!isset($serviceUnitPrices[$idRoomTypeServiceProductOrderDetail]) + || !ValidateCore::isPrice($serviceUnitPrices[$idRoomTypeServiceProductOrderDetail]) + ) { + $response['hasError'] = true; + $response['errors'] = $this->l('Invalid unit price for service').': '.$objRoomTypeServiceOrderDetail->name; + } } else { - $objOrderDetail->product_quantity -= $quantity; - - $objOrderDetail->total_price_tax_excl -= Tools::processPriceRounding( - $priceTaxExcl, - 1, - $order->round_type, - $order->round_mode - ); - $objOrderDetail->total_price_tax_incl -= Tools::processPriceRounding( - $priceTaxIncl, - 1, - $order->round_type, - $order->round_mode - ); - - $res &= $objOrderDetail->updateTaxAmount($order); - - $res &= $objOrderDetail->update(); + $response['hasError'] = true; + $response['errors'] = $this->l('Service not found for service').': '.$objRoomTypeServiceOrderDetail->name; } - - if ($objOrderDetail->id_order_invoice != 0) { - // values changes as values are calculated - $objOrderInvoice = new OrderInvoice($objOrderDetail->id_order_invoice); - $objOrderInvoice->total_paid_tax_excl = Tools::ps_round((float)($objOrderInvoice->total_paid_tax_excl - $priceTaxExcl), _PS_PRICE_COMPUTE_PRECISION_); - $objOrderInvoice->total_paid_tax_incl = Tools::ps_round((float)($objOrderInvoice->total_paid_tax_incl - $priceTaxIncl), _PS_PRICE_COMPUTE_PRECISION_); - $res &= $objOrderInvoice->update(); - } - - $order->total_products = Tools::ps_round((float)($order->total_products - $priceTaxExcl), _PS_PRICE_COMPUTE_PRECISION_); - $order->total_products = $order->total_products > 0 ? $order->total_products : 0; - - $order->total_products_wt = Tools::ps_round((float)($order->total_products_wt - $priceTaxIncl), _PS_PRICE_COMPUTE_PRECISION_); - $order->total_products_wt = $order->total_products_wt > 0 ? $order->total_products_wt : 0; - - $order->total_paid = Tools::ps_round($order->getOrderTotal(), _PS_PRICE_COMPUTE_PRECISION_); - $order->total_paid_tax_incl = Tools::ps_round($order->getOrderTotal(), _PS_PRICE_COMPUTE_PRECISION_); - $order->total_paid_tax_excl = Tools::ps_round($order->getOrderTotal(false), _PS_PRICE_COMPUTE_PRECISION_); - - $res &= $order->update(); } - if ($res) { - $response['service_panel']= $servicesBlock = $this->processRenderServicesPanel( - $objOrderDetail->id_order, - $objHotelBookingDetail->id_product, - $objHotelBookingDetail->date_from, - $objHotelBookingDetail->date_to, - $objHotelBookingDetail->id_room, - $objHotelBookingDetail->id, - true - ); + + if (!$response['hasError']) { + $result = true; + foreach ($selectedServicesOrderDetails as $idRoomTypeServiceProductOrderDetail) { + $quantity = $serviceQuantities[$idRoomTypeServiceProductOrderDetail]; + $unitPrice = $serviceUnitPrices[$idRoomTypeServiceProductOrderDetail]; + + $objRoomTypeServiceOrderDetail = new RoomTypeServiceProductOrderDetail($idRoomTypeServiceProductOrderDetail); + $objHotelBookingDetail = new HotelBookingDetail($objRoomTypeServiceOrderDetail->id_htl_booking_detail); + $objOrder = new Order($objRoomTypeServiceOrderDetail->id_order); + $objOrderDetail = new OrderDetail($objRoomTypeServiceOrderDetail->id_order_detail); + + $oldUnitPriceTaxExcl = $objRoomTypeServiceOrderDetail->unit_price_tax_excl; + $oldUnitPriceTaxIncl = $objRoomTypeServiceOrderDetail->unit_price_tax_incl; + + $oldTotalPriceTaxExcl = $objRoomTypeServiceOrderDetail->total_price_tax_excl; + $oldTotalPriceTaxIncl = $objRoomTypeServiceOrderDetail->total_price_tax_incl; + + $oldQuantity = $objRoomTypeServiceOrderDetail->quantity; + + if ($oldUnitPriceTaxExcl > 0) { + $oldTaxMultiplier = $oldUnitPriceTaxIncl / $oldUnitPriceTaxExcl; + } else { + $oldTaxMultiplier = 1; + } + + if (!$objOrderDetail->product_allow_multiple_quantity) { + $quantity = 1; + } + + $objRoomTypeServiceOrderDetail->quantity = $quantity; + $objRoomTypeServiceOrderDetail->unit_price_tax_excl = $unitPrice; + $objRoomTypeServiceOrderDetail->unit_price_tax_incl = $unitPrice * $oldTaxMultiplier; + + $numDays = 1; + if ($objOrderDetail->product_price_calculation_method == Product::PRICE_CALCULATION_METHOD_PER_DAY) { + $numDays = HotelHelper::getNumberOfDays( + $objHotelBookingDetail->date_from, + $objHotelBookingDetail->date_to + ); + } + $objRoomTypeServiceOrderDetail->total_price_tax_excl = Tools::processPriceRounding( + ($objRoomTypeServiceOrderDetail->unit_price_tax_excl * $numDays), + $quantity, + $objOrder->round_type, + $objOrder->round_mode + ); + $objRoomTypeServiceOrderDetail->total_price_tax_incl = Tools::processPriceRounding( + ($objRoomTypeServiceOrderDetail->unit_price_tax_incl * $numDays), + $quantity, + $objOrder->round_type, + $objOrder->round_mode + ); + + if ($result &= $objRoomTypeServiceOrderDetail->save()) { + $priceDiffTaxExcl = $objRoomTypeServiceOrderDetail->total_price_tax_excl - $oldTotalPriceTaxExcl; + $priceDiffTaxIncl = $objRoomTypeServiceOrderDetail->total_price_tax_incl - $oldTotalPriceTaxIncl; + + $quantityDiff = $objRoomTypeServiceOrderDetail->quantity - $oldQuantity; + + $objOrderDetail->product_quantity += $quantityDiff; + $objOrderDetail->total_price_tax_excl += $priceDiffTaxExcl; + $objOrderDetail->total_price_tax_incl += $priceDiffTaxIncl; + + $objOrderDetail->unit_price_tax_excl = ($objOrderDetail->total_price_tax_excl / $objOrderDetail->product_quantity); + $objOrderDetail->unit_price_tax_incl = ($objOrderDetail->total_price_tax_incl / $objOrderDetail->product_quantity); + + $result &= $objOrderDetail->updateTaxAmount($objOrder); + + $result &= $objOrderDetail->update(); + + if ($objOrderDetail->id_order_invoice != 0) { + // values changes as values are calculated accoding to the quantity of the product by webkul + $order_invoice = new OrderInvoice($objOrderDetail->id_order_invoice); + $order_invoice->total_paid_tax_excl = Tools::ps_round((float)($order_invoice->total_paid_tax_excl + $priceDiffTaxExcl), _PS_PRICE_COMPUTE_PRECISION_); + $order_invoice->total_paid_tax_incl = Tools::ps_round((float)($order_invoice->total_paid_tax_incl + $priceDiffTaxIncl), _PS_PRICE_COMPUTE_PRECISION_); + $result &= $order_invoice->update(); + } + + $objOrder->total_products = Tools::ps_round((float)($objOrder->total_products + $priceDiffTaxExcl), _PS_PRICE_COMPUTE_PRECISION_); + $objOrder->total_products = $objOrder->total_products > 0 ? $objOrder->total_products : 0; + + $objOrder->total_products_wt = Tools::ps_round((float)($objOrder->total_products_wt + $priceDiffTaxIncl), _PS_PRICE_COMPUTE_PRECISION_); + $objOrder->total_products_wt = $objOrder->total_products_wt > 0 ? $objOrder->total_products_wt : 0; + + $objOrder->total_paid = Tools::ps_round($objOrder->getOrderTotal(), _PS_PRICE_COMPUTE_PRECISION_); + $objOrder->total_paid_tax_incl = Tools::ps_round($objOrder->getOrderTotal(), _PS_PRICE_COMPUTE_PRECISION_); + $objOrder->total_paid_tax_excl = Tools::ps_round($objOrder->getOrderTotal(false), _PS_PRICE_COMPUTE_PRECISION_); + + $result &= $objOrder->update(); + } + } + + if (!$result) { + $response['hasError'] = true; + $response['errors'] = $this->l('Error while updating service, please try again after refresing the page'); + } else { + $response['service_panel']= $servicesBlock = $this->processRenderServicesPanel( + $objOrderDetail->id_order, + $objHotelBookingDetail->id_product, + $objHotelBookingDetail->date_from, + $objHotelBookingDetail->date_to, + $objHotelBookingDetail->id_room, + $objHotelBookingDetail->id, + true + ); + } } } else { $response['hasError'] = true; - $response['errors'] = $this->l('Additional service not found'); + $response['errors'] = $this->l('Service not found for service').': '.$objRoomTypeServiceOrderDetail->name; } } else { $response['hasError'] = true; @@ -7166,6 +7106,90 @@ class AdminOrdersControllerCore extends AdminController die(json_encode($response)); } + + public function ajaxProcessDeleteRoomAdditionalService() + { + $response = array('hasError' => false); + // Check tab access is allowed to edit + if ($this->tabAccess['edit'] == 1) { + $id_room_type_service_product_order_detail = Tools::getValue('id_room_type_service_product_order_detail'); + + if (Validate::isLoadedObject($objRoomTypeServiceProductOrderDetail = new RoomTypeServiceProductOrderDetail($id_room_type_service_product_order_detail))) { + $objOrderDetail = new OrderDetail($objRoomTypeServiceProductOrderDetail->id_order_detail); + $priceTaxExcl = $objRoomTypeServiceProductOrderDetail->total_price_tax_excl; + $priceTaxIncl = $objRoomTypeServiceProductOrderDetail->total_price_tax_incl; + $quantity = $objRoomTypeServiceProductOrderDetail->quantity; + $res = true; + $objHotelBookingDetail = new HotelBookingDetail($objRoomTypeServiceProductOrderDetail->id_htl_booking_detail); + + if ($res &= $objRoomTypeServiceProductOrderDetail->delete()) { + $order = new Order($objRoomTypeServiceProductOrderDetail->id_order); + if ($quantity >= $objOrderDetail->product_quantity) { + $objOrderDetail->delete(); + } else { + $objOrderDetail->product_quantity -= $quantity; + + $objOrderDetail->total_price_tax_excl -= Tools::processPriceRounding( + $priceTaxExcl, + 1, + $order->round_type, + $order->round_mode + ); + $objOrderDetail->total_price_tax_incl -= Tools::processPriceRounding( + $priceTaxIncl, + 1, + $order->round_type, + $order->round_mode + ); + + $res &= $objOrderDetail->updateTaxAmount($order); + + $res &= $objOrderDetail->update(); + } + + if ($objOrderDetail->id_order_invoice != 0) { + // values changes as values are calculated + $objOrderInvoice = new OrderInvoice($objOrderDetail->id_order_invoice); + $objOrderInvoice->total_paid_tax_excl = Tools::ps_round((float)($objOrderInvoice->total_paid_tax_excl - $priceTaxExcl), _PS_PRICE_COMPUTE_PRECISION_); + $objOrderInvoice->total_paid_tax_incl = Tools::ps_round((float)($objOrderInvoice->total_paid_tax_incl - $priceTaxIncl), _PS_PRICE_COMPUTE_PRECISION_); + $res &= $objOrderInvoice->update(); + } + + $order->total_products = Tools::ps_round((float)($order->total_products - $priceTaxExcl), _PS_PRICE_COMPUTE_PRECISION_); + $order->total_products = $order->total_products > 0 ? $order->total_products : 0; + + $order->total_products_wt = Tools::ps_round((float)($order->total_products_wt - $priceTaxIncl), _PS_PRICE_COMPUTE_PRECISION_); + $order->total_products_wt = $order->total_products_wt > 0 ? $order->total_products_wt : 0; + + $order->total_paid = Tools::ps_round($order->getOrderTotal(), _PS_PRICE_COMPUTE_PRECISION_); + $order->total_paid_tax_incl = Tools::ps_round($order->getOrderTotal(), _PS_PRICE_COMPUTE_PRECISION_); + $order->total_paid_tax_excl = Tools::ps_round($order->getOrderTotal(false), _PS_PRICE_COMPUTE_PRECISION_); + + $res &= $order->update(); + } + if ($res) { + $response['service_panel']= $servicesBlock = $this->processRenderServicesPanel( + $objOrderDetail->id_order, + $objHotelBookingDetail->id_product, + $objHotelBookingDetail->date_from, + $objHotelBookingDetail->date_to, + $objHotelBookingDetail->id_room, + $objHotelBookingDetail->id, + true + ); + } + } else { + $response['hasError'] = true; + $response['errors'] = $this->l('Additional service not found'); + } + } else { + $response['hasError'] = true; + $response['errors'] = $this->l('You do not have permission to edit this order.'); + } + + die(json_encode($response)); + } + // Process when admin changes extra demands of any room while order creation process form.tpl public function ajaxProcessChangeRoomDemands() { @@ -7455,113 +7479,6 @@ class AdminOrdersControllerCore extends AdminController die(json_encode($response)); } - public function ajaxProcessUpdateServiceProduct() - { - $operator = Tools::getValue('operator', 'up'); - $idServiceProduct = Tools::getValue('id_product'); - $idCartBooking = Tools::getValue('id_cart_booking'); - $qty = Tools::getValue('qty'); - $price = Tools::getValue('price'); - - if (Validate::isLoadedObject($objHotelCartBookingData = new HotelCartBookingData($idCartBooking))) { - $objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail(); - - if ($operator == 'up') { - // validate quanitity - if (Validate::isLoadedObject($objProduct = new Product($idServiceProduct))) { - if ($objProduct->allow_multiple_quantity) { - if (!Validate::isUnsignedInt($qty)) { - $this->errors[] = Tools::displayError('The quantity you\'ve entered is invalid.'); - // } elseif ($objProduct->max_quantity && $qty > $objProduct->max_quantity) { - // $this->errors[] = Tools::displayError(sprintf('cannot add more than %d quantity.', $objProduct->max_quantity)); - } - } else { - $qty = 1; - } - // validate price - if (!ValidateCore::isPrice($price)) { - $this->errors[] = Tools::displayError('Invalid service unit price.'); - } - } else { - $this->errors[] = Tools::displayError('This Service is not available.'); - } - } - - if (empty($this->errors)) { - if ($objRoomTypeServiceProductCartDetail->updateCartServiceProduct( - $idCartBooking, - $idServiceProduct, - $qty, - $objHotelCartBookingData->id_cart, - $operator - )) { - $objCart = new Cart($objHotelCartBookingData->id_cart); - $originalPrice = Product::getPriceStatic($idServiceProduct, false); - // if price is different than the original service price then update the price - if ($operator == 'up' && $originalPrice != $price) { - if ($specificPriceInfo = SpecificPrice::getSpecificPrice( - (int)$idServiceProduct, - 0, - $objCart->id_currency, - 0, - 0, - 1, - 0, - $objCart->id_customer, - $objCart->id - )) { - $objSpecificPrice = new SpecificPrice($specificPriceInfo['id_specific_price']); - } else { - $objSpecificPrice = new SpecificPrice(); - } - $objSpecificPrice->id_shop = 0; - $objSpecificPrice->id_shop_group = 0; - $objSpecificPrice->id_cart = $objCart->id; - $objSpecificPrice->id_currency = $objCart->id_currency; - $objSpecificPrice->id_country = 0; - $objSpecificPrice->id_group = 0; - $objSpecificPrice->id_customer = $objCart->id_customer; - $objSpecificPrice->id_product = $idServiceProduct; - $objSpecificPrice->id_product_attribute = 0; - $objSpecificPrice->price = $price; - $objSpecificPrice->from_quantity = 1; - $objSpecificPrice->reduction = 0; - $objSpecificPrice->reduction_type = 'amount'; - $objSpecificPrice->reduction_tax = 0; - $objSpecificPrice->from = '0000-00-00 00:00:00'; - $objSpecificPrice->to = '0000-00-00 00:00:00'; - if ($objSpecificPrice->save()) { - $this->ajaxDie(json_encode(array( - 'hasError' => false - ))); - } else { - $this->errors[] = Tools::displayError('Some error has been occurred. Please try reloading the page.'); - } - } else { - // delete specific price if price is same as original price - if (SpecificPrice::deleteByIdCart($objCart->id, $idServiceProduct)) { - $this->ajaxDie(json_encode(array( - 'hasError' => false, - 'down' => 1, - ))); - } else { - $this->errors[] = Tools::displayError('Unable to update services. Please try reloading the page.'); - } - } - } else { - $this->errors[] = Tools::displayError('Unable to update services. Please try reloading the page.'); - } - - } - } else { - $this->errors[] = Tools::displayError('Room not found. Please try reloading the page.'); - } - $this->ajaxDie(json_encode(array( - 'hasError' => true, - 'errors' => $this->errors - ))); - } - // To change the status of the room public function changeRoomStatus() { diff --git a/controllers/admin/AdminPPreferencesController.php b/controllers/admin/AdminPPreferencesController.php index 98ec9c7eb..32fba934f 100644 --- a/controllers/admin/AdminPPreferencesController.php +++ b/controllers/admin/AdminPPreferencesController.php @@ -85,7 +85,7 @@ class AdminPPreferencesControllerCore extends AdminController 'PS_PRODUCT_SHORT_DESC_LIMIT' => array( 'title' => $this->l('Max size of short description'), 'hint' => $this->l('Set the maximum size of room type short description (in characters).'), - 'validation' => 'isInt', + 'validation' => 'isUnsignedInt', 'cast' => 'intval', 'type' => 'text', 'suffix' => $this->l('characters'), diff --git a/js/admin/orders.js b/js/admin/orders.js index dca14a2d9..448a077c0 100644 --- a/js/admin/orders.js +++ b/js/admin/orders.js @@ -1449,14 +1449,6 @@ $(document).ready(function() { } }); - $(document).on('focusout', '#edit-room-booking-modal .room_ordered_services .qty', function(e) { - updateAdditionalServices($(this).closest('tr')); - }); - - $(document).on('focusout', '#edit-room-booking-modal .room_ordered_services .unit_price', function(e) { - updateAdditionalServices($(this).closest('tr')); - }); - $(document).on('focusout', '#edit-room-booking-modal #add_existing_room_services_form .qty', function(e) { var qty_wntd = $(this).val(); if (qty_wntd == '' || !$.isNumeric(qty_wntd) || qty_wntd < 1) { @@ -1500,6 +1492,48 @@ $(document).ready(function() { }); }); + $(document).on('submit', '#update_selected_room_services_form', function(e) { + e.preventDefault(); + var form_data = new FormData(this); + form_data.append('ajax', true); + form_data.append('action', 'updateSelectedRoomServices'); + + $(".loading_overlay").show(); + $.ajax({ + type: 'POST', + headers: { + "cache-control": "no-cache" + }, + url: admin_order_tab_link, + dataType: 'JSON', + cache: false, + data: form_data, + processData: false, + contentType: false, + success: function(jsonData) { + if (!jsonData.hasError) { + if (jsonData.service_panel) { + $('#room_type_service_product_desc').replaceWith(jsonData.service_panel); + } + showSuccessMessage(txtExtraDemandSucc); + } else { + if (jsonData.errors != 'undefined' && jsonData.errors.length) { + var errorHtml = error_found_txt + ':
'; + errorHtml += '
    '; + $.each(jsonData.errors, function(key, errorMsg) { + errorHtml += '
  1. ' + errorMsg + '
  2. '; + }); + errorHtml += '
'; + showErrorMessage(errorHtml); + } + } + }, + complete: function() { + $(".loading_overlay").hide(); + } + }); + }); + // save room extra demand to the order $(document).on('click', '#save_room_demands', function(e) { e.preventDefault(); @@ -2797,56 +2831,6 @@ const RoomAllotmentCommentModal = { } }; -function updateAdditionalServices(element) -{ - var id_room_type_service_product_order_detail = $(element).data('id_room_type_service_product_order_detail'); - if ($(element).find('.qty').length) { - var qty = $(element).find('.qty').val(); - if (qty == '' || !$.isNumeric(qty) || qty < 1) { - $(element).find('.qty').val(1); - qty = 1; - } - } else { - var qty = 1; - } - - var unit_price = $(element).find('.unit_price').val(); - if ($.isNumeric(qty)) { - $(".loading_overlay").show(); - $.ajax({ - type: 'POST', - headers: { - "cache-control": "no-cache" - }, - url: admin_order_tab_link, - dataType: 'JSON', - cache: false, - data: { - id_room_type_service_product_order_detail: id_room_type_service_product_order_detail, - qty: qty, - unit_price: unit_price, - action: 'updateRoomAdditionalServices', - ajax: true - }, - success: function(jsonData) { - if (!jsonData.hasError) { - if (jsonData.service_panel) { - $('#room_type_service_product_desc').replaceWith(jsonData.service_panel); - } - showSuccessMessage(txtExtraDemandSucc); - } else { - showErrorMessage(jsonData.errors); - - } - }, - complete: function() { - $(".loading_overlay").hide(); - } - }); - } - -} - function updateRoomDemand(element) { var id_booking_demand = $(element).data('id_booking_demand'); From 45874aee8b2316ee9c307de2436a6a7ded262cba Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Wed, 5 Mar 2025 12:10:23 +0530 Subject: [PATCH 07/29] Fixed: issues in testing --- .../template/controllers/orders/form.tpl | 100 ++++----- .../_add_order_extra_services_tab_content.tpl | 119 +++++----- controllers/admin/AdminCartsController.php | 210 ++++++++++-------- controllers/admin/AdminOrdersController.php | 19 +- .../RoomTypeServiceProductCartDetail.php | 1 + 5 files changed, 232 insertions(+), 217 deletions(-) diff --git a/admin/themes/default/template/controllers/orders/form.tpl b/admin/themes/default/template/controllers/orders/form.tpl index abfb41c1b..bffa8d544 100644 --- a/admin/themes/default/template/controllers/orders/form.tpl +++ b/admin/themes/default/template/controllers/orders/form.tpl @@ -1636,25 +1636,6 @@ } }); - $(document).on('click', '.change_room_type_service_product', function() { - updateServiceProducts(this); - }); - - // when the price of a service product is changed and focus is out - $(document).on('change', '#room_type_services_desc .service_cart_price_input', function() { - updateServiceProducts(this); - }); - - $(document).on('change', '#rooms_type_extra_demands .qty', function(e) { - var qty_wntd = $(this).val(); - if (qty_wntd == '' || !$.isNumeric(qty_wntd)) { - $(this).val(1); - } - if ($(this).closest('.room_demand_block').find('.change_room_type_service_product').is(':checked')) { - updateServiceProducts($(this).closest('.room_demand_block').find('.change_room_type_service_product')); - } - }); - $(document).on('keyup', '#payment_module_name', function() { let paymentMethod = $('#payment_module_name').val().trim().toLowerCase(); @@ -1782,49 +1763,54 @@ }); }); - function updateServiceProducts(element) - { - var qty = $(element).closest('.room_demand_block').find('input.qty').val(); - var dataElement = $(element).closest('.room_demand_block').find('.change_room_type_service_product'); - var operator = $(dataElement).is(':checked') ? 'up' : 'down'; - var id_product = $(dataElement).val(); - var id_cart_booking = $(dataElement).data('id_cart_booking'); - var service_price = $("#service_cart_price_"+id_cart_booking+"_"+id_product).val(); - - if (typeof(qty) == 'undefined') { - qty = 1; - } + $(document).on('click', '.change_room_type_service_product', function() { + if ($(this).prop('checked')) { + $("#selected_service_product_"+$(this).val()).val(1); + } else { + $("#selected_service_product_"+$(this).val()).val(0); + } + }); + $(document).on('submit', '#update_selected_room_services_form', function(e) { + e.preventDefault(); + var form_data = new FormData(this); + form_data.append('ajax', true); + form_data.append('action', 'updateSelectedRoomServices'); $(".loading_overlay").show(); - $.ajax({ - type: 'POST', - headers: { - "cache-control": "no-cache" - }, - url: "{$link->getAdminLink('AdminCarts')|addslashes}", - dataType: 'JSON', - cache: false, - data: { - operator: operator, - id_product: id_product, - id_cart_booking: id_cart_booking, - qty: qty, - price: service_price, - action: 'updateServiceProduct', - ajax: true - }, - success: function(jsonData) { - if (!jsonData.hasError) { - showSuccessMessage(txtExtraDemandSucc); - } else { - showErrorMessage(jsonData.errors); - } - }, + $.ajax({ + type: 'POST', + headers: { + "cache-control": "no-cache" + }, + url: "{$link->getAdminLink('AdminCarts')|addslashes}", + dataType: 'JSON', + cache: false, + data: form_data, + processData: false, + contentType: false, + success: function(jsonData) { + if (!jsonData.hasError) { + if (jsonData.service_panel) { + $('#room_type_service_product_desc').replaceWith(jsonData.service_panel); + } + showSuccessMessage(txtExtraDemandSucc); + } else { + if (jsonData.errors != 'undefined' && jsonData.errors.length) { + var errorHtml = error_found_txt + ':
'; + errorHtml += '
    '; + $.each(jsonData.errors, function(key, errorMsg) { + errorHtml += '
  1. ' + errorMsg + '
  2. '; + }); + errorHtml += '
'; + showErrorMessage(errorHtml); + } + } + }, complete: function() { $(".loading_overlay").hide(); } - }); - } + }); + }); }); diff --git a/admin/themes/default/template/controllers/orders/modals/_add_order_extra_services_tab_content.tpl b/admin/themes/default/template/controllers/orders/modals/_add_order_extra_services_tab_content.tpl index 4f91abc10..768510abc 100644 --- a/admin/themes/default/template/controllers/orders/modals/_add_order_extra_services_tab_content.tpl +++ b/admin/themes/default/template/controllers/orders/modals/_add_order_extra_services_tab_content.tpl @@ -31,62 +31,71 @@
{if isset($serviceProducts) && $serviceProducts} - - - - - - - - - - - - {foreach $serviceProducts as $product} - - - - - - + +
{l s='Name'}{l s='Quantity'}{l s='Unit Price (tax excl.)'}
- - -

{$product['name']|escape:'html':'UTF-8'}

-
- {if $product['auto_add_to_cart'] && $product['price_addition_type'] == Product::PRICE_ADDITION_TYPE_INDEPENDENT} - {l s='Convenience fee'} - {/if} - {if $product['auto_add_to_cart'] && $product['price_addition_type'] == Product::PRICE_ADDITION_TYPE_WITH_ROOM} - {l s='Auto added'} - {/if} - - {if $product.allow_multiple_quantity} -
- -

- {l s='Maximum allowed quantity: %s' sprintf=$product.max_quantity} -

-
- {else} - -- - {/if} -
- {if ($product.show_price && !isset($restricted_country_mode)) || isset($groups)} -
- - {$cartCurrency->sign} - - - {if Product::PRICE_CALCULATION_METHOD_PER_DAY == $product['price_calculation_method']} - {l s='/ night'} - {/if} -
- {/if} -
+ + + + + + + - {/foreach} - -
{l s='Name'}{l s='Quantity'}{l s='Unit Price (tax excl.)'}
+ +
+ + + + +

{$product['name']|escape:'html':'UTF-8'}

+
+ {if $product['auto_add_to_cart'] && $product['price_addition_type'] == Product::PRICE_ADDITION_TYPE_INDEPENDENT} + {l s='Convenience fee'} + {/if} + {if $product['auto_add_to_cart'] && $product['price_addition_type'] == Product::PRICE_ADDITION_TYPE_WITH_ROOM} + {l s='Auto added'} + {/if} + + {if $product.allow_multiple_quantity} +
+ + +

+ {l s='Maximum allowed quantity: %s' sprintf=$product.max_quantity} +

+
+ {else} + -- + {/if} +
+ {if ($product.show_price && !isset($restricted_country_mode)) || isset($groups)} +
+ + {$cartCurrency->sign} + + + {if Product::PRICE_CALCULATION_METHOD_PER_DAY == $product['price_calculation_method']} + {l s='/ night'} + {/if} +
+ {/if} +
+ + + {/if}
diff --git a/controllers/admin/AdminCartsController.php b/controllers/admin/AdminCartsController.php index efae86aea..c28b82020 100644 --- a/controllers/admin/AdminCartsController.php +++ b/controllers/admin/AdminCartsController.php @@ -1110,7 +1110,7 @@ class AdminCartsControllerCore extends AdminController if (Configuration::get('PS_ALLOW_ADD_ALL_SERVICES_IN_BOOKING')) { // get all services $objProduct = new Product(); - $serviceProducts = $objProduct->getServiceProducts(); + $serviceProducts = $objProduct->getServiceProducts(true); } else { $objRoomTypeServiceProduct = new RoomTypeServiceProduct(); $serviceProducts = $objRoomTypeServiceProduct->getServiceProductsData($idProduct, 1, 0, false, 2, null); @@ -1256,7 +1256,7 @@ class AdminCartsControllerCore extends AdminController { $response = array('hasError' => false); // Check tab access is allowed to edit - if ($this->tabAccess['edit'] == 1) { + if ($this->tabAccess['add'] == 1) { if (Configuration::get('PS_ALLOW_CREATE_CUSTOM_SERVICES_IN_BOOKING')) { $idHotelCartBooking = Tools::getValue('id_hotel_cart_booking'); // valiadate services being added @@ -1330,7 +1330,7 @@ class AdminCartsControllerCore extends AdminController $objServiceProduct->show_at_front = false; $objServiceProduct->indexed = false; $objServiceProduct->minimal_quantity = 1; - $objServiceProduct->active = false; + $objServiceProduct->active = true; $objServiceProduct->max_quantity = 99999; // ======= Create Service product END ========= @@ -1392,7 +1392,7 @@ class AdminCartsControllerCore extends AdminController $response['errors'][] = $this->l('You do not have permission to edit this order.'); } - die(json_encode($response)); + $this->ajaxDie(json_encode($response)); } public function getBookingServicesTabContent($idHotelCartBooking) @@ -1402,7 +1402,7 @@ class AdminCartsControllerCore extends AdminController if (Configuration::get('PS_ALLOW_ADD_ALL_SERVICES_IN_BOOKING')) { // get all services $objProduct = new Product(); - $serviceProducts = $objProduct->getServiceProducts(); + $serviceProducts = $objProduct->getServiceProducts(true); } else { $objRoomTypeServiceProduct = new RoomTypeServiceProduct(); $serviceProducts = $objRoomTypeServiceProduct->getServiceProductsData($objCartBookingData->id_product, 1, 0, false, 2, null); @@ -1455,111 +1455,127 @@ class AdminCartsControllerCore extends AdminController return $servicesTpl; } - - public function ajaxProcessUpdateServiceProduct() + // Process to update selected services + public function ajaxProcessUpdateSelectedRoomServices() { - $operator = Tools::getValue('operator', 'up'); - $idServiceProduct = Tools::getValue('id_product'); - $idCartBooking = Tools::getValue('id_cart_booking'); - $qty = Tools::getValue('qty'); - $price = Tools::getValue('price'); + $response = array('hasError' => false); + // Check tab access is allowed to edit + if ($this->tabAccess['add'] == 1) { + $idCartBooking = Tools::getValue('id_hotel_cart_booking'); + if (Validate::isLoadedObject($objHotelCartBookingData = new HotelCartBookingData($idCartBooking))) { + $objCart = new Cart($objHotelCartBookingData->id_cart); + if ($selectedServiceProducts = Tools::getValue('selected_service_product')) { + $serviceQuantities = Tools::getValue('service_qty'); + $serviceUnitPrices = Tools::getValue('service_price'); + // Validate selected services + foreach ($selectedServiceProducts as $idServiceProduct => $selected) { + if (Validate::isLoadedObject($objProduct = new Product($idServiceProduct, false, $objCart->id_lang))) { + if ($objProduct->allow_multiple_quantity) { + if (!isset($serviceQuantities[$idServiceProduct])) { + $response['hasError'] = true; + $response['errors'] = $this->l('Quantity not provided for service').': '.$objProduct->name; + } else if (!Validate::isUnsignedInt($serviceQuantities[$idServiceProduct])) { + $response['hasError'] = true; + $response['errors'] = $this->l('Invalid quantity provided for service').': '.$objProduct->name; + } + } elseif ($serviceQuantities[$idServiceProduct] > 1) { + $response['hasError'] = true; + $response['errors'] = $this->l('Can not order multiple quanitity for service').': '.$objProduct->name; + } - if (Validate::isLoadedObject($objHotelCartBookingData = new HotelCartBookingData($idCartBooking))) { - $objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail(); + if (!$objProduct->allow_multiple_quantity) { + $serviceQuantities[$idServiceProduct] = 1; + } - if ($operator == 'up') { - // validate quanitity - if (Validate::isLoadedObject($objProduct = new Product($idServiceProduct))) { - if ($objProduct->allow_multiple_quantity) { - if (!Validate::isUnsignedInt($qty)) { - $this->errors[] = Tools::displayError('The quantity you\'ve entered is invalid.'); - // } elseif ($objProduct->max_quantity && $qty > $objProduct->max_quantity) { - // $this->errors[] = Tools::displayError(sprintf('cannot add more than %d quantity.', $objProduct->max_quantity)); + if (!isset($serviceUnitPrices[$idServiceProduct]) + || !ValidateCore::isPrice($serviceUnitPrices[$idServiceProduct]) + ) { + $response['hasError'] = true; + $response['errors'] = $this->l('Invalid unit price for service').': '.$objProduct->name; + } + + } else { + die($idServiceProduct); + $response['errors'] = $this->l('Some services not found. please try after refreshing the page'); } - } else { - $qty = 1; } - // validate price - if (!ValidateCore::isPrice($price)) { - $this->errors[] = Tools::displayError('Invalid service unit price.'); - } - } else { - $this->errors[] = Tools::displayError('This Service is not available.'); - } - } - if (empty($this->errors)) { - if ($objRoomTypeServiceProductCartDetail->updateCartServiceProduct( - $idCartBooking, - $idServiceProduct, - $qty, - $objHotelCartBookingData->id_cart, - $operator - )) { - $objCart = new Cart($objHotelCartBookingData->id_cart); - $originalPrice = Product::getPriceStatic($idServiceProduct, false); - // if price is different than the original service price then update the price - if ($operator == 'up' && $originalPrice != $price) { - if ($specificPriceInfo = SpecificPrice::getSpecificPrice( - (int)$idServiceProduct, - 0, - $objCart->id_currency, - 0, - 0, - 1, - 0, - $objCart->id_customer, - $objCart->id - )) { - $objSpecificPrice = new SpecificPrice($specificPriceInfo['id_specific_price']); - } else { - $objSpecificPrice = new SpecificPrice(); + if (!$response['hasError']) { + $result = true; + $objRoomTypeServiceProductCart = new RoomTypeServiceProductCartDetail(); + foreach ($selectedServiceProducts as $idServiceProduct => $selected) { + if ($selected) { + $operator = 'up'; + } else { + $operator = 'down'; + } + $quantity = $serviceQuantities[$idServiceProduct]; + $unitPrice = $serviceUnitPrices[$idServiceProduct]; + if ($result &= $objRoomTypeServiceProductCart->updateCartServiceProduct( + $idCartBooking, + $idServiceProduct, + $quantity, + $objHotelCartBookingData->id_cart, + $operator, + )) { + $originalPrice = Product::getPriceStatic($idServiceProduct, false); + // if price is different than the original service price then update the price + if ($operator == 'up' && $originalPrice != $price) { + if ($specificPriceInfo = SpecificPrice::getSpecificPrice( + (int)$idServiceProduct, + 0, + $objCart->id_currency, + 0, + 0, + 1, + 0, + $objCart->id_customer, + $objCart->id + )) { + $objSpecificPrice = new SpecificPrice($specificPriceInfo['id_specific_price']); + } else { + $objSpecificPrice = new SpecificPrice(); + } + $objSpecificPrice->id_shop = 0; + $objSpecificPrice->id_shop_group = 0; + $objSpecificPrice->id_cart = $objCart->id; + $objSpecificPrice->id_currency = $objCart->id_currency; + $objSpecificPrice->id_country = 0; + $objSpecificPrice->id_group = 0; + $objSpecificPrice->id_customer = $objCart->id_customer; + $objSpecificPrice->id_product = $idServiceProduct; + $objSpecificPrice->id_product_attribute = 0; + $objSpecificPrice->price = $unitPrice; + $objSpecificPrice->from_quantity = 1; + $objSpecificPrice->reduction = 0; + $objSpecificPrice->reduction_type = 'amount'; + $objSpecificPrice->reduction_tax = 0; + $objSpecificPrice->from = '0000-00-00 00:00:00'; + $objSpecificPrice->to = '0000-00-00 00:00:00'; + + $result &= $objSpecificPrice->save(); + } + } } - $objSpecificPrice->id_shop = 0; - $objSpecificPrice->id_shop_group = 0; - $objSpecificPrice->id_cart = $objCart->id; - $objSpecificPrice->id_currency = $objCart->id_currency; - $objSpecificPrice->id_country = 0; - $objSpecificPrice->id_group = 0; - $objSpecificPrice->id_customer = $objCart->id_customer; - $objSpecificPrice->id_product = $idServiceProduct; - $objSpecificPrice->id_product_attribute = 0; - $objSpecificPrice->price = $price; - $objSpecificPrice->from_quantity = 1; - $objSpecificPrice->reduction = 0; - $objSpecificPrice->reduction_type = 'amount'; - $objSpecificPrice->reduction_tax = 0; - $objSpecificPrice->from = '0000-00-00 00:00:00'; - $objSpecificPrice->to = '0000-00-00 00:00:00'; - if ($objSpecificPrice->save()) { - $this->ajaxDie(json_encode(array( - 'hasError' => false - ))); - } else { - $this->errors[] = Tools::displayError('Some error has been occurred. Please try reloading the page.'); - } - } else { - // delete specific price if price is same as original price - if (SpecificPrice::deleteByIdCart($objCart->id, $idServiceProduct)) { - $this->ajaxDie(json_encode(array( - 'hasError' => false, - 'down' => 1, - ))); - } else { - $this->errors[] = Tools::displayError('Unable to update services. Please try reloading the page.'); + + if (!$result) { + $response['hasError'] = true; + $response['errors'] = $this->l('Error while updating services, please try again after refresing the page'); } } } else { - $this->errors[] = Tools::displayError('Unable to update services. Please try reloading the page.'); + $response['hasError'] = true; + $response['errors'] = $this->l('No service found'); } - + } else { + $response['hasError'] = true; + $response['errors'] = $this->l('Room info not found'); } } else { - $this->errors[] = Tools::displayError('Room not found. Please try reloading the page.'); + $response['hasError'] = true; + $response['errors'] = $this->l('You do not have permission to edit this order.'); } - $this->ajaxDie(json_encode(array( - 'hasError' => true, - 'errors' => $this->errors - ))); + + $this->ajaxDie(json_encode($response)); } } diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index 39f2ba0d6..91b298167 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -388,7 +388,10 @@ class AdminOrdersControllerCore extends AdminController // validate cart for removing invalid data from cart before new order creation // remove not linked services with room types from cart if not allowed to book them - $this->errors = array_merge($this->errors, HotelCartBookingData::validateCartBookings(!Configuration::get('PS_ALLOW_ADD_ALL_SERVICES_IN_BOOKING'))); + $this->errors = array_merge( + $this->errors, + HotelCartBookingData::validateCartBookings(!Configuration::get('PS_ALLOW_ADD_ALL_SERVICES_IN_BOOKING')) + ); $cart_detail_data = array(); $cart_detail_data_obj = new HotelCartBookingData(); @@ -953,7 +956,7 @@ class AdminOrdersControllerCore extends AdminController if (Configuration::get('PS_ALLOW_ADD_ALL_SERVICES_IN_BOOKING')) { // get all services $objProduct = new Product(); - $serviceProducts = $objProduct->getServiceProducts(); + $serviceProducts = $objProduct->getServiceProducts(true); } else { $objRoomTypeServiceProduct = new RoomTypeServiceProduct(); $serviceProducts = $objRoomTypeServiceProduct->getServiceProductsData($idProduct, 1, 0, false, 2, null); @@ -1700,7 +1703,7 @@ class AdminOrdersControllerCore extends AdminController $this->context->cart = $objCart; $this->context->currency = new Currency((int)$objCart->id_currency); - $this->errors = HotelCartBookingData::validateCartBookings(); + $this->errors = HotelCartBookingData::validateCartBookings(!Configuration::get('PS_ALLOW_ADD_ALL_SERVICES_IN_BOOKING')); $orderTotal = $objCart->getOrderTotal(true, Cart::BOTH); if ($objCart->is_advance_payment) { $advancePaymentAmount = $objCart->getOrderTotal(true, Cart::ADVANCE_PAYMENT); @@ -6297,7 +6300,7 @@ class AdminOrdersControllerCore extends AdminController if (Configuration::get('PS_ALLOW_ADD_ALL_SERVICES_IN_BOOKING')) { // get all services $objProduct = new Product(); - $serviceProducts = $objProduct->getServiceProducts(); + $serviceProducts = $objProduct->getServiceProducts(true); } else { $objRoomTypeServiceProduct = new RoomTypeServiceProduct(); $serviceProducts = $objRoomTypeServiceProduct->getServiceProductsData($idProduct, 1, 0, false, 2, null); @@ -6549,7 +6552,7 @@ class AdminOrdersControllerCore extends AdminController $response['errors'] = $this->l('You do not have permission to edit this order.'); } - die(json_encode($response)); + $this->ajaxDie(json_encode($response)); } public function ajaxProcessAddExistingRoomServices() @@ -6785,7 +6788,7 @@ class AdminOrdersControllerCore extends AdminController $response['errors'][] = $this->l('You do not have permission to edit this order.'); } - die(json_encode($response)); + $this->ajaxDie(json_encode($response)); } // Add new custom services to room @@ -7103,7 +7106,7 @@ class AdminOrdersControllerCore extends AdminController $response['errors'][] = $this->l('You do not have permission to edit this order.'); } - die(json_encode($response)); + $this->ajaxDie(json_encode($response)); } @@ -7187,7 +7190,7 @@ class AdminOrdersControllerCore extends AdminController $response['errors'] = $this->l('You do not have permission to edit this order.'); } - die(json_encode($response)); + $this->ajaxDie(json_encode($response)); } // Process when admin changes extra demands of any room while order creation process form.tpl diff --git a/modules/hotelreservationsystem/classes/RoomTypeServiceProductCartDetail.php b/modules/hotelreservationsystem/classes/RoomTypeServiceProductCartDetail.php index 59f03b65b..1449888ef 100644 --- a/modules/hotelreservationsystem/classes/RoomTypeServiceProductCartDetail.php +++ b/modules/hotelreservationsystem/classes/RoomTypeServiceProductCartDetail.php @@ -490,6 +490,7 @@ class RoomTypeServiceProductCartDetail extends ObjectModel if ($getTotalPrice) { return $totalPrice; } + return $selectedServiceProducts; } From cbd927ffa50260dab3c91a4ace6fb0231f66eff4 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Tue, 18 Mar 2025 17:27:30 +0530 Subject: [PATCH 08/29] Updated the flow, changed the customer guest detail database, save update and delete process --- .../customers/helpers/view/view.tpl | 32 +++++ .../customers/modals/_customer_guest_form.tpl | 53 ++++++++ .../controllers/customers/modals/index.php | 29 ++++ classes/Customer.php | 28 ++-- ...uestDetail.php => CustomerGuestDetail.php} | 94 ++++++++----- classes/PaymentModule.php | 14 +- .../CheckoutCustomerDetailsStep.php | 4 +- .../AdminCustomerPreferencesController.php | 9 ++ .../admin/AdminCustomersController.php | 118 +++++++++++++++-- controllers/front/AuthController.php | 2 +- controllers/front/IdentityController.php | 3 +- controllers/front/OrderOpcController.php | 3 +- install/data/db_structure.sql | 10 +- install/data/xml/configuration.xml | 3 + js/admin/customers.js | 125 ++++++++++++++++++ .../hotel-reservation-theme/js/order-opc.js | 45 ++++--- themes/hotel-reservation-theme/order-opc.tpl | 15 ++- 17 files changed, 489 insertions(+), 98 deletions(-) create mode 100644 admin/themes/default/template/controllers/customers/modals/_customer_guest_form.tpl create mode 100644 admin/themes/default/template/controllers/customers/modals/index.php rename classes/{CartCustomerGuestDetail.php => CustomerGuestDetail.php} (58%) 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 8213ed88d..432be8ad9 100644 --- a/admin/themes/default/template/controllers/customers/helpers/view/view.tpl +++ b/admin/themes/default/template/controllers/customers/helpers/view/view.tpl @@ -664,6 +664,38 @@ {/if} + {if $customer_guests && count($customer_guests)} +
+
+ + {l s='Customer Guests'} + {count($customer_guests)} +
+ + + + + + + + + + + + {foreach $customer_guests AS $key => $customer_guest} + + + + + + + + + {/foreach} + +
{l s='Email'}{l s='First name'}{l s='Last name'}{l s='phone'}{l s='Actions'}
{$customer_guest['email']}{$customer_guest['firstname']}{$customer_guest['lastname']}{$customer_guest['phone']}
+
+ {/if} diff --git a/admin/themes/default/template/controllers/customers/modals/_customer_guest_form.tpl b/admin/themes/default/template/controllers/customers/modals/_customer_guest_form.tpl new file mode 100644 index 000000000..12e9baa32 --- /dev/null +++ b/admin/themes/default/template/controllers/customers/modals/_customer_guest_form.tpl @@ -0,0 +1,53 @@ +{* +* Since 2010 Webkul. +* +* NOTICE OF LICENSE +* +* All right is reserved, +* Please go through this link for complete license : https://store.webkul.com/license.html +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade this module to newer +* versions in the future. If you wish to customize this module for your +* needs please refer to https://store.webkul.com/customisation-guidelines/ for more information. +* +* @author Webkul IN +* @copyright Since 2010 Webkul IN +* @license https://store.webkul.com/license.html +*} + + diff --git a/admin/themes/default/template/controllers/customers/modals/index.php b/admin/themes/default/template/controllers/customers/modals/index.php new file mode 100644 index 000000000..ccbf6cb72 --- /dev/null +++ b/admin/themes/default/template/controllers/customers/modals/index.php @@ -0,0 +1,29 @@ + +* @copyright 2010-2020 Webkul IN +* @license https://store.webkul.com/license.html +*/ + +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../../../../../../'); +exit; diff --git a/classes/Customer.php b/classes/Customer.php index 2983aa607..6b84f07bd 100644 --- a/classes/Customer.php +++ b/classes/Customer.php @@ -207,7 +207,7 @@ class CustomerCore extends ObjectModel parent::__construct($id); if ($this->email) { - $this->phone = CartCustomerGuestDetail::getCustomerPhone($this->email); + $this->phone = CustomerGuestDetail::getCustomerPhone($this->email, false); } if (Configuration::get('PS_ONE_PHONE_AT_LEAST')) { @@ -264,7 +264,7 @@ class CustomerCore extends ObjectModel } $success = parent::add($autodate, $null_values); $this->updateGroup($this->groupBox); - $this->updateCustomerAdditionalDetails(CartCustomerGuestDetail::getIdCustomerGuest($this->email)); + $this->updateCustomerAdditionalDetails(CustomerGuestDetail::getIdCustomerGuest($this->email, false)); return $success; } @@ -289,20 +289,20 @@ class CustomerCore extends ObjectModel $objOldCustomer = new Customer($this->id); $success = parent::update(true); - $this->updateCustomerAdditionalDetails(CartCustomerGuestDetail::getIdCustomerGuest($objOldCustomer->email)); + $this->updateCustomerAdditionalDetails(CustomerGuestDetail::getIdCustomerGuest($objOldCustomer->email, false)); return $success; } public function updateCustomerAdditionalDetails($idCustomerGuest) { - $objCartCustomerGuestDetail = new CartCustomerGuestDetail($idCustomerGuest); - $objCartCustomerGuestDetail->id_cart = 0; - $objCartCustomerGuestDetail->id_gender = $this->id_gender; - $objCartCustomerGuestDetail->firstname = $this->firstname; - $objCartCustomerGuestDetail->lastname = $this->lastname; - $objCartCustomerGuestDetail->email = $this->email; - $objCartCustomerGuestDetail->phone = $this->phone; - return $objCartCustomerGuestDetail->save(); + $objCustomerGuestDetail = new CustomerGuestDetail($idCustomerGuest); + $objCustomerGuestDetail->id_customer = 0; + $objCustomerGuestDetail->id_gender = $this->id_gender; + $objCustomerGuestDetail->firstname = $this->firstname; + $objCustomerGuestDetail->lastname = $this->lastname; + $objCustomerGuestDetail->email = $this->email; + $objCustomerGuestDetail->phone = $this->phone; + return $objCustomerGuestDetail->save(); } public function delete() @@ -343,8 +343,8 @@ class CustomerCore extends ObjectModel CartRule::deleteByIdCustomer((int)$this->id); // delete customer data from customerGuest table - $objCartCustomerGuestDetail = new CartCustomerGuestDetail(CartCustomerGuestDetail::getIdCustomerGuest($this->email)); - $objCartCustomerGuestDetail->delete(); + $objCustomerGuestDetail = new CustomerGuestDetail(CustomerGuestDetail::getIdCustomerGuest($this->email, false)); + $objCustomerGuestDetail->delete(); return parent::delete(); } @@ -542,7 +542,7 @@ class CustomerCore extends ObjectModel return Db::getInstance()->getValue( 'SELECT cgd.`phone` FROM `'._DB_PREFIX_.'customer` c - INNER JOIN `'._DB_PREFIX_.'cart_customer_guest_detail` cgd + INNER JOIN `'._DB_PREFIX_.'customer_guest_detail` cgd ON (cgd.`email` = c.`email`) WHERE `id_cart` = 0 AND c.`id_customer` = '.(int)($id_customer) ); diff --git a/classes/CartCustomerGuestDetail.php b/classes/CustomerGuestDetail.php similarity index 58% rename from classes/CartCustomerGuestDetail.php rename to classes/CustomerGuestDetail.php index f26e4c795..32f3eb63b 100644 --- a/classes/CartCustomerGuestDetail.php +++ b/classes/CustomerGuestDetail.php @@ -18,10 +18,10 @@ * @license https://store.webkul.com/license.html */ -class CartCustomerGuestDetailCore extends ObjectModel +class CustomerGuestDetailCore extends ObjectModel { public $id_customer_guest_detail; - public $id_cart; + public $id_customer; public $id_gender; public $firstname; public $lastname; @@ -31,10 +31,10 @@ class CartCustomerGuestDetailCore extends ObjectModel public $date_upd; public static $definition = array( - 'table' => 'cart_customer_guest_detail', + 'table' => 'customer_guest_detail', 'primary' => 'id_customer_guest_detail', 'fields' => array( - 'id_cart' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), + 'id_customer' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), 'id_gender' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), 'firstname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'size' => 32), 'lastname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'size' => 32), @@ -49,48 +49,67 @@ class CartCustomerGuestDetailCore extends ObjectModel { return Db::getInstance()->getValue(' SELECT `id_customer_guest_detail` - FROM `'._DB_PREFIX_.'cart_customer_guest_detail` + FROM `'._DB_PREFIX_.'cart_customer_guest` WHERE `id_cart` = '.(int)$id_cart ); } - public function add($auto_date = true, $null_values = false) + public static function saveCartCustomerGuest($idCart, $idCustomerGuestDetail) { - if ($res = parent::add($auto_date, $null_values)) { - $objCart = new Cart($this->id_cart); - Db::getInstance()->insert('customer_guest_detail_mapping', array( - 'id_customer' => (int) $objCart->id_customer, - 'id_customer_guest_detail' => (int)$this->id - )); - } + return Db::getInstance()->insert('cart_customer_guest', array( + 'id_cart' => (int) $idCart, + 'id_customer_guest_detail' => (int) $idCustomerGuestDetail + )); + } - return $res; + public static function deleteCartCustomerGuest($idCart) + { + return Db::getInstance()->delete('cart_customer_guest', + ' `id_cart`='.(int) $idCart + ); + } + + public function deleteCartCustomerGuestByIdGuest() + { + return Db::getInstance()->delete('cart_customer_guest', + ' `id_customer_guest_detail`='.(int) $this->id + ); } public function delete() { - if ($res = parent::delete()) { - $objCart = new Cart($this->id_cart); - Db::getInstance()->delete('customer_guest_detail_mapping', - '`id_customer` = '.(int) $objCart->id_customer.' - AND `id_customer_guest_detail`='.(int) $this->id - ); + $this->deleteCartCustomerGuestByIdGuest(); + + return parent::delete(); + } + + public function deleteCartCustomerGuestByIdCustomer($idCustomer, $offset = 0) + { + $res = true; + if ($guests = $this->getCustomerRelatedGuestDetails($idCustomer, false, false, false, $offset)) { + foreach ($guests as $guest) { + $objCustomerGuestDetail = new CustomerGuestDetail((int) $guest['id_customer_guest_detail']); + $objCustomerGuestDetail->delete(); + } } return $res; } - public function getCustomerRelatedGuestDetails($idCustomer, $firstname = false, $lastname = false, $email = false) + public function getCustomerRelatedGuestDetails($idCustomer, $firstname = false, $lastname = false, $email = false, $offset = 0) { return Db::getInstance()->executeS(' - SELECT cgd.`id_customer_guest_detail`, cgd.`email`, cgd.`firstname`, cgd.`lastname`, cgd.`phone`, cgd.`id_cart` - FROM `'._DB_PREFIX_.'customer_guest_detail_mapping` cgdm - LEFT JOIN `'._DB_PREFIX_.'cart_customer_guest_detail` cgd - ON (cgdm.`id_customer_guest_detail` = cgd.`id_customer_guest_detail`) - WHERE cgdm.`id_customer` = '.(int)$idCustomer. + SELECT cgd.`id_customer_guest_detail`, cgd.`email`, cgd.`firstname`, cgd.`lastname`, cgd.`phone` + FROM `'._DB_PREFIX_.'customer_guest_detail` cgd + LEFT JOIN `'._DB_PREFIX_.'cart_customer_guest` ccg + ON (ccg.`id_customer_guest_detail` = cgd.`id_customer_guest_detail`) + WHERE cgd.`id_customer` = '.(int)$idCustomer. (($firstname !== false && $firstname != '') ? ' AND cgd.`firstname` LIKE "%'.$firstname.'%"' : ' '). (($lastname !== false && $lastname != '') ? ' AND cgd.`lastname` LIKE "%'.$lastname.'%"' : ' '). - (($email !== false && $email != '') ? ' AND cgd.`email` LIKE "%'.$email.'%"' : ' ') + (($email !== false && $email != '') ? ' AND cgd.`email` LIKE "%'.$email.'%"' : ' '). + 'GROUP BY cgd.`id_customer_guest_detail`'. + ' Order BY date_add DESC '. + (($offset) ? ' LIMIT 999999 OFFSET '.(int) $offset : ' ') ); } @@ -98,24 +117,29 @@ class CartCustomerGuestDetailCore extends ObjectModel { return Db::getInstance()->getRow(' SELECT `id_gender`, `firstname`, `lastname`, `email`, `phone` - FROM `'._DB_PREFIX_.'cart_customer_guest_detail` + FROM `'._DB_PREFIX_.'customer_guest_detail` WHERE `id_customer_guest_detail` = '.(int)$id_customer_guest_detail ); } - public static function getIdCustomerGuest($email) + public static function getIdCustomerGuest($email, $idCustomer = null, $idCart = 0) { return Db::getInstance()->getValue( - 'SELECT `id_customer_guest_detail` FROM `'._DB_PREFIX_.'cart_customer_guest_detail` - WHERE `id_cart` = 0 AND `email` = "'.pSQL($email).'"' + 'SELECT cgd.`id_customer_guest_detail` FROM `'._DB_PREFIX_.'customer_guest_detail` as cgd + LEFT JOIN `'._DB_PREFIX_.'cart_customer_guest` ccg + ON ccg.`id_customer_guest_detail` = cgd.`id_customer_guest_detail` + WHERE cgd.`email` = "'.pSQL($email).'"'. + (!is_null($idCart) ? ' AND (ccg.`id_cart` = '.(int) $idCart.' '. (($idCart) ? ')' : ' OR ISNULL(ccg.`id_cart`)) ') : ' '). + (!is_null($idCustomer) ? ' AND cgd.`id_customer` = '.(int) $idCustomer : ' ') ); } - public static function getCustomerPhone($email) + public static function getCustomerPhone($email, $idCustomer = null) { return Db::getInstance()->getValue( - 'SELECT `phone` FROM `'._DB_PREFIX_.'cart_customer_guest_detail` - WHERE `id_cart` = 0 AND `email` = "'.pSQL($email).'"' + 'SELECT `phone` FROM `'._DB_PREFIX_.'customer_guest_detail` + WHERE 1 AND `email` = "'.pSQL($email).'"'. + (!is_null($idCustomer) ? ' AND `id_customer` ='.(int) $idCustomer: ' ') ); } @@ -135,7 +159,7 @@ class CartCustomerGuestDetailCore extends ObjectModel $isValid = false; } - $className = 'CartCustomerGuestDetail'; + $className = 'CustomerGuestDetail'; $rules = call_user_func(array($className, 'getValidationRules'), $className); if (isset($rules['size']['firstname'])) { diff --git a/classes/PaymentModule.php b/classes/PaymentModule.php index 516a755ab..7b4dcb80c 100644 --- a/classes/PaymentModule.php +++ b/classes/PaymentModule.php @@ -400,16 +400,16 @@ abstract class PaymentModuleCore extends Module } // save customer guest information - if ($id_customer_guest_detail = CartCustomerGuestDetail::getCartCustomerGuest($this->context->cart->id)) { - if (Validate::isLoadedObject($objCartCustomerGuestDetail = new CartCustomerGuestDetail( + if ($id_customer_guest_detail = CustomerGuestDetail::getCartCustomerGuest($this->context->cart->id)) { + if (Validate::isLoadedObject($objCustomerGuestDetail = new CustomerGuestDetail( $id_customer_guest_detail ))) { $objOrderCustomerGuestDetail = new OrderCustomerGuestDetail(); - $objOrderCustomerGuestDetail->id_gender = $objCartCustomerGuestDetail->id_gender; - $objOrderCustomerGuestDetail->firstname = $objCartCustomerGuestDetail->firstname; - $objOrderCustomerGuestDetail->lastname = $objCartCustomerGuestDetail->lastname; - $objOrderCustomerGuestDetail->email = $objCartCustomerGuestDetail->email; - $objOrderCustomerGuestDetail->phone = $objCartCustomerGuestDetail->phone; + $objOrderCustomerGuestDetail->id_gender = $objCustomerGuestDetail->id_gender; + $objOrderCustomerGuestDetail->firstname = $objCustomerGuestDetail->firstname; + $objOrderCustomerGuestDetail->lastname = $objCustomerGuestDetail->lastname; + $objOrderCustomerGuestDetail->email = $objCustomerGuestDetail->email; + $objOrderCustomerGuestDetail->phone = $objCustomerGuestDetail->phone; $objOrderCustomerGuestDetail->id_order = (int)$order->id; $objOrderCustomerGuestDetail->save(); } diff --git a/classes/checkoutProcess/CheckoutCustomerDetailsStep.php b/classes/checkoutProcess/CheckoutCustomerDetailsStep.php index 6bccd6e83..a51cb3169 100644 --- a/classes/checkoutProcess/CheckoutCustomerDetailsStep.php +++ b/classes/checkoutProcess/CheckoutCustomerDetailsStep.php @@ -39,9 +39,9 @@ class CheckoutCustomerDetailsStepCore extends AbstractCheckoutStepCore } } elseif (Tools::getValue('proceed_to_payment')) { $guestInfoComplete = true; - if ($id_customer_guest_detail = CartCustomerGuestDetail::getCartCustomerGuest($this->context->cart->id)) { + if ($id_customer_guest_detail = CustomerGuestDetail::getCartCustomerGuest($this->context->cart->id)) { $guestInfoComplete = false; - $objCustomerGuestDetail = new CartCustomerGuestDetail($id_customer_guest_detail); + $objCustomerGuestDetail = new CustomerGuestDetail($id_customer_guest_detail); if ($objCustomerGuestDetail->validateGuestInfo()) { $guestInfoComplete = true; } diff --git a/controllers/admin/AdminCustomerPreferencesController.php b/controllers/admin/AdminCustomerPreferencesController.php index 0526cc277..14d091f91 100644 --- a/controllers/admin/AdminCustomerPreferencesController.php +++ b/controllers/admin/AdminCustomerPreferencesController.php @@ -121,6 +121,15 @@ class AdminCustomerPreferencesControllerCore extends AdminController 'cast' => 'intval', 'type' => 'bool' ), + 'PS_CUSTOMER_GUEST_MAX_NUM' => array( + 'title' => $this->l('Maximum Customers guests'), + 'hint' => $this->l('Maximum number of guests a customer can add using the "booking for someone else" feature. Set as 0 for no limit.'), + 'validation' => 'isUnsignedInt', + 'cast' => 'intval', + 'size' => 5, + 'type' => 'text', + 'class' => 'fixed-width-xl', + ), ), 'submit' => array( 'title' => $this->l('Save'), diff --git a/controllers/admin/AdminCustomersController.php b/controllers/admin/AdminCustomersController.php index c8e20a62e..381a7cde2 100644 --- a/controllers/admin/AdminCustomersController.php +++ b/controllers/admin/AdminCustomersController.php @@ -939,6 +939,9 @@ class AdminCustomersControllerCore extends AdminController $customerLanguage = new Language($customer->id_lang); $shop = new Shop($customer->id_shop); + + $objCustomerGuestDetail = new CustomerGuestDetail(); + $customerGuests = $objCustomerGuestDetail->getCustomerRelatedGuestDetails($customer->id); $this->tpl_view_vars = array( 'customer' => $customer, 'gender' => $gender, @@ -985,7 +988,8 @@ class AdminCustomersControllerCore extends AdminController 'connections' => $connections, // Referrers 'referrers' => $referrers, - 'show_toolbar' => true + 'show_toolbar' => true, + 'customer_guests' => $customerGuests, ); return parent::renderView(); } @@ -1002,11 +1006,11 @@ class AdminCustomersControllerCore extends AdminController $this->errors[] = Tools::displayError('Some error ocurred while deleting the Customer'); return; } else { - if ($idCustomerGuest = CartCustomerGuestDetail::getIdCustomerGuest($customerEmail)) { - $objCartCustomerGuestDetail = new CartCustomerGuestDetail($idCustomerGuest); - $objCartCustomerGuestDetail->phone = preg_replace('/[0-9]/', '0', $objCustomer->phone); - $objCartCustomerGuestDetail->email = $objCustomer->email; - $objCartCustomerGuestDetail->save(); + if ($idCustomerGuest = CustomerGuestDetail::getIdCustomerGuest($customerEmail, false)) { + $objCustomerGuestDetail = new CustomerGuestDetail($idCustomerGuest); + $objCustomerGuestDetail->phone = preg_replace('/[0-9]/', '0', $objCustomer->phone); + $objCustomerGuestDetail->email = $objCustomer->email; + $objCustomerGuestDetail->save(); } } @@ -1176,7 +1180,7 @@ class AdminCustomersControllerCore extends AdminController $this->errors[] = Tools::displayError('Phone number is required.'); } } - $className = 'CartCustomerGuestDetail'; + $className = 'CustomerGuestDetail'; $rules = call_user_func(array($className, 'getValidationRules'), $className); if ($phone && !Validate::isPhoneNumber($phone)) { $this->errors[] = Tools::displayError('Invaid phone number.'); @@ -1389,17 +1393,113 @@ class AdminCustomersControllerCore extends AdminController $this->ajaxDie(json_encode($response)); } + public function ajaxProcessInitGuestModal() + { + $response['hasError'] = 1; + if (Validate::isLoadedObject($objCustomerGuestDetail = new CustomerGuestDetail((int) Tools::getValue('id_customer_guest_detail')))) { + $this->context->smarty->assign( + array( + 'genders' => Gender::getGenders(), + 'customerGuestDetail' => $objCustomerGuestDetail, + ) + ); + $modal = array( + 'modal_id' => 'customer-guest-modal', + 'modal_class' => 'customer_guest_modal', + 'modal_title' => '  '.$this->l('Guest details'), + 'modal_content' => $this->context->smarty->fetch('controllers/customers/modals/_customer_guest_form.tpl'), + 'modal_actions' => array( + array( + 'type' => 'button', + 'value' => 'submitGuestInfo', + 'class' => 'submitGuestInfoInfo btn-primary pull-right', + 'label' => ' '.$this->l('Save Guest'), + ), + ), + ); + + $this->context->smarty->assign($modal); + $response['hasError'] = 0; + $response['modalHtml'] = $this->context->smarty->fetch('modal.tpl'); + } + + $this->ajaxDie(json_encode($response)); + } + + + public function ajaxProcessUpdateGuestDetails() + { + $response = array('hasError' => 0, 'errors' => array()); + // Check tab access is allowed to edit + if ($this->tabAccess['edit'] == 1) { + if (Validate::isLoadedObject($objCustomerGuestDetail = new CustomerGuestDetail((int) Tools::getValue('id_customer_guest_detail')))) { + $objCustomerGuestDetail->id_gender = Tools::getValue('id_gender'); + $objCustomerGuestDetail->firstname = Tools::getValue('firstname'); + $objCustomerGuestDetail->lastname = Tools::getValue('lastname'); + $objCustomerGuestDetail->phone = Tools::getValue('phone'); + if ($objCustomerGuestDetail->save()) { + $gender = new Gender($objCustomerGuestDetail->id_gender, $this->context->language->id); + $response['data']['gender'] = $gender->name; + $response['data']['firstname'] = $objCustomerGuestDetail->firstname; + $response['data']['lastname'] = $objCustomerGuestDetail->lastname ; + $response['data']['email'] = $objCustomerGuestDetail->email; + $response['data']['phone'] = $objCustomerGuestDetail->phone; + $response['data']['id'] = $objCustomerGuestDetail->id; + $response['msg'] = $this->l('Guest details are updated.'); + } else { + $response['errors'][] = $this->l('Unable to save guest details.'); + } + } else { + $response['errors'][] = $this->l('Guest details not found.'); + } + } else { + $response['errors'][] = $this->l('You do not have permission to edit this.'); + } + + if ($response['errors']) { + $response['hasError'] = 1; + $this->context->smarty->assign('errors', $response['errors']); + $response['errorsHtml'] = $this->context->smarty->fetch('alerts.tpl'); + } + + $this->ajaxDie(json_encode($response)); + } + + public function ajaxProcessDeleteGuest() + { + $response = array('hasError' => 1, 'errors' => array()); + // Check tab access is allowed to edit + if ($this->tabAccess['delete'] == 1) { + if (Validate::isLoadedObject($objCustomerGuestDetail = new CustomerGuestDetail((int) Tools::getValue('id_customer_guest_detail')))) { + if ($objCustomerGuestDetail->delete()) { + $response['hasError'] = false; + $response['msg'] = $this->l('Successful deletion.'); + } else { + $response['msg'] = $this->l('Unable to delete guest details.'); + } + } else { + $response['msg'] = $this->l('Guest details not found.'); + } + } else { + $response['msg'] = $this->l('You do not have permission to delete this.'); + } + + $this->ajaxDie(json_encode($response)); + } + public function setMedia() { parent::setMedia(); if ($this->loadObject(true) - && ($this->display == 'edit' || $this->display == 'add') + && ($this->display == 'edit' || $this->display == 'add' || $this->display == 'view') ) { $idCustomer = $this->object->id ? $this->object->id : 0; Media::addJSDef( array( 'customer_controller_url' => self::$currentIndex.'&token='.$this->token, - 'id_customer' => $idCustomer + 'id_customer' => $idCustomer, + 'txtSomeErr' => $this->l('Some error occurred. Please try again.', null, true), + 'confirmTxt' => $this->l('Are you sure you want to delete this guest details?', null, true) ) ); $this->addJS(_PS_JS_DIR_.'admin/customers.js'); diff --git a/controllers/front/AuthController.php b/controllers/front/AuthController.php index ff254b67a..573ba8a0f 100644 --- a/controllers/front/AuthController.php +++ b/controllers/front/AuthController.php @@ -422,7 +422,7 @@ class AuthControllerCore extends FrontController $addresses_types[] = 'address_invoice'; } - $className = 'CartCustomerGuestDetail'; + $className = 'CustomerGuestDetail'; $rules = call_user_func(array($className, 'getValidationRules'), $className); if (Configuration::get('PS_ONE_PHONE_AT_LEAST') && !Tools::getValue('phone')) { $this->errors[] = Tools::displayError('Phone number is required.'); diff --git a/controllers/front/IdentityController.php b/controllers/front/IdentityController.php index 65ce13b27..04fb339de 100644 --- a/controllers/front/IdentityController.php +++ b/controllers/front/IdentityController.php @@ -88,7 +88,8 @@ class IdentityControllerCore extends FrontController $this->errors[] = Tools::displayError('Phone number is required.'); } } - $className = 'CartCustomerGuestDetail'; + + $className = 'CustomerGuestDetail'; $rules = call_user_func(array($className, 'getValidationRules'), $className); if ($phone && !Validate::isPhoneNumber($phone)) { $this->errors[] = Tools::displayError('Invaid phone number.'); diff --git a/controllers/front/OrderOpcController.php b/controllers/front/OrderOpcController.php index d8baeb03c..ba225a5e9 100644 --- a/controllers/front/OrderOpcController.php +++ b/controllers/front/OrderOpcController.php @@ -119,7 +119,8 @@ class OrderOpcControllerCore extends ParentOrderController if (Configuration::get('PS_ONE_PHONE_AT_LEAST') && !$phone) { $this->errors[] = Tools::displayError('Phone number is a required field.', false); } - $className = 'CartCustomerGuestDetail'; + + $className = 'CustomerGuestDetail'; $rules = call_user_func(array($className, 'getValidationRules'), $className); if (!Validate::isPhoneNumber($phone)) { $this->errors[] = Tools::displayError('Please enter a valid Mobile phone number.', false); diff --git a/install/data/db_structure.sql b/install/data/db_structure.sql index b21a85bfd..ab0c0b31e 100644 --- a/install/data/db_structure.sql +++ b/install/data/db_structure.sql @@ -686,9 +686,9 @@ CREATE TABLE `PREFIX_order_customer_guest_detail` ( PRIMARY KEY (`id_order_customer_guest_detail`) ) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8 COLLATION; -CREATE TABLE `PREFIX_cart_customer_guest_detail` ( +CREATE TABLE `PREFIX_customer_guest_detail` ( `id_customer_guest_detail` int(10) unsigned NOT NULL auto_increment, - `id_cart` int(10) unsigned NOT NULL, + `id_customer` int(10) unsigned NOT NULL, `id_gender` int(10) unsigned NOT NULL, `firstname` varchar(32) NOT NULL, `lastname` varchar(32) NOT NULL, @@ -699,10 +699,10 @@ CREATE TABLE `PREFIX_cart_customer_guest_detail` ( PRIMARY KEY (`id_customer_guest_detail`) ) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8 COLLATION; -CREATE TABLE `PREFIX_customer_guest_detail_mapping` ( +CREATE TABLE `PREFIX_cart_customer_guest` ( `id_customer_guest_detail` int(10) unsigned NOT NULL, - `id_customer` int(10) unsigned NOT NULL, - PRIMARY KEY (`id_customer_guest_detail`, `id_customer`) + `id_cart` int(10) unsigned NOT NULL, + PRIMARY KEY (`id_customer_guest_detail`, `id_cart`) ) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8 COLLATION; CREATE TABLE `PREFIX_customization` ( diff --git a/install/data/xml/configuration.xml b/install/data/xml/configuration.xml index 490e2b691..7dae52982 100644 --- a/install/data/xml/configuration.xml +++ b/install/data/xml/configuration.xml @@ -946,6 +946,9 @@ 0 + + + 5 diff --git a/js/admin/customers.js b/js/admin/customers.js index 5eaa94c7d..d29e97ed7 100644 --- a/js/admin/customers.js +++ b/js/admin/customers.js @@ -48,4 +48,129 @@ $(document).ready(function() { }); } }); + + $(document).on('click', '.edit-customer-guest-detail', function(e) { + e.preventDefault(); + GuestModal.show($(this).data('id_customer_guest_detail')); + }); + $(document).on('click', '.delete-customer-guest-detail', function(e) { + e.preventDefault(); + if (confirm(confirmTxt)) { + GuestModal.deleteGuest($(this).data('id_customer_guest_detail')); + } + }); + + const GuestModal = { + show: function(id_customer_guest_detail) { + $("#page-loader").show(); + $('#customer-guest-modal').remove(); + $.ajax({ + url: customer_controller_url, + method: 'POST', + dataType: 'json', + data: { + ajax : 1, + id_customer_guest_detail: id_customer_guest_detail, + action: 'InitGuestModal' + }, + beforeSend: function() { + $("#page-loader").show(); + }, + success: function(result) { + if (result.hasError == 0 && result.modalHtml) { + $('#footer').next('.bootstrap').append(result.modalHtml); + $('#customer-guest-modal').modal('show'); + } else { + showErrorMessage(txtSomeErr); + } + }, + complete: function() { + $("#page-loader").hide(); + } + }); + }, + close: function() { + $('#customer-guest-modal').modal('hide'); + }, + submit: function() { + $("#page-loader").show(); + GuestModal.hideErrors(); + $.ajax({ + headers: { + "cache-control": "no-cache" + }, + url: customer_controller_url, + method: 'POST', + dataType: 'json', + cache: false, + data: $('#customer-guest-details-form').serialize()+'&ajax=true&action=updateGuestDetails', + success: function(result) { + if (result.hasError == true) { + GuestModal.showErrors(result.errorsHtml); + } else { + if (result.msg) { + showSuccessMessage(result.msg); + } + let tr = $(''); + tr.append('' + result.data.email + '') + .append('' + result.data.firstname + '') + .append('' + result.data.lastname + '') + .append('' + result.data.phone + '') + .append('') + .append(''); + $('.customer_guest_detail_'+result.data.id).html($(tr).html()); + } + }, + complete: function() { + $("#page-loader").hide(); + } + }); + }, + deleteGuest: function(id_customer_guest_detail) { + $("#page-loader").show(); + GuestModal.hideErrors(); + $.ajax({ + headers: { + "cache-control": "no-cache" + }, + url: customer_controller_url, + method: 'POST', + dataType: 'json', + cache: false, + data: { + ajax : 1, + id_customer_guest_detail: id_customer_guest_detail, + action: 'DeleteGuest' + }, + success: function(result) { + if (result.hasError == true) { + showErrorMessage(result.msg); + } else if (result.msg) { + showSuccessMessage(result.msg); + $('.customer_guest_detail_'+id_customer_guest_detail).remove(); + if ($('.customer_guest_details').length == 0) { + $('.customer-guests').closest('.panel').hide(); + } else { + $('.customer-guests-count').text(parseInt($('.customer_guest_details').length)); + } + } + }, + complete: function() { + $("#page-loader").hide(); + } + }); + }, + showErrors: function(errorsHtml) { + $('#customer-guest-modal .errors-wrap').html(errorsHtml); + $('#customer-guest-modal .errors-wrap').show(200); + }, + hideErrors: function(cb) { + $('#customer-guest-modal .errors-wrap').hide(200); + $('#customer-guest-modal .errors-wrap').html(''); + } + }; + $(document).on('click', '.submitGuestInfoInfo', function(e) { + e.preventDefault(); + GuestModal.submit(); + }); }); diff --git a/themes/hotel-reservation-theme/js/order-opc.js b/themes/hotel-reservation-theme/js/order-opc.js index c8af2ab06..df1ea54ac 100644 --- a/themes/hotel-reservation-theme/js/order-opc.js +++ b/themes/hotel-reservation-theme/js/order-opc.js @@ -94,9 +94,11 @@ $(document).ready(function() if ($("#customer_guest_detail:checked").val() == 1) { $('#checkout-guest-info-block').hide('slow'); $('#customer-guest-detail-container').show('slow'); + $('#customer_guest_detail_errors').show('slow'); } else { $('#customer-guest-detail-container').hide('slow'); $('#checkout-guest-info-block').show('slow'); + $('#customer_guest_detail_errors').hide('hide'); } } function validateCustomerGuestDetailForm() { @@ -115,30 +117,24 @@ $(document).ready(function() if ($("#customer_guest_detail:checked").val() == 1) { validateCustomerGuestDetailForm(); } - - function submitCustomerGuestDetailForm(postData) { - $.ajax({ - type: 'POST', - url: orderOpcUrl, - async: false, - cache: false, - dataType : "json", - data: postData - }); - } - - $('#customer_guest_detail_form').on('change', function(e) { - let postData = $(this).serialize()+'&method=submitCustomerGuestDetail&ajax=true&token=' + static_token; - submitCustomerGuestDetailForm(postData); + $(document).on('click', '.submit-guest-details', function(e) { + e.preventDefault(); + if ($('#customer_guest_detail').prop('checked')) { + validateCustomerGuestDetailForm(); + if ($('#customer_guest_detail_form').find('.form-error').length == 0) { + $('#customer_guest_detail_form').get(0).submit(); + } + } else { + $('#customer_guest_detail_form').get(0).submit(); + } }); + function setCustomerGuestDetailForm(guestDetail) { $('#customer_guest_detail_firstname').val(guestDetail.firstname); $('#customer_guest_detail_lastname').val(guestDetail.lastname); $('#customer_guest_detail_email').val(guestDetail.email); $('#customer_guest_detail_phone').val(guestDetail.phone); validateCustomerGuestDetailForm(); - let postData = $('#customer_guest_detail_form').serialize()+'&method=submitCustomerGuestDetail&ajax=true&token=' + static_token; - submitCustomerGuestDetailForm(postData); $('.customer_guest_detail_ul').remove(); } @@ -194,9 +190,17 @@ $(document).ready(function() $('.customer_guest_detail_ul').remove(); clearTimeout(debounceTimeout); // Clear the existing timeout debounceTimeout = setTimeout(() => { - let firstName = $('#customer_guest_detail_firstname').val(); - let lastName = $('#customer_guest_detail_lastname').val(); - let email = $('#customer_guest_detail_email').val(); + let firstName = ''; + let lastName = ''; + let email = ''; + if ($(e.target).prop('id') == 'customer_guest_detail_firstname') { + firstName = $('#customer_guest_detail_firstname').val() + } else if ($(e.target).prop('id') == 'customer_guest_detail_lastname') { + lastName = $('#customer_guest_detail_lastname').val() + } else if ($(e.target).prop('id') == 'customer_guest_detail_email') { + email = $('#customer_guest_detail_email').val() + } + let targetElem = $(this); customerGuestDetailAjax = $.ajax({ type: 'POST', @@ -220,7 +224,6 @@ $(document).ready(function() $(itemElem).attr('data-guest_detail', JSON.stringify(guestDetail)); $(listElem).append(itemElem); }); - $(targetElem).closest('.form-group').append($(listElem).prop('outerHTML')); } } diff --git a/themes/hotel-reservation-theme/order-opc.tpl b/themes/hotel-reservation-theme/order-opc.tpl index 3f342c077..f412b1bee 100644 --- a/themes/hotel-reservation-theme/order-opc.tpl +++ b/themes/hotel-reservation-theme/order-opc.tpl @@ -98,11 +98,22 @@ {if $is_logged || $isGuest} {if $is_logged} {block name='order_opc_guest_detail_form'} -
+ +

+ {if isset($customerGuestDetailErrors) && $customerGuestDetailErrors} +
+

{if $customerGuestDetailErrors|@count > 1}{l s='There are %d errors' sprintf=$customerGuestDetailErrors|@count}{else}{l s='There is %d error' sprintf=$customerGuestDetailErrors|@count}{/if}

+
    + {foreach from=$customerGuestDetailErrors key=k item=customerGuestDetailError} +
  1. {$customerGuestDetailError}
  2. + {/foreach} +
+
+ {/if}
@@ -173,7 +184,7 @@
- + {l s='Proceed'} From bc7339e073dcdb5b43bd7330b95410691ad6f2d6 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Tue, 18 Mar 2025 17:35:52 +0530 Subject: [PATCH 09/29] Updated the flow for customer guest creation and deletion process --- controllers/front/OrderOpcController.php | 109 ++++++++++++----------- 1 file changed, 57 insertions(+), 52 deletions(-) diff --git a/controllers/front/OrderOpcController.php b/controllers/front/OrderOpcController.php index ba225a5e9..063ed9494 100644 --- a/controllers/front/OrderOpcController.php +++ b/controllers/front/OrderOpcController.php @@ -388,10 +388,6 @@ class OrderOpcControllerCore extends ParentOrderController $this->ajaxDie($this->changeRoomDemands()); exit; break; - case 'submitCustomerGuestDetail': - $this->ajaxDie($this->submitCustomerGuestDetail()); - exit; - break; case 'getCustomerGuestDetail': $this->ajaxDie($this->getCustomerGuestDetail()); exit; @@ -443,6 +439,10 @@ class OrderOpcControllerCore extends ParentOrderController parent::initContent(); + if (Tools::getValue('submitGuestDetails')) { + $this->submitCustomerGuestDetail(); + } + /* id_carrier is not defined in database before choosing a carrier, set it to a default one to match a potential cart _rule */ if (empty($this->context->cart->id_carrier)) { $checked = $this->context->cart->simulateCarrierSelectedOutput(); @@ -556,9 +556,9 @@ class OrderOpcControllerCore extends ParentOrderController $this->_assignPayment(); // GUEST BOOKING if ($this->isLogged) { - if ($id_customer_guest_detail = CartCustomerGuestDetail::getCartCustomerGuest($this->context->cart->id)) { + if ($id_customer_guest_detail = CustomerGuestDetail::getCartCustomerGuest($this->context->cart->id)) { $this->context->smarty->assign( - 'customer_guest_detail', CartCustomerGuestDetail::getCustomerGuestDetail($id_customer_guest_detail) + 'customer_guest_detail', CustomerGuestDetail::getCustomerGuestDetail($id_customer_guest_detail) ); } $this->context->smarty->assign('id_customer_guest_detail', $id_customer_guest_detail); @@ -1080,23 +1080,14 @@ class OrderOpcControllerCore extends ParentOrderController $firstname = trim(Tools::getValue('firstname')); $lastname = trim(Tools::getValue('lastname')); $email = trim(Tools::getValue('email')); - $objCartCustomerGuestDetail = new CartCustomerGuestDetailCore(); - if ($guestDetails = $objCartCustomerGuestDetail->getCustomerRelatedGuestDetails( + $objCustomerGuestDetail = new CustomerGuestDetail(); + if ($guestDetails = $objCustomerGuestDetail->getCustomerRelatedGuestDetails( $this->context->cart->id_customer, $firstname, $lastname, $email, )) { $response['status'] = true; - $detailsExist = array(); - foreach ($guestDetails as $guestKey => $guestDetail) { - $joinKey = trim($guestDetail['firstname']).trim($guestDetail['lastname']).trim($guestDetail['email']); - if ($guestDetail['id_cart'] == $this->context->cart->id || isset($detailsExist[$joinKey])) { - unset($guestDetails[$guestKey]); - } - $detailsExist[$joinKey] = true; - } - $response['guestDetails'] = $guestDetails; } @@ -1110,71 +1101,85 @@ class OrderOpcControllerCore extends ParentOrderController $this->context->cookie->__set('customer_details_proceeded', 0); $this->context->cookie->checkedTOS = false; if ($customerGuestDetail) { - if ($id_customer_guest_detail = CartCustomerGuestDetail::getCartCustomerGuest($this->context->cart->id)) { - $objCustomerGuestDetail = new CartCustomerGuestDetail($id_customer_guest_detail); - } else { - $objCustomerGuestDetail = new CartCustomerGuestDetail(); - } - + $customerGuestDetailErrors = array(); $customerGuestDetailGender = Tools::getValue('customer_guest_detail_gender'); $customerGuestDetailFirstname = Tools::getValue('customer_guest_detail_firstname'); $customerGuestDetailLastname = Tools::getValue('customer_guest_detail_lastname'); $customerGuestDetailEmail = Tools::getValue('customer_guest_detail_email'); $customerGuestDetailPhone = Tools::getValue('customer_guest_detail_phone'); - - $className = 'CartCustomerGuestDetail'; - $rules = call_user_func(array($className, 'getValidationRules'), $className); - - if (trim($customerGuestDetailGender) && Validate::isUnsignedInt($customerGuestDetailGender)) { - $objCustomerGuestDetail->id_gender = $customerGuestDetailGender; + if ($id_customer_guest_detail = CustomerGuestDetail::getIdCustomerGuest($customerGuestDetailEmail, $this->context->cart->id)) { + $objCustomerGuestDetail = new CustomerGuestDetail($id_customer_guest_detail); + } else if ($id_customer_guest_detail = CustomerGuestDetail::getIdCustomerGuest($customerGuestDetailEmail, $this->context->customer->id, null)) { + $objCustomerGuestDetail = new CustomerGuestDetail($id_customer_guest_detail); } else { - $result['errors']['customer_guest_detail_gender'] = Tools::displayError('Invalid gender'); + $objCustomerGuestDetail = new CustomerGuestDetail(); } - if (trim($customerGuestDetailFirstname) - && Validate::isName($customerGuestDetailFirstname) - && (!isset($rules['size']['firstname']) + $className = 'CustomerGuestDetail'; + $rules = call_user_func(array($className, 'getValidationRules'), $className); + + if (!(trim($customerGuestDetailGender) || !Validate::isUnsignedInt($customerGuestDetailGender))) { + $customerGuestDetailErrors[] = Tools::displayError('Invalid gender'); + } + + if (!trim($customerGuestDetailFirstname) + || !Validate::isName($customerGuestDetailFirstname) + || !(!isset($rules['size']['firstname']) || (isset($rules['size']['firstname']) && (Tools::strlen(trim($customerGuestDetailFirstname)) <= $rules['size']['firstname'])) ) ) { - $objCustomerGuestDetail->firstname = $customerGuestDetailFirstname; + $customerGuestDetailErrors[] = Tools::displayError('Invalid first name'); } - if (trim($customerGuestDetailLastname) - && Validate::isName($customerGuestDetailLastname) - && (!isset($rules['size']['lastname']) + if (!trim($customerGuestDetailLastname) + || !Validate::isName($customerGuestDetailLastname) + || !(!isset($rules['size']['lastname']) || (isset($rules['size']['lastname']) && (Tools::strlen(trim($customerGuestDetailLastname)) <= $rules['size']['lastname'])) ) ) { - $objCustomerGuestDetail->lastname = $customerGuestDetailLastname; + $customerGuestDetailErrors[] = Tools::displayError('Invalid last name'); } - if (trim($customerGuestDetailEmail) - && Validate::isEmail($customerGuestDetailEmail) - && (!isset($rules['size']['email']) + if (!trim($customerGuestDetailEmail) + || !Validate::isEmail($customerGuestDetailEmail) + || !(!isset($rules['size']['email']) || (isset($rules['size']['email']) && (Tools::strlen(trim($customerGuestDetailEmail)) <= $rules['size']['email'])) ) ) { - $objCustomerGuestDetail->email = $customerGuestDetailEmail; + $customerGuestDetailErrors[] = Tools::displayError('Invalid email'); } - if (trim($customerGuestDetailPhone) - && Validate::isPhoneNumber($customerGuestDetailPhone) - && (!isset($rules['size']['phone']) + if (!trim($customerGuestDetailPhone) + || !Validate::isPhoneNumber($customerGuestDetailPhone) + || !(!isset($rules['size']['phone']) || (isset($rules['size']['phone']) && (Tools::strlen(trim($customerGuestDetailPhone)) <= $rules['size']['phone'])) ) ) { - $objCustomerGuestDetail->phone = $customerGuestDetailPhone; + $customerGuestDetailErrors[] = Tools::displayError('Invalid phone'); } - $objCustomerGuestDetail->id_cart = $this->context->cart->id; - $objCustomerGuestDetail->save(); - } else { - if ($id_customer_guest_detail = CartCustomerGuestDetail::getCartCustomerGuest($this->context->cart->id)) { - if (Validate::isLoadedObject($objCustomerGuestDetail = new CartCustomerGuestDetail($id_customer_guest_detail))) { - $objCustomerGuestDetail->delete(); + if (empty($customerGuestDetailErrors)) { + $objCustomerGuestDetail->id_gender = $customerGuestDetailGender; + $objCustomerGuestDetail->firstname = $customerGuestDetailFirstname; + $objCustomerGuestDetail->lastname = $customerGuestDetailLastname; + $objCustomerGuestDetail->email = $customerGuestDetailEmail; + $objCustomerGuestDetail->phone = $customerGuestDetailPhone; + $objCustomerGuestDetail->id_customer = $this->context->customer->id; + if ($objCustomerGuestDetail->save()) { + if ($maxGuestAccountAllowed = Configuration::get('PS_CUSTOMER_GUEST_MAX_NUM')) { + $objCustomerGuestDetail->deleteCartCustomerGuestByIdCustomer($this->context->cart->id_customer, $maxGuestAccountAllowed); + } + // To prevent duplications for the same cart. + CustomerGuestDetail::deleteCartCustomerGuest($this->context->cart->id); + CustomerGuestDetail::saveCartCustomerGuest($this->context->cart->id, $objCustomerGuestDetail->id); + Tools::redirect($this->context->link->getPageLink('order-opc', null, $this->context->language->id, array('proceed_to_payment' => 1))); } } + + $this->context->smarty->assign('customerGuestDetailErrors', $customerGuestDetailErrors); + } else { + CustomerGuestDetail::deleteCartCustomerGuest($this->context->cart->id); + Tools::redirect($this->context->link->getPageLink('order-opc', null, $this->context->language->id, array('proceed_to_payment' => 1))); } $this->context->cart->save(); From dd9d4be23ead5aa89e79b5babea3d56ebcdaedef Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Tue, 18 Mar 2025 17:40:24 +0530 Subject: [PATCH 10/29] updated some function names according to their working --- classes/CustomerGuestDetail.php | 6 +++--- controllers/admin/AdminCustomersController.php | 2 +- controllers/front/OrderOpcController.php | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/classes/CustomerGuestDetail.php b/classes/CustomerGuestDetail.php index 32f3eb63b..2bc07b422 100644 --- a/classes/CustomerGuestDetail.php +++ b/classes/CustomerGuestDetail.php @@ -83,10 +83,10 @@ class CustomerGuestDetailCore extends ObjectModel return parent::delete(); } - public function deleteCartCustomerGuestByIdCustomer($idCustomer, $offset = 0) + public function deleteCustomerGuestByIdCustomer($idCustomer, $offset = 0) { $res = true; - if ($guests = $this->getCustomerRelatedGuestDetails($idCustomer, false, false, false, $offset)) { + if ($guests = $this->getCustomerGuestsByIdCustomer($idCustomer, false, false, false, $offset)) { foreach ($guests as $guest) { $objCustomerGuestDetail = new CustomerGuestDetail((int) $guest['id_customer_guest_detail']); $objCustomerGuestDetail->delete(); @@ -96,7 +96,7 @@ class CustomerGuestDetailCore extends ObjectModel return $res; } - public function getCustomerRelatedGuestDetails($idCustomer, $firstname = false, $lastname = false, $email = false, $offset = 0) + public function getCustomerGuestsByIdCustomer($idCustomer, $firstname = false, $lastname = false, $email = false, $offset = 0) { return Db::getInstance()->executeS(' SELECT cgd.`id_customer_guest_detail`, cgd.`email`, cgd.`firstname`, cgd.`lastname`, cgd.`phone` diff --git a/controllers/admin/AdminCustomersController.php b/controllers/admin/AdminCustomersController.php index 381a7cde2..b9523a9bc 100644 --- a/controllers/admin/AdminCustomersController.php +++ b/controllers/admin/AdminCustomersController.php @@ -941,7 +941,7 @@ class AdminCustomersControllerCore extends AdminController $shop = new Shop($customer->id_shop); $objCustomerGuestDetail = new CustomerGuestDetail(); - $customerGuests = $objCustomerGuestDetail->getCustomerRelatedGuestDetails($customer->id); + $customerGuests = $objCustomerGuestDetail->getCustomerGuestsByIdCustomer($customer->id); $this->tpl_view_vars = array( 'customer' => $customer, 'gender' => $gender, diff --git a/controllers/front/OrderOpcController.php b/controllers/front/OrderOpcController.php index 063ed9494..ac66b6486 100644 --- a/controllers/front/OrderOpcController.php +++ b/controllers/front/OrderOpcController.php @@ -1081,7 +1081,7 @@ class OrderOpcControllerCore extends ParentOrderController $lastname = trim(Tools::getValue('lastname')); $email = trim(Tools::getValue('email')); $objCustomerGuestDetail = new CustomerGuestDetail(); - if ($guestDetails = $objCustomerGuestDetail->getCustomerRelatedGuestDetails( + if ($guestDetails = $objCustomerGuestDetail->getCustomerGuestsByIdCustomer( $this->context->cart->id_customer, $firstname, $lastname, @@ -1167,7 +1167,7 @@ class OrderOpcControllerCore extends ParentOrderController $objCustomerGuestDetail->id_customer = $this->context->customer->id; if ($objCustomerGuestDetail->save()) { if ($maxGuestAccountAllowed = Configuration::get('PS_CUSTOMER_GUEST_MAX_NUM')) { - $objCustomerGuestDetail->deleteCartCustomerGuestByIdCustomer($this->context->cart->id_customer, $maxGuestAccountAllowed); + $objCustomerGuestDetail->deleteCustomerGuestByIdCustomer($this->context->cart->id_customer, $maxGuestAccountAllowed); } // To prevent duplications for the same cart. CustomerGuestDetail::deleteCartCustomerGuest($this->context->cart->id); From b66dad86d93f053a90c6aeac40ed42f2ea74c0a3 Mon Sep 17 00:00:00 2001 From: azhar bhat Date: Wed, 16 Apr 2025 18:00:08 +0530 Subject: [PATCH 11/29] Fixed the issue where long hotel names in the search panel were going beyond the parent container. --- modules/wkroomsearchblock/views/css/chosen.css | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/wkroomsearchblock/views/css/chosen.css b/modules/wkroomsearchblock/views/css/chosen.css index a3df25799..50d84f432 100644 --- a/modules/wkroomsearchblock/views/css/chosen.css +++ b/modules/wkroomsearchblock/views/css/chosen.css @@ -372,6 +372,9 @@ } /* chosen-drop top - start */ +.hotel-selector-wrap{ + min-width: 0px; +} .hotel-selector-wrap .chosen-container .chosen-drop.top .chosen-results { position: absolute; width: 100%; From f5bf00581d97c9a11cf0e04089556158cc054561 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Thu, 17 Apr 2025 15:56:20 +0530 Subject: [PATCH 12/29] Added our properties controller in the front, added fax in the hotel table --- classes/controller/FrontController.php | 1 + controllers/admin/AdminStoresController.php | 1 + controllers/front/ContactController.php | 25 +- controllers/front/PropertiesController.php | 160 ++++++++++ controllers/front/SitemapController.php | 5 + install/data/xml/meta.xml | 4 + install/data/xml/tab.xml | 4 +- install/langs/bg/data/meta.xml | 6 + install/langs/bn/data/meta.xml | 6 + install/langs/br/data/meta.xml | 6 + install/langs/cs/data/meta.xml | 6 + install/langs/de/data/meta.xml | 6 + install/langs/en/data/meta.xml | 6 + install/langs/es/data/meta.xml | 6 + install/langs/fa/data/meta.xml | 6 + install/langs/fr/data/meta.xml | 6 + install/langs/he/data/meta.xml | 6 + install/langs/hr/data/meta.xml | 6 + install/langs/hu/data/meta.xml | 6 + install/langs/id/data/meta.xml | 6 + install/langs/it/data/meta.xml | 6 + install/langs/lt/data/meta.xml | 6 + install/langs/mk/data/meta.xml | 6 + install/langs/no/data/meta.xml | 6 + install/langs/pl/data/meta.xml | 6 + install/langs/pt/data/meta.xml | 6 + install/langs/ro/data/meta.xml | 6 + install/langs/ru/data/meta.xml | 6 + install/langs/si/data/meta.xml | 6 + install/langs/sr/data/meta.xml | 6 + install/langs/sv/data/meta.xml | 6 + install/langs/tw/data/meta.xml | 6 + install/langs/vn/data/meta.xml | 6 + install/langs/zh/data/meta.xml | 6 + .../classes/WkCustomNavigationLink.php | 14 + modules/blocksocial/blocksocial.php | 4 +- modules/blockuserinfo/nav-xs.tpl | 2 +- modules/blockuserinfo/nav.tpl | 17 +- .../classes/HotelBranchInformation.php | 4 + .../classes/HotelHelper.php | 11 +- .../classes/HotelReservationSystemDb.php | 3 +- .../admin/AdminAddHotelController.php | 6 + .../AdminHotelGeneralSettingsController.php | 254 +++++++++++++--- .../hotelreservationsystem.php | 4 +- .../views/img/Slices/no-hotel.png | Bin 0 -> 10010 bytes .../views/js/HotelReservationAdmin.js | 4 + .../admin/add_hotel/helpers/form/form.tpl | 6 + modules/wkfooteraboutblock/CHANGELOG.txt | 52 ---- modules/wkfooteraboutblock/LICENSE.md | 223 -------------- modules/wkfooteraboutblock/index.php | 29 -- modules/wkfooteraboutblock/logo.gif | Bin 1818 -> 0 bytes modules/wkfooteraboutblock/logo.png | Bin 1164 -> 0 bytes modules/wkfooteraboutblock/upgrade/index.php | 32 -- .../upgrade/upgrade-1.0.4.php | 44 --- .../wkfooteraboutblock/views/css/index.php | 29 -- .../views/css/wkFooterAboutBlockFront.css | 25 -- modules/wkfooteraboutblock/views/index.php | 29 -- .../views/templates/hook/index.php | 29 -- .../templates/hook/wkFooterAboutBlock.tpl | 30 -- .../views/templates/index.php | 29 -- .../wkfooteraboutblock/wkfooteraboutblock.php | 62 ---- .../hotel-reservation-theme/contact-form.tpl | 6 +- .../css/contact-form.css | 6 + .../modules/blockuserinfo/blockuserinfo.css | 5 + .../css/properties.css | 286 ++++++++++++++++++ .../hotel-reservation-theme/js/properties.js | 85 ++++++ .../modules/blockuserinfo/nav.tpl | 17 +- themes/hotel-reservation-theme/properties.tpl | 128 ++++++++ 68 files changed, 1149 insertions(+), 688 deletions(-) create mode 100644 controllers/front/PropertiesController.php create mode 100644 modules/hotelreservationsystem/views/img/Slices/no-hotel.png delete mode 100644 modules/wkfooteraboutblock/CHANGELOG.txt delete mode 100644 modules/wkfooteraboutblock/LICENSE.md delete mode 100644 modules/wkfooteraboutblock/index.php delete mode 100644 modules/wkfooteraboutblock/logo.gif delete mode 100644 modules/wkfooteraboutblock/logo.png delete mode 100644 modules/wkfooteraboutblock/upgrade/index.php delete mode 100644 modules/wkfooteraboutblock/upgrade/upgrade-1.0.4.php delete mode 100644 modules/wkfooteraboutblock/views/css/index.php delete mode 100644 modules/wkfooteraboutblock/views/css/wkFooterAboutBlockFront.css delete mode 100644 modules/wkfooteraboutblock/views/index.php delete mode 100644 modules/wkfooteraboutblock/views/templates/hook/index.php delete mode 100644 modules/wkfooteraboutblock/views/templates/hook/wkFooterAboutBlock.tpl delete mode 100644 modules/wkfooteraboutblock/views/templates/index.php delete mode 100644 modules/wkfooteraboutblock/wkfooteraboutblock.php create mode 100644 themes/hotel-reservation-theme/css/properties.css create mode 100644 themes/hotel-reservation-theme/js/properties.js create mode 100644 themes/hotel-reservation-theme/properties.tpl diff --git a/classes/controller/FrontController.php b/classes/controller/FrontController.php index d72120cc6..bda5ecd12 100644 --- a/classes/controller/FrontController.php +++ b/classes/controller/FrontController.php @@ -1192,6 +1192,7 @@ class FrontControllerCore extends Controller 'token' => Tools::getToken(), 'priceDisplayPrecision' => _PS_PRICE_DISPLAY_PRECISION_, 'content_only' => (int)Tools::getValue('content_only'), + 'WK_DISPLAY_OUR_HOTEL_TAB_IN_HEADER' => Configuration::get('WK_DISPLAY_OUR_HOTEL_TAB_IN_HEADER'), )); $this->context->smarty->assign($this->initLogoAndFavicon()); diff --git a/controllers/admin/AdminStoresController.php b/controllers/admin/AdminStoresController.php index 6e56fee02..a4bcbb423 100644 --- a/controllers/admin/AdminStoresController.php +++ b/controllers/admin/AdminStoresController.php @@ -31,6 +31,7 @@ class AdminStoresControllerCore extends AdminController { public function __construct() { + Tools::redirectAdmin(Context::getContext()->link->getAdminLink('AdminDashboard')); $this->bootstrap = true; $this->table = 'store'; $this->className = 'Store'; diff --git a/controllers/front/ContactController.php b/controllers/front/ContactController.php index 226909df4..ace49d894 100644 --- a/controllers/front/ContactController.php +++ b/controllers/front/ContactController.php @@ -281,10 +281,17 @@ class ContactControllerCore extends FrontController } $this->context->smarty->assign('customerThread', $customer_thread); } - // Send Hotel location information - $gblHtlAddress = Configuration::get('WK_HOTEL_GLOBAL_ADDRESS'); - $gblHtlPhone = Configuration::get('WK_HOTEL_GLOBAL_CONTACT_NUMBER'); - $gblHtlEmail = Configuration::get('WK_HOTEL_GLOBAL_CONTACT_EMAIL'); + + $objShop = new Shop(); + $shopAddress = ''; + $shopAddress_obj = $objShop->getAddress(); + if (isset($shopAddress_obj) && $shopAddress_obj instanceof Address) { + $shopAddress = AddressFormat::generateAddress($shopAddress_obj, array(), ' - ', ' '); + } + + $gblHtlAddress = $shopAddress; + $gblHtlPhone = Configuration::get('PS_SHOP_PHONE'); + $gblHtlEmail = Configuration::get('PS_SHOP_EMAIL'); $objHotelInfo = new HotelBranchInformation(); if ($hotelsInfo = $objHotelInfo->hotelBranchesInfo(false, 1, 1)) { foreach ($hotelsInfo as &$hotel) { @@ -310,12 +317,15 @@ class ContactControllerCore extends FrontController $contactKey = md5(uniqid(microtime(), true)); $this->context->cookie->__set('contactFormKey', $contactKey); + $displayHotelMap = Configuration::get('WK_CONTACT_DISPLAY_HOTEL_MAP'); $this->context->smarty->assign( array( 'hotelsInfo' => $hotelsInfo, 'viewOnMap' => Configuration::get('WK_GOOGLE_ACTIVE_MAP'), + 'displayHotels' => Configuration::get('WK_CONTACT_DISPLAY_HOTEL_LIST'), 'gblHtlPhone' => $gblHtlPhone, 'gblHtlEmail' => $gblHtlEmail, + 'displayHotelMap' => $displayHotelMap, 'gblHtlAddress' => $gblHtlAddress, 'contacts' => Contact::getContacts($this->context->language->id), 'message' => html_entity_decode(Tools::getValue('message')), @@ -324,10 +334,9 @@ class ContactControllerCore extends FrontController ); //By webkul to send hotels Map Informations for google Map. - if (Configuration::get('PS_API_KEY') && Configuration::get('WK_GOOGLE_ACTIVE_MAP')) { - $hotelLocationArray = $objHotelInfo->getMapFormatHotelsInfo(Configuration::get('WK_MAP_HOTEL_ACTIVE_ONLY')); - if ($hotelLocationArray) { - $this->context->smarty->assign('hotelLocationArray', json_encode($hotelLocationArray)); + if ($displayHotelMap && Configuration::get('PS_API_KEY') && Configuration::get('WK_GOOGLE_ACTIVE_MAP')) { + if ($hotelLocationArray = $objHotelInfo->getMapFormatHotelsInfo(Configuration::get('WK_MAP_HOTEL_ACTIVE_ONLY'))) { + $this->context->smarty->assign('hotelLocationArray', str_replace(array('\n', '\r'), '', json_encode($hotelLocationArray))); } } //End diff --git a/controllers/front/PropertiesController.php b/controllers/front/PropertiesController.php new file mode 100644 index 000000000..17bd1e291 --- /dev/null +++ b/controllers/front/PropertiesController.php @@ -0,0 +1,160 @@ +display_column_left = false; + $this->display_column_right = false; + + parent::initContent(); + $hotelsInfo = array(); + $hotelLocationArray = 0; + $pageLimit = 0; + $displayHotelMap = Configuration::get('WK_PROPERTIES_DISPLAY_HOTEL_MAP'); + if (Module::isInstalled('hotelreservationsystem') && Module::isEnabled('hotelreservationsystem')) { + $objModule = Module::getInstanceByName('hotelreservationsystem'); + $objHotelInfo = new HotelBranchInformation(); + if ($hotelsInfo = $objHotelInfo->hotelBranchesInfo(false, 1, 1)) { + foreach ($hotelsInfo as &$hotel) { + if (isset($hotel['id_cover_img']) + && $hotel['id_cover_img'] + && Validate::isLoadedObject( + $objHotelImage = new HotelImage($hotel['id_cover_img']) + ) + ) { + $htlImgLink = $this->context->link->getMediaLink($objHotelImage->getImageLink($hotel['id_cover_img'], ImageType::getFormatedName('medium'))); + if ((bool)Tools::file_get_contents($htlImgLink)) { + $hotel['image_url'] = $htlImgLink; + } else { + $hotel['image_url'] = $this->context->link->getMediaLink($objModule->getPathUri().'views/img/Slices/hotel-default-icon.png'); + } + } else { + $hotel['image_url'] = $this->context->link->getMediaLink($objModule->getPathUri().'views/img/Slices/hotel-default-icon.png'); + } + + $hotel['view_rooms_link'] = $this->context->link->getCategoryLink( + new Category($hotel['id_category'], $this->context->language->id), + null, + $this->context->language->id + ); + } + + // To store max number pages. + $pageLimit = ceil(count($hotelsInfo)/10); + + if (!($page = Tools::getValue('pagination'))) { + $page = 1; + } else if (!$pageLimit || ($page > $pageLimit)) { + $page = 1; + } + + $pagination = array(); + if ($pageLimit) { + $pageNumber = $page - 2; + if ($pageNumber < 1) { + $pageNumber = 1; + } + + while ($page + 4 >= $pageNumber && count($pagination) < 5) { + if ($pageNumber > $pageLimit) { + $firstItem = reset($pagination) - 1; + if ($firstItem > 0) { + $pagination[$firstItem] = $firstItem; + } + } else { + $pagination[$pageNumber] = $pageNumber; + } + + $pageNumber++; + } + } + + ksort($pagination); + + $this->context->smarty->assign( + array( + 'pagination' => $pagination, + 'currentPage' => $page, + 'pageLimit' => $pageLimit, + 'currentPageUrl' => $this->context->link->getPageLink($this->php_self) + ) + ); + + $page--; + // To show 10 Hotel per page + $hotelsInfo = array_slice($hotelsInfo, $page * 10, 10); + } + + if ($displayHotelMap && Configuration::get('PS_API_KEY') && Configuration::get('WK_GOOGLE_ACTIVE_MAP')) { + if ($hotelLocations = $objHotelInfo->getMapFormatHotelsInfo(Configuration::get('WK_MAP_HOTEL_ACTIVE_ONLY'))) { + $hotelLocationArray = str_replace(array('\n', '\r'), '', json_encode($hotelLocations)); + } + } + } + + Media::addJsDef( + array( + 'hotelLocationArray' => $hotelLocationArray + ) + ); + + $this->context->smarty->assign( + array( + 'hotelsInfo' => $hotelsInfo, + 'hotelLocationArray' => $hotelLocationArray, + 'viewOnMap' => Configuration::get('WK_GOOGLE_ACTIVE_MAP'), + 'displayHotelMap' => $displayHotelMap, + 'currentIndex' => $this->context->link->getPageLink('properties') + ) + ); + + $this->setTemplate(_PS_THEME_DIR_.'properties.tpl'); + } + + public function setMedia() + { + parent::setMedia(); + $this->addJS(_THEME_JS_DIR_.'properties.js'); + $this->addCSS(_THEME_CSS_DIR_.'properties.css'); + // GOOGLE MAP + if (($PS_API_KEY = Configuration::get('PS_API_KEY')) && Configuration::get('WK_GOOGLE_ACTIVE_MAP')) { + Media::addJsDef( + array( + 'PS_STORES_ICON' => $this->context->link->getMediaLink(_PS_IMG_.Configuration::get('PS_STORES_ICON')), + ) + ); + $this->addJS( + 'https://maps.googleapis.com/maps/api/js?key='.$PS_API_KEY. + '&libraries=places&language='.$this->context->language->iso_code.'®ion='.$this->context->country->iso_code + ); + } + } +} diff --git a/controllers/front/SitemapController.php b/controllers/front/SitemapController.php index 049fbcf1b..e2604f977 100644 --- a/controllers/front/SitemapController.php +++ b/controllers/front/SitemapController.php @@ -28,6 +28,11 @@ class SitemapControllerCore extends FrontController { public $php_self = 'sitemap'; + public function init() + { + Tools::redirect($this->context->link->getPageLink('index')); + } + public function setMedia() { parent::setMedia(); diff --git a/install/data/xml/meta.xml b/install/data/xml/meta.xml index 31a7f1df6..0ae2f7dc8 100644 --- a/install/data/xml/meta.xml +++ b/install/data/xml/meta.xml @@ -40,6 +40,10 @@ sitemap 1 + + properties + 1 + supplier 1 diff --git a/install/data/xml/tab.xml b/install/data/xml/tab.xml index 2cf64422d..ac0890d86 100644 --- a/install/data/xml/tab.xml +++ b/install/data/xml/tab.xml @@ -225,9 +225,9 @@ AdminImages - + AdminSearchConf diff --git a/install/langs/bg/data/meta.xml b/install/langs/bg/data/meta.xml index a0348d1be..75cac4ceb 100644 --- a/install/langs/bg/data/meta.xml +++ b/install/langs/bg/data/meta.xml @@ -120,6 +120,12 @@ order-follow + + Our Properties + + + properties + Credit slip diff --git a/install/langs/bn/data/meta.xml b/install/langs/bn/data/meta.xml index 5b2aae2fd..fcab2be9b 100644 --- a/install/langs/bn/data/meta.xml +++ b/install/langs/bn/data/meta.xml @@ -126,6 +126,12 @@ order-slip + + আমাদের সম্পত্তি + + + properties + অর্ডার diff --git a/install/langs/br/data/meta.xml b/install/langs/br/data/meta.xml index c3c5632ee..c4a4e3040 100644 --- a/install/langs/br/data/meta.xml +++ b/install/langs/br/data/meta.xml @@ -120,6 +120,12 @@ acompanhar-meu-pedido + + Hon tiez + + + properties + Nota do pedido diff --git a/install/langs/cs/data/meta.xml b/install/langs/cs/data/meta.xml index 2479d6894..af7021abc 100644 --- a/install/langs/cs/data/meta.xml +++ b/install/langs/cs/data/meta.xml @@ -120,6 +120,12 @@ order-follow + + Naše nemovitosti + + + properties + Dobropis diff --git a/install/langs/de/data/meta.xml b/install/langs/de/data/meta.xml index fcd3fd07d..122c98d9f 100644 --- a/install/langs/de/data/meta.xml +++ b/install/langs/de/data/meta.xml @@ -120,6 +120,12 @@ bestellungsverfolgung + + Unsere Immobilien + + + properties + Bestellschein diff --git a/install/langs/en/data/meta.xml b/install/langs/en/data/meta.xml index 0f749e6be..6ef63e6ce 100644 --- a/install/langs/en/data/meta.xml +++ b/install/langs/en/data/meta.xml @@ -120,6 +120,12 @@ order-follow + + Our Properties + + + properties + Credit slip diff --git a/install/langs/es/data/meta.xml b/install/langs/es/data/meta.xml index 1f458199f..aff9d5fd1 100644 --- a/install/langs/es/data/meta.xml +++ b/install/langs/es/data/meta.xml @@ -120,6 +120,12 @@ seguimiento-pedido + + Nuestras propiedades + + + properties + Albarán diff --git a/install/langs/fa/data/meta.xml b/install/langs/fa/data/meta.xml index 304e6893f..61169ac9e 100644 --- a/install/langs/fa/data/meta.xml +++ b/install/langs/fa/data/meta.xml @@ -120,6 +120,12 @@ order-follow + + املاک ما + + + properties + رسید سفارش diff --git a/install/langs/fr/data/meta.xml b/install/langs/fr/data/meta.xml index 88b3194db..7fa6887f3 100644 --- a/install/langs/fr/data/meta.xml +++ b/install/langs/fr/data/meta.xml @@ -120,6 +120,12 @@ suivi-commande + + Nos propriétés + + + properties + Avoirs diff --git a/install/langs/he/data/meta.xml b/install/langs/he/data/meta.xml index 99e781273..2f8901f8b 100644 --- a/install/langs/he/data/meta.xml +++ b/install/langs/he/data/meta.xml @@ -120,6 +120,12 @@ מעקב-הזמנות + + הנכסים שלנו + + + properties + שוברי הזמנה diff --git a/install/langs/hr/data/meta.xml b/install/langs/hr/data/meta.xml index 1d581d99d..b30583cc6 100644 --- a/install/langs/hr/data/meta.xml +++ b/install/langs/hr/data/meta.xml @@ -120,6 +120,12 @@ order-follow + + Our hotels + + + properties + Credit slip diff --git a/install/langs/hu/data/meta.xml b/install/langs/hu/data/meta.xml index ac5e8dd65..645914dfb 100644 --- a/install/langs/hu/data/meta.xml +++ b/install/langs/hu/data/meta.xml @@ -126,6 +126,12 @@ order-slip + + Our hotels + + + properties + Order diff --git a/install/langs/id/data/meta.xml b/install/langs/id/data/meta.xml index 8d3f437fb..eb35396ec 100644 --- a/install/langs/id/data/meta.xml +++ b/install/langs/id/data/meta.xml @@ -120,6 +120,12 @@ pantau-order + + Properti kami + + + properties + Slip order diff --git a/install/langs/it/data/meta.xml b/install/langs/it/data/meta.xml index 302524d29..015e87498 100644 --- a/install/langs/it/data/meta.xml +++ b/install/langs/it/data/meta.xml @@ -126,6 +126,12 @@ buono-ordine + + Le nostre proprietà + + + properties + Ordine diff --git a/install/langs/lt/data/meta.xml b/install/langs/lt/data/meta.xml index 3bcb5c8ee..a540934af 100644 --- a/install/langs/lt/data/meta.xml +++ b/install/langs/lt/data/meta.xml @@ -120,6 +120,12 @@ order-follow + + Our hotels + + + properties + Credit slip diff --git a/install/langs/mk/data/meta.xml b/install/langs/mk/data/meta.xml index a54ff9ab2..1ed8250c1 100644 --- a/install/langs/mk/data/meta.xml +++ b/install/langs/mk/data/meta.xml @@ -120,6 +120,12 @@ order-follow + + Our hotels + + + properties + Order slip diff --git a/install/langs/no/data/meta.xml b/install/langs/no/data/meta.xml index 40ec6e42d..520a9144c 100644 --- a/install/langs/no/data/meta.xml +++ b/install/langs/no/data/meta.xml @@ -120,6 +120,12 @@ order-follow + + Our hotels + + + properties + Order slip diff --git a/install/langs/pl/data/meta.xml b/install/langs/pl/data/meta.xml index f0883de05..69ccaf61d 100644 --- a/install/langs/pl/data/meta.xml +++ b/install/langs/pl/data/meta.xml @@ -120,6 +120,12 @@ sledzenie-zamowienia + + Nasze nieruchomości + + + properties + Pokwitowania diff --git a/install/langs/pt/data/meta.xml b/install/langs/pt/data/meta.xml index 37659029f..7df1881fe 100644 --- a/install/langs/pt/data/meta.xml +++ b/install/langs/pt/data/meta.xml @@ -120,6 +120,12 @@ acompanhar-encomenda + + Nossas propriedades + + + properties + Nota de Encomenda diff --git a/install/langs/ro/data/meta.xml b/install/langs/ro/data/meta.xml index c69586419..2f7d3e2c8 100644 --- a/install/langs/ro/data/meta.xml +++ b/install/langs/ro/data/meta.xml @@ -120,6 +120,12 @@ returnari + + Proprietățile noastre + + + properties + Bon de comandă diff --git a/install/langs/ru/data/meta.xml b/install/langs/ru/data/meta.xml index 51a0e7cc9..9bc9533da 100644 --- a/install/langs/ru/data/meta.xml +++ b/install/langs/ru/data/meta.xml @@ -120,6 +120,12 @@ order-follow + + Наши объекты + + + properties + Бланк заказа diff --git a/install/langs/si/data/meta.xml b/install/langs/si/data/meta.xml index 97bc8ba23..bd7005158 100644 --- a/install/langs/si/data/meta.xml +++ b/install/langs/si/data/meta.xml @@ -120,6 +120,12 @@ order-follow + + Our hotels + + + properties + Credit slip diff --git a/install/langs/sr/data/meta.xml b/install/langs/sr/data/meta.xml index 556ff7f13..9b5583bfc 100644 --- a/install/langs/sr/data/meta.xml +++ b/install/langs/sr/data/meta.xml @@ -114,6 +114,12 @@ my-account + + Our hotels + + + properties + Order follow diff --git a/install/langs/sv/data/meta.xml b/install/langs/sv/data/meta.xml index 804a3178f..335207a91 100644 --- a/install/langs/sv/data/meta.xml +++ b/install/langs/sv/data/meta.xml @@ -120,6 +120,12 @@ order-follow + + Our hotels + + + properties + Credit slip diff --git a/install/langs/tw/data/meta.xml b/install/langs/tw/data/meta.xml index 13529fe4f..6399d418a 100644 --- a/install/langs/tw/data/meta.xml +++ b/install/langs/tw/data/meta.xml @@ -120,6 +120,12 @@ order-follow + + 我們的物業 + + + properties + 訂購單 diff --git a/install/langs/vn/data/meta.xml b/install/langs/vn/data/meta.xml index 197805e11..485fbd516 100644 --- a/install/langs/vn/data/meta.xml +++ b/install/langs/vn/data/meta.xml @@ -120,6 +120,12 @@ order-follow + + Tài sản của chúng tôi + + + properties + Phiếu tín dụng diff --git a/install/langs/zh/data/meta.xml b/install/langs/zh/data/meta.xml index 29f672f67..4b15cc6a6 100644 --- a/install/langs/zh/data/meta.xml +++ b/install/langs/zh/data/meta.xml @@ -120,6 +120,12 @@ order-follow + + Our hotels + + + properties + Order slip diff --git a/modules/blocknavigationmenu/classes/WkCustomNavigationLink.php b/modules/blocknavigationmenu/classes/WkCustomNavigationLink.php index d27a037f0..deca3d60d 100644 --- a/modules/blocknavigationmenu/classes/WkCustomNavigationLink.php +++ b/modules/blocknavigationmenu/classes/WkCustomNavigationLink.php @@ -164,6 +164,20 @@ class WkCustomNavigationLink extends ObjectModel $objCustomNavigationLink->link = 'index'; $objCustomNavigationLink->save(); + $objCustomNavigationLink = new WkCustomNavigationLink(); + foreach ($languages as $language) { + $objCustomNavigationLink->name[$language['id_lang']] = 'Our hotels'; + } + + $objCustomNavigationLink->position = $this->getHigherPosition(); + $objCustomNavigationLink->id_cms = 0; + $objCustomNavigationLink->show_at_navigation = 1; + $objCustomNavigationLink->show_at_footer = 0; + $objCustomNavigationLink->active = 1; + $objCustomNavigationLink->link = Context::getContext()->link->getPageLink('properties'); + $objCustomNavigationLink->is_custom_link = 1; + $objCustomNavigationLink->save(); + // enter modules links $modsElems = array(); // if module is installing or resetting diff --git a/modules/blocksocial/blocksocial.php b/modules/blocksocial/blocksocial.php index 01e179f14..e46fc4de0 100644 --- a/modules/blocksocial/blocksocial.php +++ b/modules/blocksocial/blocksocial.php @@ -55,7 +55,7 @@ class BlockSocial extends Module || !Configuration::updateValue('BLOCKSOCIAL_PINTEREST', '') || !Configuration::updateValue('BLOCKSOCIAL_VIMEO', '') || !Configuration::updateValue('BLOCKSOCIAL_INSTAGRAM', '') - || !$this->registerHook('displayFooterNotificationHook') + || !$this->registerHook('displayFooterMostLeftBlock') ) { return false; } @@ -100,7 +100,7 @@ class BlockSocial extends Module return $output.$this->renderForm(); } - public function hookDisplayFooterNotificationHook() + public function hookDisplayFooterMostLeftBlock() { $this->smarty->assign(array( 'facebook_url' => Configuration::get('BLOCKSOCIAL_FACEBOOK'), diff --git a/modules/blockuserinfo/nav-xs.tpl b/modules/blockuserinfo/nav-xs.tpl index 97ea72e63..25df303cd 100644 --- a/modules/blockuserinfo/nav-xs.tpl +++ b/modules/blockuserinfo/nav-xs.tpl @@ -20,7 +20,7 @@ + {else} + + {l s='Sign in' mod='blockuserinfo'} + + {/if} {if !isset($ajaxCustomerLogin)}
+ {if isset($WK_DISPLAY_OUR_HOTEL_TAB_IN_HEADER) && $WK_DISPLAY_OUR_HOTEL_TAB_IN_HEADER} + + {/if} {/if} {/block} diff --git a/modules/hotelreservationsystem/classes/HotelBranchInformation.php b/modules/hotelreservationsystem/classes/HotelBranchInformation.php index c2779a01e..c133c3832 100644 --- a/modules/hotelreservationsystem/classes/HotelBranchInformation.php +++ b/modules/hotelreservationsystem/classes/HotelBranchInformation.php @@ -35,6 +35,7 @@ class HotelBranchInformation extends ObjectModel public $map_formated_address; public $map_input_text; public $active_refund; + public $fax; public $date_add; public $date_upd; @@ -54,6 +55,7 @@ class HotelBranchInformation extends ObjectModel 'map_formated_address' => array('type' => self::TYPE_HTML, 'validate' => 'isCleanHtml'), 'map_input_text' => array('type' => self::TYPE_STRING, 'validate' => 'isString'), 'active_refund' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), + 'fax' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName'), 'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate', 'copy_post' => false), 'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate', 'copy_post' => false), @@ -1142,6 +1144,8 @@ class HotelBranchInformation extends ObjectModel $message = sprintf(Tools::displayError('The Zip/Postal code you have entered is invalid. It must follow this format: %s'), str_replace('C', $objCountry->iso_code, str_replace('N', '0', str_replace('L', 'A', $objCountry->zip_code_format)))); } elseif ($this->zipcode && !Validate::isPostCode($this->zipcode)) { $message = Tools::displayError('The Zip / Postal code is invalid.'); + } elseif ($this->fax && !Validate::isGenericName($this->fax)) { + $message = Tools::displayError('The Fax is invalid.'); } else { if ($addressValidation = Address::getValidationRules('Address')) { foreach ($addressValidation['size'] as $field => $maxSize) { diff --git a/modules/hotelreservationsystem/classes/HotelHelper.php b/modules/hotelreservationsystem/classes/HotelHelper.php index 7182faf92..168477269 100644 --- a/modules/hotelreservationsystem/classes/HotelHelper.php +++ b/modules/hotelreservationsystem/classes/HotelHelper.php @@ -1044,14 +1044,13 @@ class HotelHelper Configuration::updateValue('WK_ROOM_LEFT_WARNING_NUMBER', 10); Configuration::updateValue('WK_HTL_ESTABLISHMENT_YEAR', 2010); - Configuration::updateValue( - 'WK_HOTEL_GLOBAL_ADDRESS', - 'The Hotel Prime, Monticello Dr, Montgomery, 10010' - ); - Configuration::updateValue('WK_HOTEL_GLOBAL_CONTACT_NUMBER', '0987654321'); - Configuration::updateValue('WK_HOTEL_GLOBAL_CONTACT_EMAIL', 'hotelprime@htl.com'); + Configuration::updateValue('PS_SHOP_ADDR1', 'The Hotel Prime, Monticello Dr, Montgomery, 10010'); + Configuration::updateValue('PS_SHOP_PHONE', '0987654321'); + Configuration::updateValue('PS_SHOP_EMAIL', 'hotelprime@htl.com'); + Configuration::updateValue('WK_CUSTOMER_SUPPORT_PHONE_NUMBER', '0987654321'); Configuration::updateValue('WK_CUSTOMER_SUPPORT_EMAIL', 'hotelprime@htl.com'); + Configuration::updateValue('WK_CONTACT_DISPLAY_HOTEL_LIST', 0); Configuration::updateValue('WK_TITLE_HEADER_BLOCK', $home_banner_default_title); Configuration::updateValue('WK_CONTENT_HEADER_BLOCK', $home_banner_default_content); diff --git a/modules/hotelreservationsystem/classes/HotelReservationSystemDb.php b/modules/hotelreservationsystem/classes/HotelReservationSystemDb.php index 484311892..fdba9f788 100644 --- a/modules/hotelreservationsystem/classes/HotelReservationSystemDb.php +++ b/modules/hotelreservationsystem/classes/HotelReservationSystemDb.php @@ -65,6 +65,7 @@ class HotelReservationSystemDb `map_formated_address` text NOT NULL, `map_input_text` text NOT NULL, `active_refund` tinyint(1) unsigned NOT NULL DEFAULT '0', + `fax` varchar(255) DEFAULT NULL, `date_add` datetime NOT NULL, `date_upd` datetime NOT NULL, PRIMARY KEY (`id`) @@ -562,4 +563,4 @@ class HotelReservationSystemDb `'._DB_PREFIX_.'htl_access`' ); } -} \ No newline at end of file +} diff --git a/modules/hotelreservationsystem/controllers/admin/AdminAddHotelController.php b/modules/hotelreservationsystem/controllers/admin/AdminAddHotelController.php index f21791e18..4dd63e80e 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminAddHotelController.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminAddHotelController.php @@ -254,6 +254,7 @@ class AdminAddHotelController extends ModuleAdminController $zipcode = Tools::getValue('hotel_postal_code'); $address = Tools::getValue('address'); $active = Tools::getValue('ENABLE_HOTEL'); + $fax = Tools::getValue('fax'); $activeRefund = Tools::getValue('active_refund'); $enableUseGlobalMaxOrderDate = Tools::getValue('enable_use_global_max_order_date'); $maximumBookingDate = Tools::getValue('maximum_booking_date'); @@ -371,6 +372,10 @@ class AdminAddHotelController extends ModuleAdminController $this->errors[] = $this->l('Address is required field.'); } + if ($fax && !Validate::isGenericName($fax)) { + $this->errors[] = $this->l('Field fax in invalid.'); + } + if (!$country) { $this->errors[] = $this->l('Country is required field.'); } else { @@ -474,6 +479,7 @@ class AdminAddHotelController extends ModuleAdminController } $objHotelBranch->active = $active; $objHotelBranch->active_refund = $activeRefund; + $objHotelBranch->fax = $fax; // lang fields $hotelCatName = array(); diff --git a/modules/hotelreservationsystem/controllers/admin/AdminHotelGeneralSettingsController.php b/modules/hotelreservationsystem/controllers/admin/AdminHotelGeneralSettingsController.php index f105d2420..c4018fe58 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminHotelGeneralSettingsController.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminHotelGeneralSettingsController.php @@ -78,8 +78,7 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController 'value' => 0, ), ), - 'hint' => $this->l('This option can be disabled if only one active hotel in the website. - In case of more than one active hotel, Hotel Name will always be shown in the search panel.'), + 'hint' => $this->l('This option can be disabled if only one active hotel in the website. In case of more than one active hotel, Hotel Name will always be shown in the search panel.'), ), 'WK_SEARCH_AUTO_FOCUS_NEXT_FIELD' => array( 'title' => $this->l('Focus next field automatically'), @@ -148,6 +147,23 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController 'identifier' => 'id', 'list' => $hotelsInfo, ), + 'WK_DISPLAY_OUR_HOTEL_TAB_IN_HEADER' => array( + 'title' => $this->l('Display "Our Hotels" tab in menu'), + 'cast' => 'intval', + 'type' => 'bool', + 'default' => '0', + 'values' => array( + array( + 'id' => 'active_on', + 'value' => 1, + ), + array( + 'id' => 'active_off', + 'value' => 0, + ), + ), + 'hint' => $this->l('Display "Our Hotels" tab in menu in top in the front office'), + ), 'WK_HTL_ESTABLISHMENT_YEAR' => array( 'title' => $this->l('Website Launch Year'), 'hint' => $this->l('The year when your hotel site was launched.'), @@ -167,31 +183,8 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController ), 'contactdetail' => array( 'icon' => 'icon-phone', - 'title' => $this->l('Website Contact Details'), + 'title' => $this->l('Support Contact Details'), 'fields' => array( - 'WK_HOTEL_GLOBAL_ADDRESS' => array( - 'title' => $this->l('Main Branch Address'), - 'hint' => $this->l('The address of the main branch. It will be shown on Contact Us page.'), - 'type' => 'text', - 'isCleanHtml' => true, - 'class' => 'fixed-width-xxl', - 'required' => true, - ), - 'WK_HOTEL_GLOBAL_CONTACT_NUMBER' => array( - 'title' => $this->l('Main Branch Phone Number'), - 'hint' => $this->l('The phone number of the main branch. It will be shown on Contact Us page.'), - 'type' => 'text', - 'validation' => 'isPhoneNumber', - 'class' => 'fixed-width-xxl', - 'required' => true, - ), - 'WK_HOTEL_GLOBAL_CONTACT_EMAIL' => array( - 'title' => $this->l('Main Branch Email'), - 'hint' => $this->l('The email address of the main branch. It will be shown on Contact Us page.'), - 'type' => 'text', - 'class' => 'fixed-width-xxl', - 'required' => true, - ), 'WK_CUSTOMER_SUPPORT_PHONE_NUMBER' => array( 'title' => $this->l('Support Phone Number'), 'type' => 'text', @@ -204,11 +197,36 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController 'hint' => $this->l('The email used for customer service. It will be shown on navigation bar.'), 'class' => 'fixed-width-xxl', ), + 'WK_CONTACT_DISPLAY_HOTEL_LIST' => array( + 'title' => $this->l('Display Hotels On Contact Page'), + 'cast' => 'intval', + 'type' => 'bool', + 'default' => '0', + 'values' => array( + array( + 'id' => 'active_on', + 'value' => 1, + ), + array( + 'id' => 'active_off', + 'value' => 0, + ), + ), + 'hint' => $this->l('Enable to display hotels list on the contact us page.'), + ), ), 'submit' => array( 'title' => $this->l('Save'), ), ), + 'websitedetail' => array( + 'title' => $this->l('Website Contact Details'), + 'icon' => 'icon-user', + 'fields' => $this->_getDefaultFieldsContent(), + 'submit' => array( + 'title' => $this->l('Save'), + ), + ), 'advancedPayment' => array( 'title' => $this->l('Advance Payment Global Setting'), 'fields' => array( @@ -326,13 +344,177 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController ), 'hint' => $this->l('If yes, only active hotels will be displayed on map.'), ), - + 'WK_PROPERTIES_DISPLAY_HOTEL_MAP' => array( + 'title' => $this->l('Display Hotels Map On Properties Page'), + 'cast' => 'intval', + 'type' => 'bool', + 'default' => '0', + 'values' => array( + array( + 'id' => 'active_on', + 'value' => 1, + ), + array( + 'id' => 'active_off', + 'value' => 0, + ), + ), + 'hint' => $this->l('Enable to display map with hotels locations on the properties page.'), + ), + 'WK_CONTACT_DISPLAY_HOTEL_MAP' => array( + 'title' => $this->l('Display Hotels Map On Contact Page'), + 'cast' => 'intval', + 'type' => 'bool', + 'default' => '0', + 'values' => array( + array( + 'id' => 'active_on', + 'value' => 1, + ), + array( + 'id' => 'active_off', + 'value' => 0, + ), + ), + 'hint' => $this->l('Enable to display map with hotels locations on the contact us page.'), + ), ), 'submit' => array( 'title' => $this->l('Save'), ), ), ); + + } + + protected function _getDefaultFieldsContent() + { + $this->context = Context::getContext(); + $countryList = array(); + $countryList[] = array('id' => '0', 'name' => $this->l('Choose your country')); + foreach (Country::getCountries($this->context->language->id) as $country) { + $countryList[] = array('id' => $country['id_country'], 'name' => $country['name']); + } + $stateList = array(); + $stateList[] = array('id' => '0', 'name' => $this->l('Choose your state (if applicable)')); + foreach (State::getStates($this->context->language->id) as $state) { + $stateList[] = array('id' => $state['id_state'], 'name' => $state['name']); + } + + $formFields = array( + 'PS_SHOP_NAME' => array( + 'title' => $this->l('Website name'), + 'hint' => $this->l('Displayed in emails and page titles.'), + 'validation' => 'isGenericName', + 'required' => true, + 'type' => 'text', + 'no_escape' => true, + ), + 'PS_SHOP_EMAIL' => array( + 'title' => $this->l('Website email'), + 'hint' => $this->l('Displayed in emails sent to customers and on Contact Us page.'), + 'validation' => 'isEmail', + 'required' => true, + 'type' => 'text' + ), + 'PS_SHOP_PHONE' => array( + 'title' => $this->l('Phone'), + 'validation' => 'isGenericName', + 'required' => true, + 'type' => 'text', + 'hint' => $this->l('The phone number of the main branch.'), + ), + 'PS_SHOP_ADDR1' => array( + 'title' => $this->l('Address line 1'), + 'validation' => 'isAddress', + 'type' => 'text', + 'hint' => $this->l('The address of the main branch.'), + 'isCleanHtml' => true, + 'required' => true, + ), + 'PS_SHOP_ADDR2' => array( + 'title' => $this->l('Address line 2'), + 'validation' => 'isAddress', + 'type' => 'text' + ), + 'PS_SHOP_CODE' => array( + 'title' => $this->l('Zip/postal code'), + 'validation' => 'isGenericName', + 'type' => 'text' + ), + 'PS_SHOP_CITY' => array( + 'title' => $this->l('City'), + 'validation' => 'isGenericName', + 'type' => 'text' + ), + 'PS_SHOP_COUNTRY_ID' => array( + 'title' => $this->l('Country'), + 'validation' => 'isInt', + 'type' => 'select', + 'list' => $countryList, + 'identifier' => 'id', + 'cast' => 'intval', + 'defaultValue' => (int)$this->context->country->id + ), + 'PS_SHOP_STATE_ID' => array( + 'title' => $this->l('State'), + 'validation' => 'isInt', + 'type' => 'select', + 'list' => $stateList, + 'identifier' => 'id', + 'cast' => 'intval' + ), + 'PS_SHOP_DETAILS' => array( + 'title' => $this->l('Registration number'), + 'hint' => $this->l('Website registration information (e.g. SIRET or RCS).'), + 'validation' => 'isGenericName', + 'type' => 'textarea', + 'cols' => 30, + 'rows' => 5 + ), + 'PS_SHOP_FAX' => array( + 'title' => $this->l('Fax'), + 'validation' => 'isGenericName', + 'type' => 'text' + ), + ); + + return $formFields; + } + + public function beforeUpdateOptions() + { + if (isset($_POST['PS_SHOP_STATE_ID']) && $_POST['PS_SHOP_STATE_ID'] != '0') { + $sql = 'SELECT `active` FROM `'._DB_PREFIX_.'state` + WHERE `id_country` = '.(int)Tools::getValue('PS_SHOP_COUNTRY_ID').' + AND `id_state` = '.(int)Tools::getValue('PS_SHOP_STATE_ID'); + $isStateOk = Db::getInstance()->getValue($sql); + if ($isStateOk != 1) { + $this->errors[] = Tools::displayError('The specified state is not located in this country.'); + } + } + } + + public function updateOptionPsShopCountryId($value) + { + if (!$this->errors && $value) { + $country = new Country($value, $this->context->language->id); + if ($country->id) { + Configuration::updateValue('PS_SHOP_COUNTRY_ID', $value); + Configuration::updateValue('PS_SHOP_COUNTRY', pSQL($country->name)); + } + } + } + + public function updateOptionPsShopStateId($value) + { + if (!$this->errors && $value) { + $state = new State($value); + if ($state->id) { + Configuration::updateValue('PS_SHOP_STATE_ID', $value); + Configuration::updateValue('PS_SHOP_STATE', pSQL($state->name)); + } + } } public function postProcess() @@ -427,18 +609,16 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController $this->errors[] = $this->l('Please enter Google API key.'); } } - if (!trim(Tools::getValue('WK_HOTEL_GLOBAL_ADDRESS'))) { - $this->errors[] = $this->l('Hotel global address field is required'); + if (!trim(Tools::getValue('PS_SHOP_NAME'))) { + $this->errors[] = $this->l('Website name field is required'); } - if (!trim(Tools::getValue('WK_HOTEL_GLOBAL_CONTACT_NUMBER'))) { - $this->errors[] = $this->l('Hotel global contact number field is required'); - } elseif (!Validate::isPhoneNumber(Tools::getValue('WK_HOTEL_GLOBAL_CONTACT_NUMBER'))) { - $this->errors[] = $this->l('Hotel global contact number field is invalid'); + if (!trim(Tools::getValue('PS_SHOP_ADDR1'))) { + $this->errors[] = $this->l('Address Line1 field is required'); } - if (!trim(Tools::getValue('WK_HOTEL_GLOBAL_CONTACT_EMAIL'))) { - $this->errors[] = $this->l('Hotel global contact email field is required'); - } elseif (!Validate::isEmail(Tools::getValue('WK_HOTEL_GLOBAL_CONTACT_EMAIL'))) { - $this->errors[] = $this->l('Hotel global contact email field is invalid'); + if (!trim(Tools::getValue('PS_SHOP_PHONE'))) { + $this->errors[] = $this->l('Phone field is required'); + } elseif (!Validate::isPhoneNumber(Tools::getValue('PS_SHOP_PHONE'))) { + $this->errors[] = $this->l('Phone field is invalid'); } if (trim(Tools::getValue('WK_CUSTOMER_SUPPORT_PHONE_NUMBER')) != '') { if (!Validate::isPhoneNumber(trim(Tools::getValue('WK_CUSTOMER_SUPPORT_PHONE_NUMBER')))) { diff --git a/modules/hotelreservationsystem/hotelreservationsystem.php b/modules/hotelreservationsystem/hotelreservationsystem.php index f41549ee8..2b56dd0c6 100644 --- a/modules/hotelreservationsystem/hotelreservationsystem.php +++ b/modules/hotelreservationsystem/hotelreservationsystem.php @@ -682,9 +682,6 @@ class HotelReservationSystem extends Module $configKeys = array( 'WK_HOTEL_LOCATION_ENABLE', 'WK_ROOM_LEFT_WARNING_NUMBER', - 'WK_HOTEL_GLOBAL_ADDRESS', - 'WK_HOTEL_GLOBAL_CONTACT_EMAIL', - 'WK_HOTEL_GLOBAL_CONTACT_NUMBER', 'WK_HTL_ESTABLISHMENT_YEAR', 'WK_HTL_CHAIN_NAME', 'WK_TITLE_HEADER_BLOCK', @@ -698,6 +695,7 @@ class HotelReservationSystem extends Module 'WK_HOTEL_NAME_ENABLE', 'WK_CUSTOMER_SUPPORT_PHONE_NUMBER', 'WK_CUSTOMER_SUPPORT_EMAIL', + 'WK_CONTACT_DISPLAY_HOTEL_LIST' ); foreach ($configKeys as $key) { if (!Configuration::deleteByName($key)) { diff --git a/modules/hotelreservationsystem/views/img/Slices/no-hotel.png b/modules/hotelreservationsystem/views/img/Slices/no-hotel.png new file mode 100644 index 0000000000000000000000000000000000000000..95ef288c635f57cf0727458ad798e765dc43ae25 GIT binary patch literal 10010 zcmV+#C*|0QP)*p}00009a7bBm000XU z000XU0RWnu7ytkO0drDELIAGL9O(c600d`2O+f$vv5yPC1PbT8WT-K>qPUAIsqP1dY;5Qog@zqPkNG55nmFh zR7%vBcu9#Gs4z34j9iBE{Wg0|Ha)w$_kFLud;O}K?&)rN zdiLJ`^?mF6zV)pk%91;W4jpPAK74qkzrVk7^5n^iJk>sA$dJk0b90|_kmoD)K1beH zbsu)i`?|U3CeQDZpR4Yzd*sNGo0X+B3{jTMK&)+TZF5Adb3{zDMO<@SQMRj$LGZ4q zH_P|gHFW6E&7($*>Qa`%VMUxGM~)n+96fsU7FVzxjjX6C$oJfgu;t;)Cr+H`8asAu zRauP2ia0^MqLm+SQ8`%H6sXFrOIcAHixqK9zWCyc4!Qe|xTJ`8jw(N0Vy&N&zjwVA zv>8|tN5B>CQn{Fyt8!S|s8r<`JYWT#FIL0>af4EKwUEUPOPAapvMzV_SP?e?t1H&# z9(mZIEJ0Z(1KmS5+MNwn#6D=N>$=MoWr>6v>3(4J=+WzxB{i&wJ$S^sQnmJ6H)*PJ zTV=(Z4pzj^L3pE~8)^#o-Rk6xTtW|E#P*p;(z9QiJMZg=B6>w3h$n11Z*i4l~xn7(IWN;*e=|+ zgrTK`Y^;c_fGsg;86g`fVk=-vLbQaCjT5mOg(eSd1#C%z(hJ!r5vQF-va~D}Nk2VF zp^z#e#)#Oh#Igdmq=K7%dQz1TV?^B6)@B84Nt+I8?p4V!Ld5Q32D{UsC3RRdQ?`~r zxr>+sn#O7*P2Z6txa!Jc(a`x+u89s+5^@!>+l{hQrO4{ltJMRmZTC~l=`cSoOT;=i z5pw|DcCx9lY11ah3ST~BhO$^{Xm?Xjg^yV0CSnO>rQTBKh3B7l?ytZ8dS$WrP?77f z@blwbMC{IkQw?Oj^7p?xR(SE^#cJ%>vC3lcgLq6&PfuzwnJma$#97RP4;?(HUU}se zN4$%#xkgzmjgTDjJw=`$XDZ?>=E3m1xY1Z)+-PfsEdgk!qDvK&Ohqh#1m+(Vl_Goh z?p1HT`KBY@dGqHhizNtDbctKtsR~G&$_Tf6|8kWw4?pyfbAQL3cLx4HSnd1ny;o%g z1I&N^@|VhD7Oq>pUe3>ERUk64#O{0}^(f#At{ZKGS(d1XTb=rJFKJS-#CP6#XGNWI zn=3N9b#K|SW!dG^r&rDzF+!!qhaZ0E%!Lu}_22uRvRIeQ)D#5hSyNi_QL#~yPY<3^u#)>+D8iHgUquBrkM zTf|u1AxhzbbRbxvTYg^GuhcGiT)p{6KYH*;U!U3`mXe?oH_|`z=FM{~W)fn4_~C~g zH~KmojkY8M)m&WDOH=`fC1S_=o;>-a3|&~>E|Ku6HEY*)>DSpSX`mIXTQ&9OrcI99 zO9XkxjvbEWj3c~fo_^XH7>Gp2smz)%aiYo!{@x^dSzC`IRXSKCA?K<~8BXLKARGZJ zwLz?Jw?qS0{oxOPIBgEmtV;($C_RUbDrE0xti1c~$QN~^-5*S5^5n_Nk}B2Fqeo9s zh7&0|?Qx;i@&5iLwE~7_IbmGi+i$cS);;II|x{-WJ!Ta5lS+nrkG9%bjXmq z|Mhp#PWMFs1??X5CKm(|9rJ?-@b;y9@0oG z?kBQMs>%x3k`-c&?=smMM-g$wy|4Pc7{&@~5GB-WqrW@ipPGuO8^2Gmf=bhw#$rE?} ze$5(ZZtUiTcd7`izW;vJ-QBIO7Aw1T>sGZ-+-8`1(M9U|>#lR|)5PY9Edl91apJ@j z)2wl%iY*Cht)S3D?mI=$%L#HFIB;O;`4XTC0&QduiuJ|f642rXq>gZ#XNcv+ZB9zO z3=G@|j``7l@}xR?^r$KtXPtSb${PZc)22^Xmt1m5D|kv+y!^z zrk_KA+9e)4Zrs3owRmuwnfLldq4|FZcgD<_i4|_}d#S75>soe8vYaV{$nZ1Ha2}5n z0pE7}?E^v{K76<;DP5ySk2b2NIg`Q`dJ|jnsQs{bK#2q8B6PpG}m*pc+Y+J-KR!~;e}1b8Wu$SjcIeMV=qN?yH{4c&*2USafz9yGCxiu zZA5O_5*#hu$(4!<8rz7?grN!oE1cR*32?<0u?TpXiimFRK0k$q zb~;#QY0M~bk1v*>)JzE`o{>|a?C{~k&h7KhKX)uN?z-tNw@K-yBszQCq9UNTSYZ)F z8c|K=*SPCe%>E$WxpU{LOD?@snS$3sj~O$@XfY2NGUPkT5Ms@V-42$a8;cP&Ub}X! zBQn+jrUkCafymyX>ccx?k z!lLJ~+z%Tz%n4eZ;YO#uNZ@DS_SIKkIp>)a9*@H^UV>>{A12P5O$l(twZuzR1ax!v zwA<;NFKH{H;e9pboSNBl<~ZF&_SPx%m^N*iBchEPH~PNLYm2YGT0QsNbE+QKe)qfT zsrBpYzCL@_Ea&sMwhb8rb z2#*GE5wrSC%2(T)43v3`x0aw{#=Yj2H!?V`63?Pj=t+gKKqY}fZuuN9cM|Q-S9hI5GV8GaSf~#^HE$TL=rLk)iiq#b6|R6X#v}|vgv{azD}a)^#n|c zXu3qoO_}?K0jqrZ<(JnDX5n(@ydJzmuod)q%z^QZPRaey&Fp=j* z?r4$VZ(ur5FDgw@NWJ-U%CyV%-qbryiztCD-zqKKXDYEsiP)xg*)jKuE9#a|B4FL5 zp-eC+fuCS`&METAxVlRMYaMcz%jV>vMa+D-ws3$5B5QZKr-0*U%a)b$;xP>@(iI|N zKgud#O(P*6IB>wJ@y>Gbgy>?n%85`SW(}oxK8*GKyI5Ymq!7!?cBM9el|BTh2xR#| z?za^NQRex~g=-g95UIwXWZX!wL*+y$5lf02TH0MHE&qaLgd=?- z%|vjul`1>TkuQ>K?)~@QA5;{=&sgaUtGX(AH3|qNVj1D)u#2v+xY zPj^F0cGQ~(Q%32xzPIc!wZOHe=%W_q$GnyWwQZ`hqN#}8&BWQ+p#uSD)zH0`XP$W` zP^~j5tuhZRSYbam+LQ$Wc|j>D>y&GA$jq6k>cS$YO z!+pBzjyvw?$ZOtLW*??1?$hK|U20j1jr=Mmb;$}rqX>po}9jiNJ z$kMNm96`W(fkPKNJluQlz167Ov{;hi;yPBCl{~HJM%O}VDHa(Q+6#*$C|g(?o_+S&fuHG6^3qE$IZX_)ZfWznh?nhlGz=&__sd`XD)jFsGLJQ` z?Q%-WiF|U}e@|au9|4(6MLhK6kRi8VJa0d%D9}HP9#&pndhtco8>8hMb5C_Swe zG0-YER2bm=8t;=cPE*99lQAk|0{a!F&5053-EvWty})7oxN*K|rKB3% zvD$~OE6v22)EqgefN%QY4`WBj>2F<&cBxaOqB17T_zOLJlL~n{K*E#igFb#TutbMP*DN5wki&8N}xY4>~s>Fmt5NHZ5h~JRcF` zCMLbeA#EXNEnr}};kWqV>lnSkO(du#HcG@?5Zm2VD-vB#Jq?m4qkPH*(<&iMOUQW$ zSmWnXr+mF+u9d=V(cVfBNF44Hyh<}FowShi6fpSx9a!QN=f%c~*sN^=1j_QrA#%}` zm3rBLw5yJi5^~-GhI#`Y_0(k{kcivb+Kdu00;axqv!s^j=aofiU>^91IO-OoVTmhb z69f#*i~WvQndZfXbf+nhCpyi%_~YHX)vQ^wR2lITah6>>q6*m*0c+ZPwsUQ?m1WT^1?wzdrNX?A;+!S%38qS zCt@~YPm8|3z8;k!fh@7O9+|h{wD`NzS#@soBdA5LM;-!(th;|^-L^KUJ8hJRDca{^ z&^JqVL=|#g0&WEg=}sSH1(O6TxG)|MFbDHv>Xa$IOaFp0VdBI=&rOlfJQ^c);rE#) z64tf00#28pA~wnr>p&K3inseT4G+Ss*~xbo&0+&NQ=+P*_JYohw`|_5mMmFP+I)Tu zRh2P;-03{Frm#3`QwKelW_~j$LG!?xtXlol!!L+crd=|^xYG#PsLHL68?=^b#&gd- z7ppxFu5+#BUB7<4?*`a$KC_m*MI2VZnzUQ}G{Wzgr6}U6%9z567?(Qgd>AOZi_=QS zZ|;kLlm5&>?@2K=(u}AA*5oB*KN0&?aTS#?#U52<$rQhaZh5(+aRsc&!?pJNT`8vO zsw!i`wCBmRmu@2{qtof7tec$YO&*pwOfB@Ue*NprTKxopV1A%Tk%RTvZ^wsu4o60%>Q5m!1bODtBusxl_iiom}8 z`+XzQX;|a5I&$P?k^PPl^WhZT>0B~6p+qbr&CALV*a5WH|EeBjf5sNQ@p3R(5U3M=F|)H^n5ZZs~z zU-Lz5T7bYc(n}CZ z#PTJ(lqDD5e*5h~&pEZ)F|9G%;52hxlU@%TRLEPlY*A5QVDcOEQr^kwCz^d;(l?tuf`R^@NmmM~-Gfj*=FvXN6N1aIU(DvL1^OXPHWvz9UBl<#*F$ z+O%nE;)Dq*D&x;Sd(d;UXU&SWvp}=Y99C!f9MNmiXi?V4k~96cAOBcAQWMz9s-=z= z^4c|PPHR2PM)F}rjCgah!nDBcQaKS?#C+K_7F7T5tFJm6YR{QFS7iYrPMS1Y{?vXZ z?RjcbOI*C4eDaB!5OGjiv}lpDtA;LNr4b=NXN49rt(FjS)ZdSQ>sjHHOD!QccRI9) znY{P*_9ogOfJo#dcOk>4pMI*&Ip-W@@rT9iG(N9wXUp7}jmM+TFSPmVrsInAPD$unHOSJ&OiVB)82Fa_1CLIhYmIUtPvT`tMdYDj3ut! ziiC@K_wL=QQmLp`f|!7x8_fpeY0rfr&-pM!60wZ->t$a2ph^gRG3rD-eWhzfO!=e< z?AfzNz4z|BDsK?+!Yi*Fv^NtjCC9P$_>~m~e81>CZuB^bv80WhhpM>JT`ET+i5UN1 ztY?=z>`)0%D`IAQeSLkYbzg`B7tFf`h#0WQe(i~HEfIGXu4JAd;6`qA2Ei=tmF7z1 zmVe9xdRrqY{ReuZY;M#+7AxUw-+eW2GlfoEX_<#3c?2b9BG& zf{62s=4uFJZQHiZH$PogAvY2*-dl!$Z?_B<>s8J~7O~qTpi3p-QhS3@qudd+wgCb8 zQ3Q;e$c;e8i!Z*YuD<%}&~Eor>w_QnfB)Ifa@~or8RYEoSl*W$Yds+&^rA1v)HD(> z?sLYmfZPQPvATsN6!JUx7lKjH)`N#GDzS*S4fV@L!2_wlo(q7eCfI z&mAP9!gqe}z4x4|v_>2|cFY;DYEy4%KvdcUR~ll8*sW6OQZYF$2fr4qtv(r?yn6kl zbR^qyYA{5|_1u33LB!x!*<>oLnZ^qX+ToLdJ&ASJ%`hP}5$Bv+vDO-IaSS%^tSDX@3{ywH)X*2?$t7Tpd0Q`t8VqEH;o}LH9y@;G{V)fEt zcW#SVwTLNZU_k_F9xSgn`bxBV-u(HhNIdcQw z_Y#pXSLWCvW)@J?R)A$iQsVW(wSyr@y3e#+>&94NNMwJ!1R^Ioh47Zw*9 zxnbUen7aeiQJcursZ-U}4fY_WB~7y;l1D=9PRQyoTx_D#_0~G;nrm*(Y9hI%(bL)w z25iL3eHx25_RDp}F-R&+NI+}Mm@(^=K_nvLxH)6;#C|96khsbt2~1uaUfZnL?fUed?+#4>YB^80X}aq$_P!?fMS-RFBS^*ZJg2(1Uf zQT}d{AsZ*9>B|A$c(ciIvhM9JzV znff@XyJo`VykH@@At0jKxK?{2mH=5FuhDUmQlr zyqEtodGh4g8>w-fE5k@k#H{29V~zj$&wo0?#i}yr-L-3%bC5y1K8Ft8Z*>lwtD02pIz~Dc&xc>+m|2VI;c0W0+Bjpo6{u5al;LX(nxb88v&|T59j}PCau@ z0hqEtOab8$JoMW>H7J}rZU`JJtACCvU@R{KG~W#oGiWo=oZ%U?vC2`pzc3&$M~;e# zRu~c$vAeFaE696w6jVo^x!1X1?+O(CSX*I)Oayb%g%>JId=Luf0^xkLE0?W=oIwQ3 z&9sW|pvjL zB9Dyh-DiwAFF!l6_d(O8$ z|N8INuR8%PA1myIiZeY3gn`r(-=$fQ)MP6RiM!JfWNu8ebNVFf`dxj}yeGmtD(e%< zh4H}$AE-^6HkEGS!^Vvp)#u`EY<%MlWip%#2495A4WVk+mUG4ptF6;QKx&AdR|^&_ z7)TFk@#=wFqrEZCJNL}h-`%#&>Gt9W-+^l>Y{mi?K0vz4Xe$hILD zMrYupc>`QJ>WNzgT;R-QI9bf8zbx4@#D#K!vkSz6g$q>~L1?(rdf?X8cW~5WNwwF- z`R2VO!G_8}(dc~Z9CFw^FapLR`=zU>&NAH!Luw+%8p}a=sM-5Csd^5qT`TXXtmit+ znJ>EdV&}1by=<$Orc9lxrplmZiYuKKdf?V#b*4|AEQDsH90%NVUEtHqUDiSl3!hu3 zWz$2ZTVY5|#2};FO1W#=8Nc?Vf_AlV&GfQE4bSfu*DA^hv*eF=;0DgEH!#J|xX;v? zYfp^(ivqMQ#=DEMsttocuuJ3CNO!6NkgAAT;Uov6sXM|+r7{bg0EfFA5jdfUSkI4n z{WCe(GiJ_Img3?axIvejAZD!M1Xs9vdPOWGsD~0Yhs;z>=a3}@X1p7%Nmaxk2Xr;- zFPpuOlS=f`N$$JVIC^wuzT_Px5pc>IMq5%w58S#ljyqs8pN_JYSfbn;UVH7e ziYfq^h#15gcM>dU_C7{u(ge(d5ii{1Ey?MZ9y^FonZrrVx z?qy{&xWSWM=ETbsIbWO zx^CXQc`KBmWG-TmV8#ZO(2j~0OBhHac{3eB5h1S@AqNW3W=&>uVlO97oM2Ql);+P5 z7h)?>qTMpRTlwajZzjHhU=rkFi9trh4w-9gP!>xLV2uw&>zKNH{`~n(%Zalj7fTFo z+Nm&AF_v;c6kJkIQM|#`rsa@x6EV28sYYx{Woa!iAjgj%pCS*dDje++MSs$y)KhNm zv_@PS4$4~+IH;(Iy!z^^&PLm5LHgvUKmDmniog8jFHVVRmL&Z*kQyw)cBwbsc%xq@ znDwJakG_=$h>?7-Jglg2RAo9i*M!tlDxE#Tz#<6|@)9a!q6(RdiF8$3=*1aH!DeQM zGTy-=>AxZEW1bYXjUy;H>hJF#NEaZizK+ zAxPK*X|V*x74QU<*A%~pnoY)Jy%*n`RWFF2^d_=(A^#lwOab7R) z34Q&^|5?6qOVRgS-CNrk*T` zAujLTLH83DA$N-4L*;?xdabA&F;2ul>d6Y(k`ODxF7TIVHEpGg*+jeIBtV?l&WTiY&`BgUkd8qw3!(<$>B zBa6>1MzSKQ9$A!FQlX{%i$R=#*}{bjb9KE7A!6{ZL$+A_@I;{#6%|!o;$C-(m}kq6 z)J<3A_LNxa)f9`UoGFZm;n1N&x5&YKP}zbIOAT%z$E`^VxCj(V#6V>i?oFIpYfHIk zREgCJ7#-O1gOQdK7NqH(r6uT+>tSxI3K$9}V&H^v;*?#+*wWAjSpryC;Fj(ZQ#g0J z78|*4JqTdQ-72d4l%@D01_E9(Prl#Ilgm#l2e9f<3K4?{x#9-A3bXx&B^+#(%TAlE z?mpL28WC%(dtE-P``nn)i5Og~yurHHrJ#!z$E_TFZbl)a)6LM)>mZxBSciIn@HOlCYi)~c* ze#cNN?DC`&9_TErSF z=1j5TO&BX;4_3^nV#S*hR>VHI%?F5NcPL9-taww#insx8j=57FE*0x+Q&RzP%Or_5 zueNp0>0?D40CsK^%gkOqbo%d5mU>`ysgmom;>`{#;*hx3ndah4?cCXc&Ej9SRyRMa zh-2X9o0rSO@3hzwNG;rTHou!cR>TQ`g%+2)Lmn=Z3w%zQ=Fo0AB)bM~afNFwu0dE4 zr-X>QL##AnURpF!yQ0eP+`?XK0HERQQ9D4wq*A#&Z?7oo~sw<}hj{if isset($smarty.post.address)}{$smarty.post.address}{elseif isset($edit)}{$address_info.address1|escape:'htmlall':'UTF-8'}{/if}
+
+ +
+ +
+
diff --git a/modules/wkfooteraboutblock/CHANGELOG.txt b/modules/wkfooteraboutblock/CHANGELOG.txt deleted file mode 100644 index 000b65308..000000000 --- a/modules/wkfooteraboutblock/CHANGELOG.txt +++ /dev/null @@ -1,52 +0,0 @@ ------------------------------- -# V1.0.3 to V1.0.4 ------------------------------- - -## Improved/Changed Features: - -* [CO] : [#528] licenses updated -* [FO] : [#387] Add nav bar and move language and currency selector at top at front office - - ------------------------------- -# V1.0.2 to V1.0.3 ------------------------------- - -## Improved/Changed Features: - -[*] FO : [#290] Using $this->_path for including css and js - - -------------------------------- -# V1.0.1 to V1.0.2 -------------------------------- - -## Improved/changed features - -[*] FO : Translations are corrected. - -## Update Policy - -- Mobule need only file update, can be updated only by UPLOADING new version on module - - - ------------------------------ -# V1.0.0 to V1.0.1 ------------------------------ - -## Added features - -+ [CO] : index.php added/Updated in all folders -+ [CO] : License.txt added. -+ [CO] : License added in every file. -+ [CO] : logo.gif file added. - - -## Improved/changed features - -- [CO] : WK_HTL_SHORT_DESC (configuration key) is called as multilang field now. - -## Update Policy - -- Mobule need only file update, can be updated only by UPLOADING new version on module \ No newline at end of file diff --git a/modules/wkfooteraboutblock/LICENSE.md b/modules/wkfooteraboutblock/LICENSE.md deleted file mode 100644 index 44b1b399c..000000000 --- a/modules/wkfooteraboutblock/LICENSE.md +++ /dev/null @@ -1,223 +0,0 @@ -SOFTWARE LICENCE AGREEMENT -=============================== - -This AGREEMENT is made effective on the date of the purchase of the software between Webkul Software Pvt. Ltd.,Company incorporated under the Companies Act, 1956 (hereinafter referred to as “Licensor"), and the purchaser of the software/ product (hereinafter referred to as "Licensee"). - -Preamble -================== -Licensor is a web and mobile product based organization engaged in the business of developing and marketing software for enterprise level e-commerce businesses. It is an ISO and NSR (NASSCOM) certified organization having a team of more than 150 creative engineers which come from different backgrounds. It has developed more than 700 web extensions and apps in the past few years for open source platforms which are used and trusted globally. Licensee now wishes to obtain license, and Licensor wishes to grant a license, to allow use of the software so purchased in developing the e-commerce business website/ mobile app of the Licensee, subject to the terms and conditions set forth herein. - - -THEREFORE, with the intent to be legally bound, the parties hereby agree as follows: - - -Agreement -================ - -1.Definitions : ------------------- -As used in this Agreement, the following capitalized terms shall have the definitions set forth below: - - -"Derivative Works" are works developed by Licensee, its officers, agents, contractors or employees, which are based upon, in whole or in part, the Source Code and/or the Documentation and may also be based upon and/or incorporate one or more other preexisting works of the Licensor. Derivative Works may be any improvement, revision, modification, translation (including compilation or recapitulation by computer), abridgment, condensation, expansion, or any other form in which such a preexisting work may be recast, transformed, or adapted. For purposes hereof, a Derivative Work shall also include any compilation that incorporates such a preexisting work. - - -"Documentation" is written, printed or otherwise recorded or stored (digital or paper) material relating to the Software and/or Source Code, including technical specifications and instructions for its use including Software/ Source Code annotations and other descriptions of the principles of its operation and instructions for its use. - - -"Improvements" shall mean, with respect to the Software, all modifications and changes made, developed, acquired or conceived after the date hereof and during the entire term of this Agreement. - - -"Source Code" is the computer programming source code form of the Software in the form maintained by the Licensor, and includes all non-third-party executables, libraries, components, and Documentation created or used in the creation, development, maintenance, and support of the Software as well as all updates, error corrections and revisions thereto provided by Licensor, in whole or in part. - - -2. Software License. -------------------------- - -(a)Grant of License. For the consideration set forth below, Licensor hereby grants to Licensee, and Licensee hereby accepts the worldwide, non-exclusive, perpetual, royalty-free rights and licenses set forth below: - - -(i)The right and license to use and incorporate the software, in whole or in part, to develop its website/ mobile app (including the integration of all or part of the Licensor’s software into Licensee's own software) on one domain ( Except Joomla modules , listed on store are entitled to be used on unlimited domain as per the standard guidelines ) only, solely for the own personal or business use of the Licensee. However, the License does not authorize the Licensee to compile, copy or distribute the said Software or its Derivative Works. - - -(ii)The right and license does not authorize the Licensee to make any backup or archival copies of the Software and / or the Source Code and Documentation. - -(iii)The right and license does not authorize the Licensee to migrate the domain license to another domain. - - -(b)Scope; Rights and Responsibilities. - - -(i)Licensor shall enable the Licensee to download one complete copy of the Software. - - -(ii)The Software is intended for the sole use of the Licensee in development of its own website/ mobile app. - - -(iii)Licensee does not have the right to hand over, sell, distribute, sub-license, rent, lease or lend any portion of the Software or Documentation, whether modified or unmodified, to anyone. Licensee should not place the Software on a server so that it becomes accessible via a public network such as the Internet for distribution purposes. In case the Licensee is using any source code management system like github, it can use the code there only when it has paid subscription from such management system. - - -(iv)Licensee is not authorized to appoint, or work with, third parties to perform any development services using the Source Code, the source code to Derivative Works and/or the Documentation on behalf of, or working with, the Licensee. Release of Source Code, Derivative Work source code and/or Documentation to any third party shall be considered as violation of the Agreement, inter-alia entailing forthwith termination and legal action. - - - -(c)Ownership. - - -(i)Software and Source Code. All right, title, copyright, and interest in the Software, Source Code, Software Modifications and Error corrections will be and remain the property of Licensor. - - -(ii)Derivative Works. As creation of Derivative Works by the Licensee is prohibited, thus, all right, title, copyright, and interest in any and/or all Derivative Works and Improvements created by, or on behalf of, Licensee will also be deemed to the property of Licensor. Licensor shall be entitled to protect copyright / intellectual property in all such Derivative Works and Improvements also in any country as it may deem fit including without limitation seeking copyright and/or patent protection. - - -3.Consideration. --------------------- - -(a)Licensee shall pay to Licensor the amount as mentioned on the website from where the order is placed, as one-time, upfront fees in consideration for the licenses and rights granted hereunder (hereinafter referred to as the "License Fee"). The License Fee to be paid by Licensee shall be paid upfront at the time of placing the order, and no credit will be allowed under any circumstances. - - -(b)Once paid, the License Fees shall be non-refundable. The Licensee has fully satisfied itself about the Software and has seen the demonstration, and only thereafter has placed the order. Thus, the License Fees or any part thereof is non-refundable. No claim for refund of the Licence Fees shall be entertained under any circumstances. - - - -4.Representations and Warranties. -------------------------------------- - -(a)Mutual. Each of the parties represents and warrants to the other as follows. - - -(i)such party is a legal entity duly organized, validly existing and in good standing; - - -(ii)such party has the power and authority to conduct its business as presently conducted and to enter into, execute, deliver and perform this Agreement. - - -(iii)This Agreement has been duly and validly accepted by such party and constitutes the legal, valid and binding obligations of such party respectively, enforceable against such party in accordance with their respective terms; - - -(iv)the acceptance, execution, delivery and performance of this Agreement does not and will not violate such party's charter or by-laws; nor require any consent, authorization, approval, exemption or other action by any third party or governmental entity. - - -(b)Licensor warrants that, at the time of purchase of the Software: - - -the Software will function materially as set forth in the website or published functionality provided by Licensor to customers and potential customers describing the Software; and - - -Software add-ons, if purchased by the Licensee from the Licensor, will not materially diminish the features or functions of or the specifications of the Software as they existed as of the execution of this Agreement. - - - -(c)Title. Licensor represents and warrants that it is the exclusive owner of all copyright/ intellectual property in the Software (including the Source Code) and has good and marketable title to the Software (including the Source Code) free and clear of all liens, claims and encumbrances of any nature whatsoever (collectively, "Liens"). Licensor's grant of license and rights to Licensee hereunder does not, and will not infringe any third party's property, intellectual property or personal rights. - - - -5.Term. -------------- - -(a)Subject to Licensee's payment obligations, this Agreement shall commence as on the date of making payment of the Software by the Licensee to the Licensor, and shall continue until terminated by either party. - - -(b)The Licensor retains the right to terminate the license at any time, if the Licensee is not abiding by any of the terms of the Agreement. The Licensee may terminate the Agreement at any time at its own discretion by uninstalling the Software and /or by destroying the said Software (or any copies thereof). However, the Licensee shall not be entitled to seek any refund of the amount paid by it to the Licensor, under any circumstances. - - -(c)Survival. In the event this Agreement is terminated for any reason, the provisions set forth in Sections 2(a), 2(b), and 2(c) shall survive. - - - - -6. Indemnification ----------------------- - -The Licensee release the Licensor from, and agree to indemnify, defend and hold harmless the Licensor (and its officers, directors, employees, agents and Affiliates) against, any claim, loss, damage, settlement, cost, taxes, expense or other liability (including, without limitation, attorneys' fees) (each, a "Claim") arising from or related to: (a) any actual or alleged breach of any obligations in this Agreement; (b) any refund, adjustment, or return of Software,(c) any claim for actual or alleged infringement of any Intellectual Property Rights made by any third party or damages related thereto; or (d) Taxes. - - -7. Limitation of Liability ------------------------------- - -The Licensor will not be liable for any direct, indirect, incidental, special, consequential or exemplary damages, including but not limited to, damages for loss of profits, goodwill, use, data or other intangible losses arising out of or in connection with the Software, whether in contract, warranty, tort etc. (including negligence, software liability, any type of civil responsibility or other theory or otherwise) to the Licensee or any other person for cost of software, cover, recovery or recoupment of any investment made by the Licensee or its affiliates in connection with this Agreement, or for any other loss of profit, revenue, business, or data or punitive or consequential damages arising out of or relating to this Agreement. Further, the aggregate liability of the Licensor, arising out of or in connection with this Agreement or the transactions contemplated hereby will not exceed at any time, or under any circumstances, the total amounts received by the Licensor from the Licensee in connection with the particular software giving rise to the claim. - - -8. Force Majeure ---------------------- - -The Licensor will not be liable for any delay or failure to perform any of its obligations under this Agreement by reasons, events or other matters beyond its reasonable control. - - -9. Relationship of Parties ------------------------------- - -The Licensor and Licensee are independent legal entities, and nothing in this Agreement will be construed to create a partnership, joint venture, association of persons, agency, franchise, sales representative, or employment relationship between the parties. The Licensee will have no authority to make or accept any offers or representations on behalf of the Licensor. The relationship between the parties is that of Licensor and Licensee only, and the rights, duties, liabilities of each party shall be governed by this Agreement. - - -10. Modification ------------------------- - -The Licensor may amend any of the terms and conditions contained in this Agreement at any time and solely at its discretion. Any changes will be effective upon the posting of such changes on the Portal/ website, and the Licensee is responsible for reviewing these changes and informing itself of all applicable changes or notices. The continued use of a software by the Licensee after posting of any changes by the Licensor, will constitute the acceptance of such changes or modifications by the Licensee. - - - -11.Miscellaneous. ------------------------ - -(a)General Provisions. This Agreement: (i) may be amended only by a writing signed by each of the parties; (ii) may be executed in several counterparts, each of which shall be deemed an original but all of which shall constitute one and the same instrument; (iii) contains the entire agreement of the parties with respect to the transactions contemplated hereby and supersedes all prior written and oral agreements, and all contemporaneous oral agreements, relating to such transactions; (iv) shall be governed by, and construed and enforced in accordance with, the laws of India; and (v) shall be binding upon, and inure to the benefit of, the parties and their respective successors and permitted assigns. Each of the parties hereby irrevocably submits to the jurisdiction of the Courts at Delhi, India, for the purposes of any action or proceeding arising out of or relating to this Agreement or the subject matter hereof and brought by any other party. - - -(b)Assignment. Licensee cannot assign, pledge or otherwise transfer, whether by operation of law or otherwise, this Agreement, or any of its obligations hereunder, without the prior written consent of Licensor, which consent shall not be unreasonably withheld. - - -(c)Notices. Unless otherwise specifically provided herein, all notices, consents, requests, demands and other communications required or permitted hereunder: - - -(i)shall be in writing; - - -(ii)shall be sent by messenger, certified or registered mail/email, or reliable express delivery service, to the appropriate address(es) set forth below; and - - -(iii)shall be deemed to have been given on the date of receipt by the addressee, as evidenced by a receipt executed by the addressee (or a responsible person in his or her office), the records of the Party delivering such communication or a notice to the effect that such addressee refused to claim or accept such communication, if sent by messenger, mail or express delivery service. - - -All such communications shall be sent to the following addresses or numbers, or to such other addresses or numbers as any party may inform the others by giving five days' prior notice: - - -If to Webkul Software Pvt. Ltd.: - - - -Webkul Software Pvt. Ltd. - -H-28, ARV Park, Sector 63, NOIDA – 201301, - -Uttar Pradesh, India - - -If to Licensee: - -At the address mentioned by the Licensee - -(at the time of placing order of generating Invoice) - - -(d)Severability. It is the intent of the parties that the provisions of this Agreement be enforced to the fullest extent permissible under the laws and public policies of India in which enforcement hereof is sought. In furtherance of the foregoing, each provision hereof shall be severable from each other provision, and any provision hereof which is/ becomes unenforceable shall be subject to the following: (i) if such provision is contrary to or conflicts with any requirement of any statute, rule or regulation in effect, then such requirement shall be incorporated into, or substituted for, such unenforceable provision to the minimum extent necessary to make such provision enforceable; (ii) the court, agency or arbitrator considering the matter is hereby authorized to (or, if such court, agency or arbitrator is unwilling or fails to do so, then the parties shall) amend such provision to the minimum extent necessary to make such provision enforceable, and the parties hereby consent to the entry of an order so amending such provision; and (iii) if any such provision cannot be or is not reformed and made enforceable pursuant to clause (i) or (ii) above, then such provision shall be ineffective to the minimum extent necessary to make the remainder of this Agreement enforceable. Any application of the foregoing provisions to any provision hereof shall not effect the validity or enforceability of any other provision hereof. - - -(e)By purchasing the Software, the Licensee acknowledge that it has read this Agreement, and that it agrees to the content of the Agreement, its terms and agree to use the Software in compliance with this Agreement. - - -(f)The Licensor holds the sole copyright of the Software. The Software or any portion thereof is a copyrightable matter and is liable to be protected by the applicable laws. Copyright infringement in any manner can lead to prosecution according to the current law. The Licensor reserves the right to revoke the license of any user who is not holding any license or is holding an invalid license. - - -(g)This Agreement gives the right to use only one copy of the Software on one domain solely for the own personal or business use of the Licensee, subject to all the terms and conditions of this Agreement. A separate License has to be purchased for each new Software installation. Any distribution of the Software without the written consent of the Licensor (including non-commercial distribution) is regarded as violation of this Agreement, and will entail immediate termination of the Agreement and may invite liability, both civil and criminal, as per applicable laws. - - -(h)The Licensor reserves the rights to publish a selected list of users/ Licensees of its Software, and no permission of any Licensee is needed in this regard. The Licensee agrees that the Licensor may, in its sole discretion, disclose or make available any information provided or submitted by the Licensee or related to it under this Agreement to any judicial, quasi-judicial, governmental, regulatory or any other authority as may be required by the Licensor to co-operate and / or comply with any of their orders, instructions or directions or to fulfill any requirements under applicable Laws. - - -(i)If the Licensee continues to use the Software even after the sending of the notice by the Licensor for termination, the Licensee agree to accept an injunction to restrain itself from its further use, and to pay all costs (including but not limited to reasonable attorney fees) to enforce injunction or to revoke the License, and any damages suffered by the Licensor because of the misuse of the Software by the Licensee. - - -12. Arbitration ------------------------ - -If any dispute arises between the Licensor and the Licensee at any time, in connection with the validity, interpretation, implementation or alleged breach of any provision of this Agreement, the same shall be referred to a sole Arbitrator who shall be an independent and neutral third party appointed exclusively by the Licensor. The Licensee shall not object to the appointment of the Arbitrator so appointed by the Licensor. The place of arbitration shall be Delhi, India. The Arbitration & Conciliation Act, 1996 as amended by The Arbitration & Conciliation (Amendment) Act, 2015, shall govern the arbitration proceedings. The arbitration proceedings shall be held in the English language. diff --git a/modules/wkfooteraboutblock/index.php b/modules/wkfooteraboutblock/index.php deleted file mode 100644 index 534dc97aa..000000000 --- a/modules/wkfooteraboutblock/index.php +++ /dev/null @@ -1,29 +0,0 @@ - -* @copyright 2010-2018 Webkul IN -* @license https://store.webkul.com/license.html -*/ - -header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); -header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); - -header('Cache-Control: no-store, no-cache, must-revalidate'); -header('Cache-Control: post-check=0, pre-check=0', false); -header('Pragma: no-cache'); - -header('Location: ../../../'); -exit; diff --git a/modules/wkfooteraboutblock/logo.gif b/modules/wkfooteraboutblock/logo.gif deleted file mode 100644 index c6839c90b242af2946174d9808b57d6accd5e9d0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1818 zcmbVNSy&TS6b>SS3l_0e+=syhmC0n131k8hvam#qU_=2+mC0l@5t50?AW38gWf5dm zP?SYQv=>*00!Ow@@hnaiNJ^%U7`rS}@hycUg zSZ=Hy7OUe*M^jc4F-6@J*Ssm9_)*WJEo5a$cxjp>eOGvc8MD;Twc07G8{+o#_4Vb& z%PYRS;E#I#9qV8P1Qxja95tvyhF0uqzH%qtV1?LyW7d0-~ zTOujl7rj3n%SaWZRW7g6P1P3!Y%G#*G9YVmV%KM&nW_G%m+D*1Y)dwpvs>Aa7m#n7 zN#|kt>#+@K0qObk3$lW;Q@E+c^GmG4bz9}z+Ag#mj5|~qR#XtW@m~AAEWhk>MaBL0 zE-SolgDkhJ<3Vp%Z?eE#xU48wn%8x!tL<=Gov!{!#Sz<8+xeOcM^+rIkJ#C9<91zi z{lo5u+m$*3N64o!2{QpQK%>yDhV=r3=gY`};lnN5&{30U1u?%s(K|Y`}>Gk_J@dDy?1w zK0bK{1hi@q7|mC36b31&(S})#D8iaRU}`XM9uQy_nso*pN#lT7m#8-h%_0z2 zQz}x(?CoM01O`;-1Q95VQj>ggYpp{fXhMrU=APV_(B{+ z$Poy+2=HQo44YBCQmB-Lyx?L^B2Yuq1|bY5CnvL$d2GtK3PvytgE?H7%Y_&X$Yjye zxEa!$yap}ENE2by8fY!02kaJc6_rGbK*rPOA?OSW#Y@9_6MG;aHbLoNGj4zpHV4+} z>~Rffn`kBZuN$w_Hbq$sB&;M&RFaV(8FjBgFq6C26WJ9RZ-fy>EmIUcQAQC-I#N%| zWg?KdVXL)jp_)sgD3|bsNCYJz6jA#^0-O{;m>MTlI41Drar_4Dyb6!V{7|V_CKU(} z8G-~0BvJ`Kgo_CLkPyC1Dh(dQ%Jn81*AwI*x0d04ft9=#E0h{ZoTiLX6qPvG1(6zx zrc4^j07#|wstW*b1x{%7cHwM$p`OPrBaPa%q&mb%>41Su3$?HCf=}S8l^k>>L~?j2 zgkrcKq~Z|-gb*kbJ5QzJqCD^gUj2VF2s2K>_ICMC`wWVhp0saY4g+&|IZmXWnIR)H zEDrsD_x<(fAHP5Q?blzP{`}LAPaZ$|;rs8tefUjpPxpha`}b^}ckg_CyW>{-&981; zzjn3l%PW_^`24d^KWV*m@xu9!&z)^KbNbXrCr^BM{MgYWhd+4#(82ebn-1)Mci-N| zJq^2e?X0h>t=X}?dfV2j$}O8K%F9YiiZ>M%ZY;>p%iXX(Cp#-MBRwrOWu4VxPF|Zt zn~ZA=lwOyZuv)8GwUSg5Dm;G0@^|9iUKSe@y>v;`V&$U9h=qy;;q&ETp&`LCsYDzU zI8PMdFT@0XzI>F&MK~}U@|inlw)d==Gp2iip1`!JQzlQEIKgB5xVPRM>psTqjnS^7 zMvfTn;ylc0sN)a^7R&SZp)C9Iv48BZ0L!^QW2Cdh;EZA3-tz(jr_RSmPFf^#bQ?Z= z!h{&we{GWIbcqNA63h@}j2ye%bJ8T-;0UgE)DLq=8J6ffbQUtv*$q&-#--`vH5TFw zIuQdoW1^fq!h<}PxbRRhA3GoI>M?nSobTZRi|6vauZ@e6DpokCgIwmW68Ly4qaVf0 zZgI>QIyF>aYZ1$Gi(UMMF%B&)!-kA?7epEENiG%7Rk>6l?(tdWtRQ7;$)V89+|diX zBMna)d!{*CYZ7r=S+xqLxucy%IF$ggZZ0hUe*iExzFYtR diff --git a/modules/wkfooteraboutblock/logo.png b/modules/wkfooteraboutblock/logo.png deleted file mode 100644 index a0ab2968a35c9b69ec669b1b2f415bb7c7f35b22..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1164 zcmV;71atd|P)R5shUcgj6aQ_Pob7a zm!(vuhdYRpMU#6le0eW-M3HVaZ)qiJWH4oOH*|6= za&RhfZ7*(WENf>fXlyKOgFu9KGIwPrW`90_<i6w_-_qb2%4PV)R`cbXeF~M-KlO!VS<+Oq4!_O6qe|GAU%>+c3vtAw8c!C3W~MbA6N+%97_&sHEPUwAi7J z2?eOLFz{i$Dbt#8!inLMe5)R<Z~xNOvE_`VyUyrQsxQimvqft+L5 z5Y2I=r0@?)9iqf}WYuI!mE?&T*%2eg?W@Zl+u%P1PINkitnGy zDU?!&S(JDKz&z)oIR%uL1S&}(Hb=>`28-s^|MKIK!h4iDL|Kli?M5SH6QG5HgECK{ zlsdG1wi=WKDv9vIvc;`fulvD|veljbg}g)VAw`tOMQA+$&dt+Jo%oLSW z&Dk`qE-w}{C{=Sd&Fc#$&?a0otbD2|Y(7ipJydbUK|(CLfSbNEh=W(|zLrQ3?nJs=ICI>J^;FDs&Z^Hpix^ z=43Ls{0+i6{8Cc;*P&g=T33rOM+{fejssDi#epCVo{tH4IM3g15BZLfFnFAR+dJ4X ews$)Rd;b80T?{7Pq1;9Q0000initUpgrade(); -} - -class UpgradeWkFooterAboutBlock104 -{ - public function __construct($module) - { - $this->module = $module; - } - - public function initUpgrade() - { - return $this->module->unregisterHook('displayFooterPaymentInfo'); - } -} diff --git a/modules/wkfooteraboutblock/views/css/index.php b/modules/wkfooteraboutblock/views/css/index.php deleted file mode 100644 index 534dc97aa..000000000 --- a/modules/wkfooteraboutblock/views/css/index.php +++ /dev/null @@ -1,29 +0,0 @@ - -* @copyright 2010-2018 Webkul IN -* @license https://store.webkul.com/license.html -*/ - -header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); -header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); - -header('Cache-Control: no-store, no-cache, must-revalidate'); -header('Cache-Control: post-check=0, pre-check=0', false); -header('Pragma: no-cache'); - -header('Location: ../../../'); -exit; diff --git a/modules/wkfooteraboutblock/views/css/wkFooterAboutBlockFront.css b/modules/wkfooteraboutblock/views/css/wkFooterAboutBlockFront.css deleted file mode 100644 index eed441b13..000000000 --- a/modules/wkfooteraboutblock/views/css/wkFooterAboutBlockFront.css +++ /dev/null @@ -1,25 +0,0 @@ -/** -* 2010-2018 Webkul. -* -* NOTICE OF LICENSE -* -* All right is reserved, -* Please go through this link for complete license : https://store.webkul.com/license.html -* -* DISCLAIMER -* -* Do not edit or add to this file if you wish to upgrade this module to newer -* versions in the future. If you wish to customize this module for your -* needs please refer to https://store.webkul.com/customisation-guidelines/ for more information. -* -* @author Webkul IN -* @copyright 2010-2018 Webkul IN -* @license https://store.webkul.com/license.html -*/ - -.footer-about-hotel { - color: #BFBFBF; - font-size: 16px; - font-weight: 400; - line-height: 25px; -} \ No newline at end of file diff --git a/modules/wkfooteraboutblock/views/index.php b/modules/wkfooteraboutblock/views/index.php deleted file mode 100644 index 534dc97aa..000000000 --- a/modules/wkfooteraboutblock/views/index.php +++ /dev/null @@ -1,29 +0,0 @@ - -* @copyright 2010-2018 Webkul IN -* @license https://store.webkul.com/license.html -*/ - -header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); -header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); - -header('Cache-Control: no-store, no-cache, must-revalidate'); -header('Cache-Control: post-check=0, pre-check=0', false); -header('Pragma: no-cache'); - -header('Location: ../../../'); -exit; diff --git a/modules/wkfooteraboutblock/views/templates/hook/index.php b/modules/wkfooteraboutblock/views/templates/hook/index.php deleted file mode 100644 index 534dc97aa..000000000 --- a/modules/wkfooteraboutblock/views/templates/hook/index.php +++ /dev/null @@ -1,29 +0,0 @@ - -* @copyright 2010-2018 Webkul IN -* @license https://store.webkul.com/license.html -*/ - -header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); -header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); - -header('Cache-Control: no-store, no-cache, must-revalidate'); -header('Cache-Control: post-check=0, pre-check=0', false); -header('Pragma: no-cache'); - -header('Location: ../../../'); -exit; diff --git a/modules/wkfooteraboutblock/views/templates/hook/wkFooterAboutBlock.tpl b/modules/wkfooteraboutblock/views/templates/hook/wkFooterAboutBlock.tpl deleted file mode 100644 index 8350b5b0e..000000000 --- a/modules/wkfooteraboutblock/views/templates/hook/wkFooterAboutBlock.tpl +++ /dev/null @@ -1,30 +0,0 @@ -{* -* 2010-2018 Webkul. -* -* NOTICE OF LICENSE -* -* All right is reserved, -* Please go through this link for complete license : https://store.webkul.com/license.html -* -* DISCLAIMER -* -* Do not edit or add to this file if you wish to upgrade this module to newer -* versions in the future. If you wish to customize this module for your -* needs please refer to https://store.webkul.com/customisation-guidelines/ for more information. -* -* @author Webkul IN -* @copyright 2010-2018 Webkul IN -* @license https://store.webkul.com/license.html -*} - -
-
- - -
-
\ No newline at end of file diff --git a/modules/wkfooteraboutblock/views/templates/index.php b/modules/wkfooteraboutblock/views/templates/index.php deleted file mode 100644 index 534dc97aa..000000000 --- a/modules/wkfooteraboutblock/views/templates/index.php +++ /dev/null @@ -1,29 +0,0 @@ - -* @copyright 2010-2018 Webkul IN -* @license https://store.webkul.com/license.html -*/ - -header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); -header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); - -header('Cache-Control: no-store, no-cache, must-revalidate'); -header('Cache-Control: post-check=0, pre-check=0', false); -header('Pragma: no-cache'); - -header('Location: ../../../'); -exit; diff --git a/modules/wkfooteraboutblock/wkfooteraboutblock.php b/modules/wkfooteraboutblock/wkfooteraboutblock.php deleted file mode 100644 index 42cde657a..000000000 --- a/modules/wkfooteraboutblock/wkfooteraboutblock.php +++ /dev/null @@ -1,62 +0,0 @@ - -* @copyright 2010-2018 Webkul IN -* @license https://store.webkul.com/license.html -*/ - -if (!defined('_PS_VERSION_')) { - exit; -} - -class WkFooterAboutBlock extends Module -{ - public function __construct() - { - $this->name = 'wkfooteraboutblock'; - $this->tab = 'front_office_features'; - $this->version = '1.0.4'; - $this->author = 'Webkul'; - $this->need_instance = 0; - - $this->bootstrap = true; - parent::__construct(); - - $this->displayName = $this->l('Footer About Hotel Block'); - $this->description = $this->l('Show About Hotel block in footer.'); - $this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_); - } - - public function hookDisplayFooterMostLeftBlock($params) - { - $this->context->smarty->assign( - array('WK_HTL_SHORT_DESC' => Configuration::get('WK_HTL_SHORT_DESC', $this->context->language->id)) - ); - - $this->context->controller->addCSS($this->_path.'/views/css/wkFooterAboutBlockFront.css'); - return $this->display(__FILE__, 'wkFooterAboutBlock.tpl'); - } - - public function install() - { - if (!parent::install() - || !$this->registerHook('displayFooterMostLeftBlock') - ) { - return false; - } - return true; - } -} diff --git a/themes/hotel-reservation-theme/contact-form.tpl b/themes/hotel-reservation-theme/contact-form.tpl index 6a5aedbe0..e3f5bb273 100644 --- a/themes/hotel-reservation-theme/contact-form.tpl +++ b/themes/hotel-reservation-theme/contact-form.tpl @@ -159,7 +159,7 @@ {hook h='displayBeforeHotelBranchInformation'} {/block} {block name='contact_form_hotel_branches'} - {if isset($hotelsInfo) && $hotelsInfo} + {if isset($displayHotels) && $displayHotels && isset($hotelsInfo) && $hotelsInfo}
{l s='Our Hotels'} @@ -200,8 +200,8 @@ {hook h='displayAfterHotelBranchInformation'} {/block} {block name='contact_form_hotel_locations'} - {if isset($hotelLocationArray)} -
+ {if isset($displayHotelMap) && $displayHotelMap && isset($hotelLocationArray)} +
diff --git a/themes/hotel-reservation-theme/css/contact-form.css b/themes/hotel-reservation-theme/css/contact-form.css index 5ffae05e0..7e6ee9769 100644 --- a/themes/hotel-reservation-theme/css/contact-form.css +++ b/themes/hotel-reservation-theme/css/contact-form.css @@ -274,3 +274,9 @@ outline: none; color: #427fed; } +.margin-bottom-30 { + margin-bottom: 30px; +} +.margin-top-30 { + margin-top: 30px; +} \ No newline at end of file diff --git a/themes/hotel-reservation-theme/css/modules/blockuserinfo/blockuserinfo.css b/themes/hotel-reservation-theme/css/modules/blockuserinfo/blockuserinfo.css index e97d787ca..979d70364 100644 --- a/themes/hotel-reservation-theme/css/modules/blockuserinfo/blockuserinfo.css +++ b/themes/hotel-reservation-theme/css/modules/blockuserinfo/blockuserinfo.css @@ -37,6 +37,11 @@ #user_info_acc span.caret { border-top-color: #fff; } +div.our_hotel_tab a{ + color: #fff; + font-size: 17px; + font-weight: 400;} + @media (max-width: 450px) { .hide_xs { display: none; } diff --git a/themes/hotel-reservation-theme/css/properties.css b/themes/hotel-reservation-theme/css/properties.css new file mode 100644 index 000000000..c96b81421 --- /dev/null +++ b/themes/hotel-reservation-theme/css/properties.css @@ -0,0 +1,286 @@ +/** +* NOTICE OF LICENSE +* +* This source file is subject to the Open Software License version 3.0 +* that is bundled with this package in the file LICENSE.md +* It is also available through the world-wide-web at this URL: +* https://opensource.org/license/osl-3-0-php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to support@qloapps.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade this module to a newer +* versions in the future. If you wish to customize this module for your needs +* please refer to https://store.webkul.com/customisation-guidelines for more information. +* +* @author Webkul IN +* @copyright Since 2010 Webkul +* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0 +*/ + +.margin-top-50 { + margin-top: 50px; +} +.margin-bottom-30 { + margin-bottom: 30px; +} +.margin-bottom-20 { + margin-bottom: 20px; +} +.margin-top-20 { + margin-top: 20px; +} +.htl-contact-page { + padding: 10px; +} +.page-heading { + font-size: 32px; +} +.empty-properties-container{ + margin: 30px; +} +.htl-contact-page .contact-header { + font-size: 42px; + color: rgba(0, 0, 0, 1); + text-align: center; + font-weight: 300; + margin-bottom: 20px; +} +.htl-contact-page .contact-desc { + font-size: 16px; + color: rgba(0, 0, 0, 1); + text-align: center; + font-weight: 300; + margin-bottom: 20px; + line-height: 30px; +} +.htl-contact-page .contact-form-box { + padding: 30px; + border-radius: 4px; + box-shadow: 2px 2px 15px 3px rgba(0,0,0,.1); +} +.htl-contact-page .contact-form-box .control-label { + font-size: 14px; + color: rgba(0, 0, 0, 1); + font-weight: 400; +} +.htl-contact-page .contact-form-box .form-control, .htl-contact-page .uploader span.filename { + border: 1px solid rgba(0, 0, 0, 1); + font-size: 14px; + color: rgba(0, 0, 0, 1); + font-weight: 400; +} +.htl-contact-page .uploader span.filename { + font-size: 12px; +} +.htl-contact-page .contact-form-box #contact_type { + width: 90%; + text-align: left; +} +.title-container { + margin-left: 150px; + margin-right: 150px; + color: #333333;} +.htl-contact-page .contact_type_ul { + font-size: 14px; + font-weight: 400; + top: 45px; + padding: 0px; + width: 100%; + border-bottom: 1px solid rgba(0, 0, 0, 1); + border-left: 1px solid rgba(0, 0, 0, 1); + border-right: 1px solid rgba(0, 0, 0, 1); + max-height: 145px; + overflow-y: auto; +} +.htl-contact-page .contact_type_ul li { + cursor: default; + font-size: 14px; + color: rgba(0, 0, 0, 1); + font-weight: 400; + padding: 11px; +} +.htl-contact-page .contact_type_ul li:hover, .htl-contact-page .contact_type_ul li:focus, .htl-contact-page .contact_type_ul li:active { + background-color: #379bf0; + color: #FFFFFF; +} +.htl-contact-page .contact_btn { + font-size: 14px; + color: rgba(255, 255, 255, 1); + font-weight: 600; + text-transform: uppercase; + border-radius: 4px; + padding: 0 20px; +} +.htl-contact-page .global-address-header { + font-weight: 400; + font-size: 12px; + color: rgba(0, 0, 0, .6); + text-transform: uppercase; + margin-bottom: 5px; +} +.htl-contact-page .global-address-value { + font-weight: 400; + font-size: 14px; + margin-bottom: 10px; + color: rgba(0, 0, 0, 1); + line-height: 22px; +} +.htl-contact-page .htl-global-address-div { + padding: 20px; + border-radius: 4px; + margin-bottom: 10px; + box-shadow: 2px 2px 15px 3px rgba(0,0,0,.1); +} +@media screen and (min-width: 767px) { + .htl-contact-page .htl-global-address-div { + margin-top: 60px; + } +} +.htl-contact-page .hotels-container { + display: flex; + flex-wrap: wrap; + justify-content: flex-start; +} +.hotels-container .hotel-header { + margin-bottom: 40px; + text-align: center; +} +.hotels-container .hotel-header>span { + font-size: 30px; + font-weight: 400; + color: rgba(0, 0, 0, 1); + border-bottom: 1px solid rgba(0, 0, 0, 1); +} +.htl-contact-page span.action { + background:#379bf0!important; +} +.htl-contact-page .hotel-address-container { + border-radius: 4px; + box-shadow: 2px 2px 15px 3px rgba(0,0,0,.1); + float: left; + padding: 15px 0px; + width: 100%; +} +.htl-contact-page .hotel-city-container>span { + font-size: 20px; + font-weight: 400; + color: rgba(0, 0, 0, 1); +} +.hotel-address-container .hotel-name { + font-size: 18px; + font-weight: 400; + color: rgba(0, 0, 0, 1); + margin-bottom: 15px; +} +.hotel-address-container span.htl-address-icon { + background-image: url(../../../modules/hotelreservationsystem/views/img/Slices/icon-contact.png); +} +.hotel-address-container img.htl-img { + border-radius: 6px; +} +.empty-properties-image-container { + background-image: url(../../../modules/hotelreservationsystem/views/img/Slices/no-hotel.png) ; + background-repeat:no-repeat; + background-position: center center; + padding: 200px 0px 10px 0px; + display: block; +} +.hotel-address-container span.htl-phone-icon { + background-image: url(../../../modules/hotelreservationsystem/views/img/Slices/icon-contact.png); + padding: 1px 15px 0px 2px; + background-position: 37px; + margin-right: 5px; + font-size: 14px; +} +.hotel-address-container span.htl-email-icon { + padding: 1px 10px 1px; + background-position: 19px; + margin-right: 5px; +} +.htl-contact-page .hotel-city-container { + margin-bottom: 10px; +} +span.htl-map-icon { + background-image: url(../../../modules/hotelreservationsystem/views/img/Slices/icon-contact.png); + padding: 1px 20px 0px 0px; + background-position: 0px 0px; + margin-right: 5px; + font-size: 14px; +} +.view_rooms_btn, .htl-map-direction-btn { + border-radius: 4px; + padding: 10px 12px; + text-transform: uppercase; +} + +.htl-map-direction-btn{ + background-color: #DEDEDE; + color: #333333; +} +.view_rooms_btn { + background-color: #1292FF; + border-color: #1292FF; + font-weight: 600; +} +.view_rooms_btn:hover { + background-color: #3c89cb; + border-color: #3a75a7; +} +.pagination-container { + text-align: center; +} +.hotel-branch-info-actions{ + display: flex; + gap: 10px; +} +.pagination-container .pagination > li > a, .pagination-container .pagination > li > span { + border: unset; +} +.pagination-container .pagination > li .active { + border: 1px solid #333333; + border-radius: 12px; + z-index: 10; +} +.hotel-address-container p.hotel-branch-info-value { + font-size: 14px; + color: rgba(0, 0, 0, 1); + font-weight: 400; + line-height: 25px; +} +.hotel-address-container .htl-map-direction-btn span { + font-size: 12px; + color: rgba(0, 0, 0, 1); + font-weight: 400; +} +/* ==== google map ==== */ +#googleMapWrapper { + clear: both; + height: 500px; +} +#map { + width: 100%; + height: 100%; +} + +#map .view-link { + padding-top: 4px; +} + +.gm-btn-get-directions { + text-decoration: none; + color: #427fed; + font-weight: bold; +} + +.gm-btn-get-directions:hover { + text-decoration: underline; + color: #427fed; +} + +.gm-btn-get-directions:focus { + outline: none; + color: #427fed; +} diff --git a/themes/hotel-reservation-theme/js/properties.js b/themes/hotel-reservation-theme/js/properties.js new file mode 100644 index 000000000..c48b6944d --- /dev/null +++ b/themes/hotel-reservation-theme/js/properties.js @@ -0,0 +1,85 @@ +/** +* NOTICE OF LICENSE +* +* This source file is subject to the Open Software License version 3.0 +* that is bundled with this package in the file LICENSE.md +* It is also available through the world-wide-web at this URL: +* https://opensource.org/license/osl-3-0-php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to support@qloapps.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade this module to a newer +* versions in the future. If you wish to customize this module for your needs +* please refer to https://store.webkul.com/customisation-guidelines for more information. +* +* @author Webkul IN +* @copyright Since 2010 Webkul +* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0 +*/ + +$(document).ready(function() { + + //By Webkul JS for Map locations of the hotels on google Map + if (typeof hotelLocationArray != 'undefined' + && $('#map').length + && typeof google == 'object' + && typeof google.maps == 'object' + ) { + initMap(); + } +}); + +function initMap() { + var map; + var bounds = new google.maps.LatLngBounds(); + hotelLocationArray = JSON.parse(hotelLocationArray); + + // Display a map on the page + map = new google.maps.Map(document.getElementById("map")); + google.maps.event.trigger(map, 'resize'); + + map.setTilt(45); + + // Display multiple markers on a map + var infoWindow = new google.maps.InfoWindow(); + var marker; + var i; + + $.each(hotelLocationArray, function(i, location) { + var position = new google.maps.LatLng(location.latitude, location.longitude); + bounds.extend(position); + marker = new google.maps.Marker({ + position: position, + map: map, + title: location.hotel_name, + animation: google.maps.Animation.DROP, + icon: PS_STORES_ICON + }); + + // Allow each marker to have an info window + google.maps.event.addListener(marker, 'click', (function(marker, i) { + return function() { + var directionsLink = 'https://www.google.com/maps/dir/?api=1&destination='+ + location.latitude+','+location.longitude; + var content = '
'+location.hotel_name+'
'+ + location.map_formated_address+ + ''; + infoWindow.setContent(content); + infoWindow.open(map, marker); + } + })(marker, i)); + + // Automatically center the map fitting all markers on the screen + map.fitBounds(bounds); + }); + + // Override our map zoom level once our fitBounds function runs (Make sure it only runs once) + var boundsListener = google.maps.event.addListener((map), 'bounds_changed', function(event) { + // this.setZoom(8); + google.maps.event.removeListener(boundsListener); + }); +} diff --git a/themes/hotel-reservation-theme/modules/blockuserinfo/nav.tpl b/themes/hotel-reservation-theme/modules/blockuserinfo/nav.tpl index aaa993549..746c4b0b4 100644 --- a/themes/hotel-reservation-theme/modules/blockuserinfo/nav.tpl +++ b/themes/hotel-reservation-theme/modules/blockuserinfo/nav.tpl @@ -31,21 +31,26 @@ - {else} - - {l s='Sign in' mod='blockuserinfo'} - - + {else} + + {l s='Sign in' mod='blockuserinfo'} + + {/if} {if !isset($ajaxCustomerLogin)}
+ {if isset($WK_DISPLAY_OUR_HOTEL_TAB_IN_HEADER) && $WK_DISPLAY_OUR_HOTEL_TAB_IN_HEADER} + + {/if} {/if} {/block} diff --git a/themes/hotel-reservation-theme/properties.tpl b/themes/hotel-reservation-theme/properties.tpl new file mode 100644 index 000000000..12ade303e --- /dev/null +++ b/themes/hotel-reservation-theme/properties.tpl @@ -0,0 +1,128 @@ +{* +* NOTICE OF LICENSE +* +* This source file is subject to the Open Software License version 3.0 +* that is bundled with this package in the file LICENSE.md +* It is also available through the world-wide-web at this URL: +* https://opensource.org/license/osl-3-0-php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to support@qloapps.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade this module to a newer +* versions in the future. If you wish to customize this module for your needs +* please refer to https://store.webkul.com/customisation-guidelines for more information. +* +* @author Webkul IN +* @copyright Since 2010 Webkul +* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0 +*} + +{block name='our_properties'} +{capture name=path}{l s='Our Properties'}{/capture} + {if isset($hotelsInfo) && $hotelsInfo} + {block name='our_properties_list_title'} +
+

{l s='Our Hotels'}

+
+

{$WK_HTL_SHORT_DESC|escape:'html':'UTF-8'}

+
+
+ {/block} + + {block name='displayPropertiesLocationBefore'} + {hook h='displayPropertiesLocationBefore'} + {/block} + + {block name='our_properties_location'} + {if isset($hotelLocationArray) && $hotelLocationArray && isset($displayHotelMap) && $displayHotelMap} +
+
+
+
+
+ {/if} +
+ {/block} + + {block name='displayPropertiesLocationAfter'} + {hook h='displayPropertiesLocationAfter'} + {/block} + + {block name='displayPropertiesListBefore'} + {hook h='displayPropertiesListBefore'} + {/block} + +
+ {block name='our_properties_list'} +
+ {foreach $hotelsInfo as $hotel} +
+
+
+ +
+
+

{$hotel['hotel_name']}

+

{$hotel['address']}, {$hotel['city']}, {if {$hotel['state_name']}}{$hotel['state_name']},{/if} {$hotel['country_name']}, {$hotel['postcode']}

+

+ {$hotel['phone']} +

+

+ {$hotel['email']} +

+
+ {l s='View Rooms'} + {if ($hotel['latitude'] != 0 || $hotel['longitude'] != 0) && $viewOnMap} + {l s='View on map'} + {/if} +
+
+
+
+ {/foreach} +
+ {/block} + + {block name='displayPropertiesListAfter'} + {hook h='displayPropertiesListAfter'} + {/block} + + {if (isset($pageLimit)) && $pageLimit > 1} + + + +
+
    + {if !isset($pagination[1])} +
  • 1
  • + {if !isset($pagination[2])} +
  • ...
  • + {/if} + {/if} + {foreach $pagination as $page} +
  • {$page}
  • + {/foreach} + {if !isset($pagination[$pageLimit])} + {if !isset($pagination[$pageLimit-1])} +
  • ...
  • + {/if} +
  • {$pageLimit}
  • + {/if} +
+
+ {/if} +
+ {else} +
+
+
+
+
+

{l s='No Hotel Found!!'}

+
+
+ {/if} +{/block} From 9919c1cd5fb34763695c1482304dca77ae5251a2 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Mon, 21 Apr 2025 13:06:44 +0530 Subject: [PATCH 13/29] Fixed: Issue during installation, and assigned missing variables in the smarty --- controllers/front/PropertiesController.php | 1 + .../blocknavigationmenu/classes/WkCustomNavigationLink.php | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/controllers/front/PropertiesController.php b/controllers/front/PropertiesController.php index 17bd1e291..6736c9ac7 100644 --- a/controllers/front/PropertiesController.php +++ b/controllers/front/PropertiesController.php @@ -132,6 +132,7 @@ class PropertiesControllerCore extends FrontController 'hotelLocationArray' => $hotelLocationArray, 'viewOnMap' => Configuration::get('WK_GOOGLE_ACTIVE_MAP'), 'displayHotelMap' => $displayHotelMap, + 'WK_HTL_SHORT_DESC' => Configuration::get('WK_HTL_SHORT_DESC', $this->context->language->id), 'currentIndex' => $this->context->link->getPageLink('properties') ) ); diff --git a/modules/blocknavigationmenu/classes/WkCustomNavigationLink.php b/modules/blocknavigationmenu/classes/WkCustomNavigationLink.php index deca3d60d..5346c4320 100644 --- a/modules/blocknavigationmenu/classes/WkCustomNavigationLink.php +++ b/modules/blocknavigationmenu/classes/WkCustomNavigationLink.php @@ -169,12 +169,14 @@ class WkCustomNavigationLink extends ObjectModel $objCustomNavigationLink->name[$language['id_lang']] = 'Our hotels'; } + $https_link = (Tools::usingSecureMode() && Configuration::get('PS_SSL_ENABLED')) ? 'https://' : 'http://'; + $objLink = new Link($https_link, $https_link); $objCustomNavigationLink->position = $this->getHigherPosition(); $objCustomNavigationLink->id_cms = 0; $objCustomNavigationLink->show_at_navigation = 1; $objCustomNavigationLink->show_at_footer = 0; $objCustomNavigationLink->active = 1; - $objCustomNavigationLink->link = Context::getContext()->link->getPageLink('properties'); + $objCustomNavigationLink->link = $objLink->getPageLink('properties'); $objCustomNavigationLink->is_custom_link = 1; $objCustomNavigationLink->save(); From ca3d64317c9a6523933629b5f74b1a26f569f109 Mon Sep 17 00:00:00 2001 From: azhar bhat Date: Thu, 24 Apr 2025 15:32:22 +0530 Subject: [PATCH 14/29] resolved the placeholder issue --- .../wkroomsearchblock/views/js/wk-room-search-block.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/wkroomsearchblock/views/js/wk-room-search-block.js b/modules/wkroomsearchblock/views/js/wk-room-search-block.js index e18babcb7..c002751ce 100644 --- a/modules/wkroomsearchblock/views/js/wk-room-search-block.js +++ b/modules/wkroomsearchblock/views/js/wk-room-search-block.js @@ -136,8 +136,13 @@ const BookingSearchManager = { success: function(result) { if (result.status) { $('#hotel_cat_id').val(''); - $('#id_hotel_button').html(result.html_hotel_options); - $('#id_hotel_button').trigger('chosen:updated'); + if (/Mobi|Android|iPhone/i.test(navigator.userAgent)) { + $('#id_hotel_button').focus() + } + else{ + $('#id_hotel_button').html(result.html_hotel_options); + $('#id_hotel_button').trigger('chosen:updated'); + } // Resetting the data from previously selected hotel $('#preparation_time').val(0); var max_order_date = $('#max_order_date').val(); From 3862b42796f0d499496e5a1e261b870b7a5ed008 Mon Sep 17 00:00:00 2001 From: azhar bhat Date: Thu, 24 Apr 2025 19:54:47 +0530 Subject: [PATCH 15/29] Issues on the product page have been resolved. --- .../wkroomsearchblock/views/js/wk-room-search-block.js | 10 +++------- .../views/templates/front/hotel-options.tpl | 2 +- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/modules/wkroomsearchblock/views/js/wk-room-search-block.js b/modules/wkroomsearchblock/views/js/wk-room-search-block.js index c002751ce..742c44c7d 100644 --- a/modules/wkroomsearchblock/views/js/wk-room-search-block.js +++ b/modules/wkroomsearchblock/views/js/wk-room-search-block.js @@ -136,13 +136,9 @@ const BookingSearchManager = { success: function(result) { if (result.status) { $('#hotel_cat_id').val(''); - if (/Mobi|Android|iPhone/i.test(navigator.userAgent)) { - $('#id_hotel_button').focus() - } - else{ - $('#id_hotel_button').html(result.html_hotel_options); - $('#id_hotel_button').trigger('chosen:updated'); - } + $('#id_hotel_button').html(result.html_hotel_options); + $('#id_hotel_button').focus(); + $('#id_hotel_button').trigger('chosen:updated'); // Resetting the data from previously selected hotel $('#preparation_time').val(0); var max_order_date = $('#max_order_date').val(); diff --git a/modules/wkroomsearchblock/views/templates/front/hotel-options.tpl b/modules/wkroomsearchblock/views/templates/front/hotel-options.tpl index 1c258d2c8..946dab890 100644 --- a/modules/wkroomsearchblock/views/templates/front/hotel-options.tpl +++ b/modules/wkroomsearchblock/views/templates/front/hotel-options.tpl @@ -17,7 +17,7 @@ * @license LICENSE.txt *} - + {if isset($hotels_info) && is_array($hotels_info)} {foreach from=$hotels_info item=hotel_info}
- {$search_data['htl_dtl']['hotel_name']|escape:'htmlall':'UTF-8'}, {$search_data['htl_dtl']['city']|escape:'htmlall':'UTF-8'} {if !$search_data['order_date_restrict']} {$search_data['date_from']|escape:'htmlall':'UTF-8'|date_format:"%d %b %Y"} - {$search_data['date_to']|escape:'htmlall':'UTF-8'|date_format:"%d %b %Y"} ({1+$search_data['num_days']|escape:'htmlall':'UTF-8'} {l s='Days' mod='wkroomsearchblock'} {$search_data['num_days']|escape:'htmlall':'UTF-8'} {if $search_data['num_days'] > 1}{l s='Nights' mod='wkroomsearchblock'}{else}{l s='Night' mod='wkroomsearchblock'}{/if}) {/if} + {$search_data['htl_dtl']['hotel_name']|escape:'htmlall':'UTF-8'}, {$search_data['htl_dtl']['city']|escape:'htmlall':'UTF-8'} {if !$search_data['order_date_restrict']} {if (isset($search_data['date_from']))}{$search_data['date_from']|escape:'htmlall':'UTF-8'|date_format:"%d %b %Y"}{/if} - {if isset($search_data['date_to'])}{$search_data['date_to']|escape:'htmlall':'UTF-8'|date_format:"%d %b %Y"}{/if} ({1+$search_data['num_days']|escape:'htmlall':'UTF-8'} {l s='Days' mod='wkroomsearchblock'} {$search_data['num_days']|escape:'htmlall':'UTF-8'} {if $search_data['num_days'] > 1}{l s='Nights' mod='wkroomsearchblock'}{else}{l s='Night' mod='wkroomsearchblock'}{/if}) {/if}
From 56e9a1884d8b0ac528fdbd939e02ba61afa52409 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Fri, 16 May 2025 18:40:17 +0530 Subject: [PATCH 21/29] Fixed responsive design issues for proprties list, renamed properties controller to our properties controller --- classes/controller/FrontController.php | 2 +- controllers/front/ContactController.php | 6 +- ...roller.php => OurPropertiesController.php} | 37 ++- install/data/xml/meta.xml | 4 +- install/langs/bg/data/meta.xml | 4 +- install/langs/bn/data/meta.xml | 6 +- install/langs/br/data/meta.xml | 6 +- install/langs/cs/data/meta.xml | 4 +- install/langs/de/data/meta.xml | 4 +- install/langs/en/data/meta.xml | 4 +- install/langs/es/data/meta.xml | 4 +- install/langs/fa/data/meta.xml | 4 +- install/langs/fr/data/meta.xml | 4 +- install/langs/he/data/meta.xml | 4 +- install/langs/hr/data/meta.xml | 6 +- install/langs/hu/data/meta.xml | 6 +- install/langs/id/data/meta.xml | 4 +- install/langs/it/data/meta.xml | 4 +- install/langs/lt/data/meta.xml | 6 +- install/langs/mk/data/meta.xml | 6 +- install/langs/no/data/meta.xml | 6 +- install/langs/pl/data/meta.xml | 4 +- install/langs/pt/data/meta.xml | 4 +- install/langs/ro/data/meta.xml | 4 +- install/langs/ru/data/meta.xml | 4 +- install/langs/si/data/meta.xml | 6 +- install/langs/sr/data/meta.xml | 6 +- install/langs/sv/data/meta.xml | 6 +- install/langs/tw/data/meta.xml | 4 +- install/langs/vn/data/meta.xml | 6 +- install/langs/zh/data/meta.xml | 6 +- .../classes/WkCustomNavigationLink.php | 130 ++++---- modules/blockuserinfo/nav.tpl | 5 - .../classes/HotelHelper.php | 2 +- .../AdminHotelGeneralSettingsController.php | 262 ++++++++-------- .../hotelreservationsystem.php | 2 +- .../views/js/HotelReservationAdmin.js | 8 +- .../hotel_general_settings/helpers/index.php | 33 ++ .../helpers/options/index.php | 32 ++ .../helpers/options/options.tpl | 60 ++++ .../admin/hotel_general_settings/index.php | 33 ++ .../hotel-reservation-theme/contact-form.tpl | 2 +- .../css/contact-form.css | 6 - themes/hotel-reservation-theme/css/global.css | 7 +- .../modules/blockuserinfo/blockuserinfo.css | 5 - .../css/our-properties.css | 149 +++++++++ .../css/properties.css | 286 ------------------ themes/hotel-reservation-theme/header.tpl | 158 +--------- .../js/{properties.js => our-properties.js} | 7 +- .../modules/blockuserinfo/nav.tpl | 5 - .../{properties.tpl => our-properties.tpl} | 16 +- 51 files changed, 622 insertions(+), 767 deletions(-) rename controllers/front/{PropertiesController.php => OurPropertiesController.php} (82%) create mode 100644 modules/hotelreservationsystem/views/templates/admin/hotel_general_settings/helpers/index.php create mode 100644 modules/hotelreservationsystem/views/templates/admin/hotel_general_settings/helpers/options/index.php create mode 100644 modules/hotelreservationsystem/views/templates/admin/hotel_general_settings/helpers/options/options.tpl create mode 100644 modules/hotelreservationsystem/views/templates/admin/hotel_general_settings/index.php create mode 100644 themes/hotel-reservation-theme/css/our-properties.css delete mode 100644 themes/hotel-reservation-theme/css/properties.css rename themes/hotel-reservation-theme/js/{properties.js => our-properties.js} (93%) rename themes/hotel-reservation-theme/{properties.tpl => our-properties.tpl} (86%) diff --git a/classes/controller/FrontController.php b/classes/controller/FrontController.php index bda5ecd12..6c261e009 100644 --- a/classes/controller/FrontController.php +++ b/classes/controller/FrontController.php @@ -1192,7 +1192,7 @@ class FrontControllerCore extends Controller 'token' => Tools::getToken(), 'priceDisplayPrecision' => _PS_PRICE_DISPLAY_PRECISION_, 'content_only' => (int)Tools::getValue('content_only'), - 'WK_DISPLAY_OUR_HOTEL_TAB_IN_HEADER' => Configuration::get('WK_DISPLAY_OUR_HOTEL_TAB_IN_HEADER'), + 'WK_DISPLAY_PROPERTIES_LINK_IN_HEADER' => Configuration::get('WK_DISPLAY_PROPERTIES_LINK_IN_HEADER'), )); $this->context->smarty->assign($this->initLogoAndFavicon()); diff --git a/controllers/front/ContactController.php b/controllers/front/ContactController.php index ace49d894..731780e78 100644 --- a/controllers/front/ContactController.php +++ b/controllers/front/ContactController.php @@ -286,7 +286,7 @@ class ContactControllerCore extends FrontController $shopAddress = ''; $shopAddress_obj = $objShop->getAddress(); if (isset($shopAddress_obj) && $shopAddress_obj instanceof Address) { - $shopAddress = AddressFormat::generateAddress($shopAddress_obj, array(), ' - ', ' '); + $shopAddress = AddressFormat::generateAddress($shopAddress_obj, array(), ', ', ' '); } $gblHtlAddress = $shopAddress; @@ -317,12 +317,12 @@ class ContactControllerCore extends FrontController $contactKey = md5(uniqid(microtime(), true)); $this->context->cookie->__set('contactFormKey', $contactKey); - $displayHotelMap = Configuration::get('WK_CONTACT_DISPLAY_HOTEL_MAP'); + $displayHotelMap = Configuration::get('WK_DISPLAY_CONTACT_PAGE_GOOLGE_MAP'); $this->context->smarty->assign( array( 'hotelsInfo' => $hotelsInfo, 'viewOnMap' => Configuration::get('WK_GOOGLE_ACTIVE_MAP'), - 'displayHotels' => Configuration::get('WK_CONTACT_DISPLAY_HOTEL_LIST'), + 'displayHotels' => Configuration::get('WK_DISPLAY_CONTACT_PAGE_HOTEL_LIST'), 'gblHtlPhone' => $gblHtlPhone, 'gblHtlEmail' => $gblHtlEmail, 'displayHotelMap' => $displayHotelMap, diff --git a/controllers/front/PropertiesController.php b/controllers/front/OurPropertiesController.php similarity index 82% rename from controllers/front/PropertiesController.php rename to controllers/front/OurPropertiesController.php index 6736c9ac7..cb651ba1b 100644 --- a/controllers/front/PropertiesController.php +++ b/controllers/front/OurPropertiesController.php @@ -21,9 +21,9 @@ * @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0 */ -class PropertiesControllerCore extends FrontController +class OurPropertiesControllerCore extends FrontController { - public $php_self = 'properties'; + public $php_self = 'our-properties'; /** * Assign template vars related to page content @@ -38,29 +38,28 @@ class PropertiesControllerCore extends FrontController $hotelsInfo = array(); $hotelLocationArray = 0; $pageLimit = 0; - $displayHotelMap = Configuration::get('WK_PROPERTIES_DISPLAY_HOTEL_MAP'); + $displayHotelMap = Configuration::get('WK_DISPLAY_PROPERTIES_PAGE_GOOGLE_MAP'); if (Module::isInstalled('hotelreservationsystem') && Module::isEnabled('hotelreservationsystem')) { $objModule = Module::getInstanceByName('hotelreservationsystem'); $objHotelInfo = new HotelBranchInformation(); if ($hotelsInfo = $objHotelInfo->hotelBranchesInfo(false, 1, 1)) { - foreach ($hotelsInfo as &$hotel) { + $hotelIconDefault = $this->context->link->getMediaLink($objModule->getPathUri().'views/img/Slices/hotel-default-icon.png'); + foreach ($hotelsInfo as $hotelKey => $hotel) { if (isset($hotel['id_cover_img']) && $hotel['id_cover_img'] - && Validate::isLoadedObject( - $objHotelImage = new HotelImage($hotel['id_cover_img']) - ) + && Validate::isLoadedObject($objHotelImage = new HotelImage($hotel['id_cover_img'])) ) { $htlImgLink = $this->context->link->getMediaLink($objHotelImage->getImageLink($hotel['id_cover_img'], ImageType::getFormatedName('medium'))); if ((bool)Tools::file_get_contents($htlImgLink)) { - $hotel['image_url'] = $htlImgLink; + $hotelsInfo[$hotelKey]['image_url'] = $htlImgLink; } else { - $hotel['image_url'] = $this->context->link->getMediaLink($objModule->getPathUri().'views/img/Slices/hotel-default-icon.png'); + $hotelsInfo[$hotelKey]['image_url'] = $hotelIconDefault; } } else { - $hotel['image_url'] = $this->context->link->getMediaLink($objModule->getPathUri().'views/img/Slices/hotel-default-icon.png'); + $hotelsInfo[$hotelKey]['image_url'] = $hotelIconDefault; } - $hotel['view_rooms_link'] = $this->context->link->getCategoryLink( + $hotelsInfo[$hotelKey]['view_rooms_link'] = $this->context->link->getCategoryLink( new Category($hotel['id_category'], $this->context->language->id), null, $this->context->language->id @@ -69,10 +68,9 @@ class PropertiesControllerCore extends FrontController // To store max number pages. $pageLimit = ceil(count($hotelsInfo)/10); - - if (!($page = Tools::getValue('pagination'))) { - $page = 1; - } else if (!$pageLimit || ($page > $pageLimit)) { + if (!($page = Tools::getValue('pagination')) + || (!$pageLimit || ($page > $pageLimit)) + ) { $page = 1; } @@ -133,18 +131,18 @@ class PropertiesControllerCore extends FrontController 'viewOnMap' => Configuration::get('WK_GOOGLE_ACTIVE_MAP'), 'displayHotelMap' => $displayHotelMap, 'WK_HTL_SHORT_DESC' => Configuration::get('WK_HTL_SHORT_DESC', $this->context->language->id), - 'currentIndex' => $this->context->link->getPageLink('properties') + 'currentIndex' => $this->context->link->getPageLink('our-properties') ) ); - $this->setTemplate(_PS_THEME_DIR_.'properties.tpl'); + $this->setTemplate(_PS_THEME_DIR_.'our-properties.tpl'); } public function setMedia() { parent::setMedia(); - $this->addJS(_THEME_JS_DIR_.'properties.js'); - $this->addCSS(_THEME_CSS_DIR_.'properties.css'); + $this->addJS(_THEME_JS_DIR_.'our-properties.js'); + $this->addCSS(_THEME_CSS_DIR_.'our-properties.css'); // GOOGLE MAP if (($PS_API_KEY = Configuration::get('PS_API_KEY')) && Configuration::get('WK_GOOGLE_ACTIVE_MAP')) { Media::addJsDef( @@ -152,6 +150,7 @@ class PropertiesControllerCore extends FrontController 'PS_STORES_ICON' => $this->context->link->getMediaLink(_PS_IMG_.Configuration::get('PS_STORES_ICON')), ) ); + $this->addJS( 'https://maps.googleapis.com/maps/api/js?key='.$PS_API_KEY. '&libraries=places&language='.$this->context->language->iso_code.'®ion='.$this->context->country->iso_code diff --git a/install/data/xml/meta.xml b/install/data/xml/meta.xml index baf678639..4c9a0b225 100644 --- a/install/data/xml/meta.xml +++ b/install/data/xml/meta.xml @@ -148,8 +148,8 @@ products-comparison 1 - - properties + + our-properties 1 diff --git a/install/langs/bg/data/meta.xml b/install/langs/bg/data/meta.xml index 75cac4ceb..2cb836a57 100644 --- a/install/langs/bg/data/meta.xml +++ b/install/langs/bg/data/meta.xml @@ -120,11 +120,11 @@ order-follow - + Our Properties - properties + our-properties Credit slip diff --git a/install/langs/bn/data/meta.xml b/install/langs/bn/data/meta.xml index fcab2be9b..57422b652 100644 --- a/install/langs/bn/data/meta.xml +++ b/install/langs/bn/data/meta.xml @@ -126,11 +126,11 @@ order-slip - - আমাদের সম্পত্তি + + আমাদের সম্পত্তিসমূহ - properties + our-properties অর্ডার diff --git a/install/langs/br/data/meta.xml b/install/langs/br/data/meta.xml index c4a4e3040..064e8ab57 100644 --- a/install/langs/br/data/meta.xml +++ b/install/langs/br/data/meta.xml @@ -120,11 +120,11 @@ acompanhar-meu-pedido - - Hon tiez + + Nossas propriedades - properties + our-properties Nota do pedido diff --git a/install/langs/cs/data/meta.xml b/install/langs/cs/data/meta.xml index af7021abc..c566a1a06 100644 --- a/install/langs/cs/data/meta.xml +++ b/install/langs/cs/data/meta.xml @@ -120,11 +120,11 @@ order-follow - + Naše nemovitosti - properties + our-properties Dobropis diff --git a/install/langs/de/data/meta.xml b/install/langs/de/data/meta.xml index 122c98d9f..f79a747c2 100644 --- a/install/langs/de/data/meta.xml +++ b/install/langs/de/data/meta.xml @@ -120,11 +120,11 @@ bestellungsverfolgung - + Unsere Immobilien - properties + our-properties Bestellschein diff --git a/install/langs/en/data/meta.xml b/install/langs/en/data/meta.xml index 6ef63e6ce..531c61efb 100644 --- a/install/langs/en/data/meta.xml +++ b/install/langs/en/data/meta.xml @@ -120,11 +120,11 @@ order-follow - + Our Properties - properties + our-properties Credit slip diff --git a/install/langs/es/data/meta.xml b/install/langs/es/data/meta.xml index aff9d5fd1..ba7665bca 100644 --- a/install/langs/es/data/meta.xml +++ b/install/langs/es/data/meta.xml @@ -120,11 +120,11 @@ seguimiento-pedido - + Nuestras propiedades - properties + our-properties Albarán diff --git a/install/langs/fa/data/meta.xml b/install/langs/fa/data/meta.xml index 61169ac9e..6cccce71b 100644 --- a/install/langs/fa/data/meta.xml +++ b/install/langs/fa/data/meta.xml @@ -120,11 +120,11 @@ order-follow - + املاک ما - properties + our-properties رسید سفارش diff --git a/install/langs/fr/data/meta.xml b/install/langs/fr/data/meta.xml index 7fa6887f3..5939be426 100644 --- a/install/langs/fr/data/meta.xml +++ b/install/langs/fr/data/meta.xml @@ -120,11 +120,11 @@ suivi-commande - + Nos propriétés - properties + our-properties Avoirs diff --git a/install/langs/he/data/meta.xml b/install/langs/he/data/meta.xml index 2f8901f8b..758bcf4fb 100644 --- a/install/langs/he/data/meta.xml +++ b/install/langs/he/data/meta.xml @@ -120,11 +120,11 @@ מעקב-הזמנות - + הנכסים שלנו - properties + our-properties שוברי הזמנה diff --git a/install/langs/hr/data/meta.xml b/install/langs/hr/data/meta.xml index b30583cc6..7057dfacb 100644 --- a/install/langs/hr/data/meta.xml +++ b/install/langs/hr/data/meta.xml @@ -120,11 +120,11 @@ order-follow - - Our hotels + + Our Properties - properties + our-properties Credit slip diff --git a/install/langs/hu/data/meta.xml b/install/langs/hu/data/meta.xml index 645914dfb..8d36562c3 100644 --- a/install/langs/hu/data/meta.xml +++ b/install/langs/hu/data/meta.xml @@ -126,11 +126,11 @@ order-slip - - Our hotels + + Our Properties - properties + our-properties Order diff --git a/install/langs/id/data/meta.xml b/install/langs/id/data/meta.xml index eb35396ec..77819f8cd 100644 --- a/install/langs/id/data/meta.xml +++ b/install/langs/id/data/meta.xml @@ -120,11 +120,11 @@ pantau-order - + Properti kami - properties + our-properties Slip order diff --git a/install/langs/it/data/meta.xml b/install/langs/it/data/meta.xml index 015e87498..22485f8c0 100644 --- a/install/langs/it/data/meta.xml +++ b/install/langs/it/data/meta.xml @@ -126,11 +126,11 @@ buono-ordine - + Le nostre proprietà - properties + our-properties Ordine diff --git a/install/langs/lt/data/meta.xml b/install/langs/lt/data/meta.xml index a540934af..3a18628ef 100644 --- a/install/langs/lt/data/meta.xml +++ b/install/langs/lt/data/meta.xml @@ -120,11 +120,11 @@ order-follow - - Our hotels + + Our Properties - properties + our-properties Credit slip diff --git a/install/langs/mk/data/meta.xml b/install/langs/mk/data/meta.xml index 1ed8250c1..541576642 100644 --- a/install/langs/mk/data/meta.xml +++ b/install/langs/mk/data/meta.xml @@ -120,11 +120,11 @@ order-follow - - Our hotels + + Our Properties - properties + our-properties Order slip diff --git a/install/langs/no/data/meta.xml b/install/langs/no/data/meta.xml index 520a9144c..9fb17959f 100644 --- a/install/langs/no/data/meta.xml +++ b/install/langs/no/data/meta.xml @@ -120,11 +120,11 @@ order-follow - - Our hotels + + Our Properties - properties + our-properties Order slip diff --git a/install/langs/pl/data/meta.xml b/install/langs/pl/data/meta.xml index 69ccaf61d..0934c53e1 100644 --- a/install/langs/pl/data/meta.xml +++ b/install/langs/pl/data/meta.xml @@ -120,11 +120,11 @@ sledzenie-zamowienia - + Nasze nieruchomości - properties + our-properties Pokwitowania diff --git a/install/langs/pt/data/meta.xml b/install/langs/pt/data/meta.xml index 7df1881fe..25504b1e0 100644 --- a/install/langs/pt/data/meta.xml +++ b/install/langs/pt/data/meta.xml @@ -120,11 +120,11 @@ acompanhar-encomenda - + Nossas propriedades - properties + our-properties Nota de Encomenda diff --git a/install/langs/ro/data/meta.xml b/install/langs/ro/data/meta.xml index 2f7d3e2c8..1183e23ba 100644 --- a/install/langs/ro/data/meta.xml +++ b/install/langs/ro/data/meta.xml @@ -120,11 +120,11 @@ returnari - + Proprietățile noastre - properties + our-properties Bon de comandă diff --git a/install/langs/ru/data/meta.xml b/install/langs/ru/data/meta.xml index 9bc9533da..f32b4d38c 100644 --- a/install/langs/ru/data/meta.xml +++ b/install/langs/ru/data/meta.xml @@ -120,11 +120,11 @@ order-follow - + Наши объекты - properties + our-properties Бланк заказа diff --git a/install/langs/si/data/meta.xml b/install/langs/si/data/meta.xml index bd7005158..33e1e78b2 100644 --- a/install/langs/si/data/meta.xml +++ b/install/langs/si/data/meta.xml @@ -120,11 +120,11 @@ order-follow - - Our hotels + + Our Properties - properties + our-properties Credit slip diff --git a/install/langs/sr/data/meta.xml b/install/langs/sr/data/meta.xml index 9b5583bfc..1c68f04c5 100644 --- a/install/langs/sr/data/meta.xml +++ b/install/langs/sr/data/meta.xml @@ -114,11 +114,11 @@ my-account - - Our hotels + + Our Properties - properties + our-properties Order follow diff --git a/install/langs/sv/data/meta.xml b/install/langs/sv/data/meta.xml index 335207a91..0c8036887 100644 --- a/install/langs/sv/data/meta.xml +++ b/install/langs/sv/data/meta.xml @@ -120,11 +120,11 @@ order-follow - - Our hotels + + Our Properties - properties + our-properties Credit slip diff --git a/install/langs/tw/data/meta.xml b/install/langs/tw/data/meta.xml index 6399d418a..c1a2ca7ed 100644 --- a/install/langs/tw/data/meta.xml +++ b/install/langs/tw/data/meta.xml @@ -120,11 +120,11 @@ order-follow - + 我們的物業 - properties + our-properties 訂購單 diff --git a/install/langs/vn/data/meta.xml b/install/langs/vn/data/meta.xml index 485fbd516..69a0bba3d 100644 --- a/install/langs/vn/data/meta.xml +++ b/install/langs/vn/data/meta.xml @@ -120,11 +120,11 @@ order-follow - - Tài sản của chúng tôi + + Các bất động sản của chúng tôi - properties + our-properties Phiếu tín dụng diff --git a/install/langs/zh/data/meta.xml b/install/langs/zh/data/meta.xml index 4b15cc6a6..9fb5a12ce 100644 --- a/install/langs/zh/data/meta.xml +++ b/install/langs/zh/data/meta.xml @@ -120,11 +120,11 @@ order-follow - - Our hotels + + Our Properties - properties + our-properties Order slip diff --git a/modules/blocknavigationmenu/classes/WkCustomNavigationLink.php b/modules/blocknavigationmenu/classes/WkCustomNavigationLink.php index 5346c4320..5911514a4 100644 --- a/modules/blocknavigationmenu/classes/WkCustomNavigationLink.php +++ b/modules/blocknavigationmenu/classes/WkCustomNavigationLink.php @@ -149,37 +149,6 @@ class WkCustomNavigationLink extends ObjectModel public function insertDemoData($populateData = null) { - //insert home link to the list - $languages = Language::getLanguages(false); - $objCustomNavigationLink = new WkCustomNavigationLink(); - foreach ($languages as $language) { - $objCustomNavigationLink->name[$language['id_lang']] = 'Home'; - } - $objCustomNavigationLink->position = $this->getHigherPosition(); - $objCustomNavigationLink->id_cms = 0; - $objCustomNavigationLink->show_at_navigation = 1; - $objCustomNavigationLink->show_at_footer = 0; - $objCustomNavigationLink->active = 1; - $objCustomNavigationLink->is_custom_link = 0; - $objCustomNavigationLink->link = 'index'; - $objCustomNavigationLink->save(); - - $objCustomNavigationLink = new WkCustomNavigationLink(); - foreach ($languages as $language) { - $objCustomNavigationLink->name[$language['id_lang']] = 'Our hotels'; - } - - $https_link = (Tools::usingSecureMode() && Configuration::get('PS_SSL_ENABLED')) ? 'https://' : 'http://'; - $objLink = new Link($https_link, $https_link); - $objCustomNavigationLink->position = $this->getHigherPosition(); - $objCustomNavigationLink->id_cms = 0; - $objCustomNavigationLink->show_at_navigation = 1; - $objCustomNavigationLink->show_at_footer = 0; - $objCustomNavigationLink->active = 1; - $objCustomNavigationLink->link = $objLink->getPageLink('properties'); - $objCustomNavigationLink->is_custom_link = 1; - $objCustomNavigationLink->save(); - // enter modules links $modsElems = array(); // if module is installing or resetting @@ -206,51 +175,86 @@ class WkCustomNavigationLink extends ObjectModel } } + //insert home link to the list + $languages = Language::getLanguages(false); + $https_link = (Tools::usingSecureMode() && Configuration::get('PS_SSL_ENABLED')) ? 'https://' : 'http://'; + $objLink = new Link($https_link, $https_link); + + $navigationLinks = array( + array( + 'name' => 'Home', + 'id_cms' => 0, + 'show_at_navigation' => 1, + 'show_at_footer' => 0, + 'is_custom_link' => 0, + 'link' => 'index', + ), + array( + 'name' => 'Our Properties', + 'id_cms' => 0, + 'show_at_navigation' => 1, + 'show_at_footer' => 0, + 'is_custom_link' => 1, + 'link' => $objLink->getPageLink('our-properties'), + ), + ); + if ($modsElems) { $indexLink = Context::getContext()->shop->getBaseURI(); foreach ($modsElems as $name => $modElm) { - $objCustomNavigationLink = new WkCustomNavigationLink(); - foreach ($languages as $language) { - $objCustomNavigationLink->name[$language['id_lang']] = $name; - } - $objCustomNavigationLink->position = $this->getHigherPosition(); - $objCustomNavigationLink->id_cms = 0; - $objCustomNavigationLink->show_at_navigation = 1; - $objCustomNavigationLink->show_at_footer = 0; - $objCustomNavigationLink->active = 1; - $objCustomNavigationLink->link = $indexLink.'#'.$modElm; - $objCustomNavigationLink->is_custom_link = 1; - $objCustomNavigationLink->save(); + $navigationLinks[] = array( + 'name' => $name, + 'id_cms' => 0, + 'show_at_navigation' => 1, + 'show_at_footer' => 0, + 'is_custom_link' => 1, + 'link' => $indexLink.'#'.$modElm + ); } } + // enter CMS pages data if ($cmsPagesCMS = CMS::getCMSPages(Configuration::get('PS_LANG_DEFAULT'), 1)) { $showAtNavigation = 0; foreach ($cmsPagesCMS as $cmsPage) { - $objCustomNavigationLink = new WkCustomNavigationLink(); - $objCustomNavigationLink->position = $this->getHigherPosition(); - $objCustomNavigationLink->id_cms = $cmsPage['id_cms']; - $objCustomNavigationLink->show_at_navigation = $showAtNavigation; - $objCustomNavigationLink->show_at_footer = 1; - $objCustomNavigationLink->active = 1; - $objCustomNavigationLink->is_custom_link = 0; - $objCustomNavigationLink->save(); + $navigationLinks[] = array( + 'id_cms' => $cmsPage['id_cms'], + 'show_at_navigation' => $showAtNavigation, + 'show_at_footer' => 1, + 'is_custom_link' => 0, + ); $showAtNavigation = !$showAtNavigation; } } - //insert contact link to the list - $objCustomNavigationLink = new WkCustomNavigationLink(); - foreach ($languages as $language) { - $objCustomNavigationLink->name[$language['id_lang']] = 'Contact Us'; + + $navigationLinks[] = array( + 'name' => 'Contact Us', + 'id_cms' => 0, + 'show_at_navigation' => 1, + 'show_at_footer' => 0, + 'is_custom_link' => 0, + 'link' => 'contact', + ); + foreach ($navigationLinks as $navigationLink) { + $objCustomNavigationLink = new WkCustomNavigationLink(); + if (isset($navigationLink['name'])) { + foreach ($languages as $language) { + $objCustomNavigationLink->name[$language['id_lang']] = $navigationLink['name']; + } + } + + $objCustomNavigationLink->position = $this->getHigherPosition(); + $objCustomNavigationLink->id_cms = $navigationLink['id_cms']; + $objCustomNavigationLink->show_at_navigation = $navigationLink['show_at_navigation']; + $objCustomNavigationLink->show_at_footer = $navigationLink['show_at_footer']; + $objCustomNavigationLink->active = 1; + if (isset($navigationLink['link'])) { + $objCustomNavigationLink->link = $navigationLink['link']; + } + + $objCustomNavigationLink->is_custom_link = $navigationLink['is_custom_link']; + $objCustomNavigationLink->save(); } - $objCustomNavigationLink->position = $this->getHigherPosition(); - $objCustomNavigationLink->id_cms = 0; - $objCustomNavigationLink->show_at_navigation = 1; - $objCustomNavigationLink->show_at_footer = 0; - $objCustomNavigationLink->active = 1; - $objCustomNavigationLink->is_custom_link = 0; - $objCustomNavigationLink->link = 'contact'; - $objCustomNavigationLink->save(); return true; } diff --git a/modules/blockuserinfo/nav.tpl b/modules/blockuserinfo/nav.tpl index ffd9f239d..8b124e6f5 100644 --- a/modules/blockuserinfo/nav.tpl +++ b/modules/blockuserinfo/nav.tpl @@ -48,11 +48,6 @@ {/if} {if !isset($ajaxCustomerLogin)}
- {if isset($WK_DISPLAY_OUR_HOTEL_TAB_IN_HEADER) && $WK_DISPLAY_OUR_HOTEL_TAB_IN_HEADER} - - {/if} {/if} {/block} diff --git a/modules/hotelreservationsystem/classes/HotelHelper.php b/modules/hotelreservationsystem/classes/HotelHelper.php index 168477269..05d066e7e 100644 --- a/modules/hotelreservationsystem/classes/HotelHelper.php +++ b/modules/hotelreservationsystem/classes/HotelHelper.php @@ -1050,7 +1050,7 @@ class HotelHelper Configuration::updateValue('WK_CUSTOMER_SUPPORT_PHONE_NUMBER', '0987654321'); Configuration::updateValue('WK_CUSTOMER_SUPPORT_EMAIL', 'hotelprime@htl.com'); - Configuration::updateValue('WK_CONTACT_DISPLAY_HOTEL_LIST', 0); + Configuration::updateValue('WK_DISPLAY_CONTACT_PAGE_HOTEL_LIST', 0); Configuration::updateValue('WK_TITLE_HEADER_BLOCK', $home_banner_default_title); Configuration::updateValue('WK_CONTENT_HEADER_BLOCK', $home_banner_default_content); diff --git a/modules/hotelreservationsystem/controllers/admin/AdminHotelGeneralSettingsController.php b/modules/hotelreservationsystem/controllers/admin/AdminHotelGeneralSettingsController.php index c4018fe58..ca6e55912 100644 --- a/modules/hotelreservationsystem/controllers/admin/AdminHotelGeneralSettingsController.php +++ b/modules/hotelreservationsystem/controllers/admin/AdminHotelGeneralSettingsController.php @@ -40,6 +40,17 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController } $hotelNameDisable = (count($hotelsInfo) > 1 ? true : false); $locationDisable = ((count($hotelsInfo) < 2) && !Configuration::get('WK_HOTEL_NAME_ENABLE')) ? true : false; + + $countryList = array(); + $countryList[] = array('id' => '0', 'name' => $this->l('Choose your country')); + foreach (Country::getCountries($this->context->language->id) as $country) { + $countryList[] = array('id' => $country['id_country'], 'name' => $country['name']); + } + $stateList = array(); + $stateList[] = array('id' => '0', 'name' => $this->l('Choose your state (if applicable)')); + foreach (State::getStates($this->context->language->id) as $state) { + $stateList[] = array('id' => $state['id_state'], 'name' => $state['name']); + } $this->fields_options = array( 'hotelsearchpanel' => array( 'icon' => 'icon-search', @@ -147,23 +158,6 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController 'identifier' => 'id', 'list' => $hotelsInfo, ), - 'WK_DISPLAY_OUR_HOTEL_TAB_IN_HEADER' => array( - 'title' => $this->l('Display "Our Hotels" tab in menu'), - 'cast' => 'intval', - 'type' => 'bool', - 'default' => '0', - 'values' => array( - array( - 'id' => 'active_on', - 'value' => 1, - ), - array( - 'id' => 'active_off', - 'value' => 0, - ), - ), - 'hint' => $this->l('Display "Our Hotels" tab in menu in top in the front office'), - ), 'WK_HTL_ESTABLISHMENT_YEAR' => array( 'title' => $this->l('Website Launch Year'), 'hint' => $this->l('The year when your hotel site was launched.'), @@ -178,6 +172,40 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController 'name' => 'WK_HOTEL_HEADER_IMAGE', 'url' => _PS_IMG_, ), + 'WK_DISPLAY_PROPERTIES_LINK_IN_HEADER' => array( + 'title' => $this->l('Display Our Properties link in Header'), + 'cast' => 'intval', + 'type' => 'bool', + 'default' => '0', + 'values' => array( + array( + 'id' => 'active_on', + 'value' => 1, + ), + array( + 'id' => 'active_off', + 'value' => 0, + ), + ), + 'hint' => $this->l('Display Our Properties link in header in the front office'), + ), + 'WK_DISPLAY_CONTACT_PAGE_HOTEL_LIST' => array( + 'title' => $this->l('Display Contact Page Hotel List'), + 'cast' => 'intval', + 'type' => 'bool', + 'default' => '0', + 'values' => array( + array( + 'id' => 'active_on', + 'value' => 1, + ), + array( + 'id' => 'active_off', + 'value' => 0, + ), + ), + 'hint' => $this->l('Enable to display hotels list on the contact us page.'), + ), ), 'submit' => array('title' => $this->l('Save')), ), @@ -197,23 +225,6 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController 'hint' => $this->l('The email used for customer service. It will be shown on navigation bar.'), 'class' => 'fixed-width-xxl', ), - 'WK_CONTACT_DISPLAY_HOTEL_LIST' => array( - 'title' => $this->l('Display Hotels On Contact Page'), - 'cast' => 'intval', - 'type' => 'bool', - 'default' => '0', - 'values' => array( - array( - 'id' => 'active_on', - 'value' => 1, - ), - array( - 'id' => 'active_off', - 'value' => 0, - ), - ), - 'hint' => $this->l('Enable to display hotels list on the contact us page.'), - ), ), 'submit' => array( 'title' => $this->l('Save'), @@ -222,7 +233,83 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController 'websitedetail' => array( 'title' => $this->l('Website Contact Details'), 'icon' => 'icon-user', - 'fields' => $this->_getDefaultFieldsContent(), + 'fields' => array( + 'PS_SHOP_NAME' => array( + 'title' => $this->l('Website name'), + 'hint' => $this->l('Displayed in emails and page titles.'), + 'validation' => 'isGenericName', + 'required' => true, + 'type' => 'text', + 'no_escape' => true, + ), + 'PS_SHOP_EMAIL' => array( + 'title' => $this->l('Website email'), + 'hint' => $this->l('Displayed in emails sent to customers and on Contact Us page.'), + 'validation' => 'isEmail', + 'required' => true, + 'type' => 'text' + ), + 'PS_SHOP_PHONE' => array( + 'title' => $this->l('Phone'), + 'validation' => 'isGenericName', + 'required' => true, + 'type' => 'text', + 'hint' => $this->l('The phone number of the main branch.'), + ), + 'PS_SHOP_ADDR1' => array( + 'title' => $this->l('Address line 1'), + 'validation' => 'isAddress', + 'type' => 'text', + 'hint' => $this->l('The address of the main branch.'), + 'isCleanHtml' => true, + 'required' => true, + ), + 'PS_SHOP_ADDR2' => array( + 'title' => $this->l('Address line 2'), + 'validation' => 'isAddress', + 'type' => 'text' + ), + 'PS_SHOP_CODE' => array( + 'title' => $this->l('Zip/postal code'), + 'validation' => 'isGenericName', + 'type' => 'text' + ), + 'PS_SHOP_CITY' => array( + 'title' => $this->l('City'), + 'validation' => 'isGenericName', + 'type' => 'text' + ), + 'PS_SHOP_COUNTRY_ID' => array( + 'title' => $this->l('Country'), + 'validation' => 'isInt', + 'type' => 'select', + 'list' => $countryList, + 'identifier' => 'id', + 'cast' => 'intval', + 'defaultValue' => (int)$this->context->country->id + ), + 'PS_SHOP_STATE_ID' => array( + 'title' => $this->l('State'), + 'validation' => 'isInt', + 'type' => 'select', + 'list' => $stateList, + 'identifier' => 'id', + 'cast' => 'intval' + ), + 'PS_SHOP_DETAILS' => array( + 'title' => $this->l('Registration number'), + 'hint' => $this->l('Website registration information (e.g. SIRET or RCS).'), + 'validation' => 'isGenericName', + 'type' => 'textarea', + 'cols' => 30, + 'rows' => 5 + ), + 'PS_SHOP_FAX' => array( + 'title' => $this->l('Fax'), + 'validation' => 'isGenericName', + 'type' => 'text' + ), + ), 'submit' => array( 'title' => $this->l('Save'), ), @@ -344,8 +431,8 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController ), 'hint' => $this->l('If yes, only active hotels will be displayed on map.'), ), - 'WK_PROPERTIES_DISPLAY_HOTEL_MAP' => array( - 'title' => $this->l('Display Hotels Map On Properties Page'), + 'WK_DISPLAY_PROPERTIES_PAGE_GOOGLE_MAP' => array( + 'title' => $this->l('Display Our Properties page Google map'), 'cast' => 'intval', 'type' => 'bool', 'default' => '0', @@ -359,10 +446,10 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController 'value' => 0, ), ), - 'hint' => $this->l('Enable to display map with hotels locations on the properties page.'), + 'hint' => $this->l('Enable to display map with hotels locations on the our properties page.'), ), - 'WK_CONTACT_DISPLAY_HOTEL_MAP' => array( - 'title' => $this->l('Display Hotels Map On Contact Page'), + 'WK_DISPLAY_CONTACT_PAGE_GOOLGE_MAP' => array( + 'title' => $this->l('Display Contact Us page Google map'), 'cast' => 'intval', 'type' => 'bool', 'default' => '0', @@ -387,101 +474,6 @@ class AdminHotelGeneralSettingsController extends ModuleAdminController } - protected function _getDefaultFieldsContent() - { - $this->context = Context::getContext(); - $countryList = array(); - $countryList[] = array('id' => '0', 'name' => $this->l('Choose your country')); - foreach (Country::getCountries($this->context->language->id) as $country) { - $countryList[] = array('id' => $country['id_country'], 'name' => $country['name']); - } - $stateList = array(); - $stateList[] = array('id' => '0', 'name' => $this->l('Choose your state (if applicable)')); - foreach (State::getStates($this->context->language->id) as $state) { - $stateList[] = array('id' => $state['id_state'], 'name' => $state['name']); - } - - $formFields = array( - 'PS_SHOP_NAME' => array( - 'title' => $this->l('Website name'), - 'hint' => $this->l('Displayed in emails and page titles.'), - 'validation' => 'isGenericName', - 'required' => true, - 'type' => 'text', - 'no_escape' => true, - ), - 'PS_SHOP_EMAIL' => array( - 'title' => $this->l('Website email'), - 'hint' => $this->l('Displayed in emails sent to customers and on Contact Us page.'), - 'validation' => 'isEmail', - 'required' => true, - 'type' => 'text' - ), - 'PS_SHOP_PHONE' => array( - 'title' => $this->l('Phone'), - 'validation' => 'isGenericName', - 'required' => true, - 'type' => 'text', - 'hint' => $this->l('The phone number of the main branch.'), - ), - 'PS_SHOP_ADDR1' => array( - 'title' => $this->l('Address line 1'), - 'validation' => 'isAddress', - 'type' => 'text', - 'hint' => $this->l('The address of the main branch.'), - 'isCleanHtml' => true, - 'required' => true, - ), - 'PS_SHOP_ADDR2' => array( - 'title' => $this->l('Address line 2'), - 'validation' => 'isAddress', - 'type' => 'text' - ), - 'PS_SHOP_CODE' => array( - 'title' => $this->l('Zip/postal code'), - 'validation' => 'isGenericName', - 'type' => 'text' - ), - 'PS_SHOP_CITY' => array( - 'title' => $this->l('City'), - 'validation' => 'isGenericName', - 'type' => 'text' - ), - 'PS_SHOP_COUNTRY_ID' => array( - 'title' => $this->l('Country'), - 'validation' => 'isInt', - 'type' => 'select', - 'list' => $countryList, - 'identifier' => 'id', - 'cast' => 'intval', - 'defaultValue' => (int)$this->context->country->id - ), - 'PS_SHOP_STATE_ID' => array( - 'title' => $this->l('State'), - 'validation' => 'isInt', - 'type' => 'select', - 'list' => $stateList, - 'identifier' => 'id', - 'cast' => 'intval' - ), - 'PS_SHOP_DETAILS' => array( - 'title' => $this->l('Registration number'), - 'hint' => $this->l('Website registration information (e.g. SIRET or RCS).'), - 'validation' => 'isGenericName', - 'type' => 'textarea', - 'cols' => 30, - 'rows' => 5 - ), - 'PS_SHOP_FAX' => array( - 'title' => $this->l('Fax'), - 'validation' => 'isGenericName', - 'type' => 'text' - ), - ); - - return $formFields; - } - public function beforeUpdateOptions() { if (isset($_POST['PS_SHOP_STATE_ID']) && $_POST['PS_SHOP_STATE_ID'] != '0') { diff --git a/modules/hotelreservationsystem/hotelreservationsystem.php b/modules/hotelreservationsystem/hotelreservationsystem.php index 2b56dd0c6..acbfbe7f2 100644 --- a/modules/hotelreservationsystem/hotelreservationsystem.php +++ b/modules/hotelreservationsystem/hotelreservationsystem.php @@ -695,7 +695,7 @@ class HotelReservationSystem extends Module 'WK_HOTEL_NAME_ENABLE', 'WK_CUSTOMER_SUPPORT_PHONE_NUMBER', 'WK_CUSTOMER_SUPPORT_EMAIL', - 'WK_CONTACT_DISPLAY_HOTEL_LIST' + 'WK_DISPLAY_CONTACT_PAGE_HOTEL_LIST' ); foreach ($configKeys as $key) { if (!Configuration::deleteByName($key)) { diff --git a/modules/hotelreservationsystem/views/js/HotelReservationAdmin.js b/modules/hotelreservationsystem/views/js/HotelReservationAdmin.js index 47de743b7..5e4294a1c 100644 --- a/modules/hotelreservationsystem/views/js/HotelReservationAdmin.js +++ b/modules/hotelreservationsystem/views/js/HotelReservationAdmin.js @@ -835,12 +835,12 @@ function toggleGoogleMapsFields() { if ($('#WK_GOOGLE_ACTIVE_MAP_on').attr('checked') == 'checked') { $('#conf_id_WK_MAP_HOTEL_ACTIVE_ONLY').parent().show(); - $('#conf_id_WK_CONTACT_DISPLAY_HOTEL_MAP').parent().show(); - $('#conf_id_WK_PROPERTIES_DISPLAY_HOTEL_MAP').parent().show(); + $('#conf_id_WK_DISPLAY_CONTACT_PAGE_GOOLGE_MAP').parent().show(); + $('#conf_id_WK_DISPLAY_PROPERTIES_PAGE_GOOGLE_MAP').parent().show(); } else { $('#conf_id_WK_MAP_HOTEL_ACTIVE_ONLY').parent().hide(); - $('#conf_id_WK_CONTACT_DISPLAY_HOTEL_MAP').parent().hide(); - $('#conf_id_WK_PROPERTIES_DISPLAY_HOTEL_MAP').parent().hide(); + $('#conf_id_WK_DISPLAY_CONTACT_PAGE_GOOLGE_MAP').parent().hide(); + $('#conf_id_WK_DISPLAY_PROPERTIES_PAGE_GOOGLE_MAP').parent().hide(); } } diff --git a/modules/hotelreservationsystem/views/templates/admin/hotel_general_settings/helpers/index.php b/modules/hotelreservationsystem/views/templates/admin/hotel_general_settings/helpers/index.php new file mode 100644 index 000000000..dd2519dc2 --- /dev/null +++ b/modules/hotelreservationsystem/views/templates/admin/hotel_general_settings/helpers/index.php @@ -0,0 +1,33 @@ + + function ajaxStoreStates(id_state_selected) { + $.ajax({ + url: "index.php", + cache: false, + data: "ajax=1&tab=AdminStates&token={getAdminToken tab='AdminStates'}&action=states&id_country="+$('#PS_SHOP_COUNTRY_ID').val() + "&id_state=" + $('#PS_SHOP_STATE_ID').val(), + success: function(html) + { + if (html == 'false') { + $("#conf_id_PS_SHOP_STATE_ID").parent().fadeOut(); + $('#PS_SHOP_STATE_ID option[value=0]').attr("selected", "selected"); + } else { + $("#PS_SHOP_STATE_ID").html(html); + $("#conf_id_PS_SHOP_STATE_ID").parent().fadeIn(); + $('#PS_SHOP_STATE_ID option[value=' + id_state_selected + ']').attr("selected", "selected"); + } + } + }); + } + + $(document).ready(function() { + {if isset($categoryData.fields.PS_SHOP_STATE_ID.value)} + if ($('#PS_SHOP_COUNTRY_ID') && $('#PS_SHOP_STATE_ID')) { + ajaxStoreStates({$categoryData.fields.PS_SHOP_STATE_ID.value}); + $('#PS_SHOP_COUNTRY_ID').change(function() { + ajaxStoreStates(); + }); + } + {/if} + }); + + {/if} +{/block} diff --git a/modules/hotelreservationsystem/views/templates/admin/hotel_general_settings/index.php b/modules/hotelreservationsystem/views/templates/admin/hotel_general_settings/index.php new file mode 100644 index 000000000..dd2519dc2 --- /dev/null +++ b/modules/hotelreservationsystem/views/templates/admin/hotel_general_settings/index.php @@ -0,0 +1,33 @@ + +
diff --git a/themes/hotel-reservation-theme/css/contact-form.css b/themes/hotel-reservation-theme/css/contact-form.css index 7e6ee9769..5ffae05e0 100644 --- a/themes/hotel-reservation-theme/css/contact-form.css +++ b/themes/hotel-reservation-theme/css/contact-form.css @@ -274,9 +274,3 @@ outline: none; color: #427fed; } -.margin-bottom-30 { - margin-bottom: 30px; -} -.margin-top-30 { - margin-top: 30px; -} \ No newline at end of file diff --git a/themes/hotel-reservation-theme/css/global.css b/themes/hotel-reservation-theme/css/global.css index cd790b7c6..76406880b 100644 --- a/themes/hotel-reservation-theme/css/global.css +++ b/themes/hotel-reservation-theme/css/global.css @@ -9144,4 +9144,9 @@ a.link { font-weight: 700; color: #0000ff; text-decoration: none; -} \ No newline at end of file +} + +div a.our_properties_link{ + color: #fff; + font-size: 17px; + font-weight: 400;} diff --git a/themes/hotel-reservation-theme/css/modules/blockuserinfo/blockuserinfo.css b/themes/hotel-reservation-theme/css/modules/blockuserinfo/blockuserinfo.css index 979d70364..e97d787ca 100644 --- a/themes/hotel-reservation-theme/css/modules/blockuserinfo/blockuserinfo.css +++ b/themes/hotel-reservation-theme/css/modules/blockuserinfo/blockuserinfo.css @@ -37,11 +37,6 @@ #user_info_acc span.caret { border-top-color: #fff; } -div.our_hotel_tab a{ - color: #fff; - font-size: 17px; - font-weight: 400;} - @media (max-width: 450px) { .hide_xs { display: none; } diff --git a/themes/hotel-reservation-theme/css/our-properties.css b/themes/hotel-reservation-theme/css/our-properties.css new file mode 100644 index 000000000..efc8c340a --- /dev/null +++ b/themes/hotel-reservation-theme/css/our-properties.css @@ -0,0 +1,149 @@ +/** +* NOTICE OF LICENSE +* +* This source file is subject to the Open Software License version 3.0 +* that is bundled with this package in the file LICENSE.md +* It is also available through the world-wide-web at this URL: +* https://opensource.org/license/osl-3-0-php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to support@qloapps.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade this module to a newer +* versions in the future. If you wish to customize this module for your needs +* please refer to https://store.webkul.com/customisation-guidelines for more information. +* +* @author Webkul IN +* @copyright Since 2010 Webkul +* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0 +*/ + +.htl-img { + max-width: 200px;} +.properties-page { + padding: 10px;} +.page-heading { + font-size: 32px;} +.empty-properties-container{ + margin: 30px;} +.our-properties-header { + font-size: 42px; + color: rgba(0, 0, 0, 1); + text-align: center; + font-weight: 300;} +.our-properties-desc { + font-size: 16px; + color: rgba(0, 0, 0, 1); + text-align: center; + font-weight: 300; + line-height: 30px;} +.properties-page .hotels-container { + display: flex; + flex-wrap: wrap; + justify-content: flex-start;} +.hotels-container .hotel-header { + margin-bottom: 40px; + text-align: center;} +.hotels-container .hotel-header>span { + font-size: 30px; + font-weight: 400; + color: rgba(0, 0, 0, 1); + border-bottom: 1px solid rgba(0, 0, 0, 1);} +.properties-page .hotel-address-container { + border-radius: 4px; + box-shadow: 2px 2px 15px 3px rgba(0,0,0,.1); + float: left; + padding: 15px 0px; + width: 100%;} +.hotel-address-container .hotel-name { + font-size: 18px; + font-weight: 400; + color: rgba(0, 0, 0, 1); + margin-bottom: 15px;} +.hotel-address-container span.htl-address-icon { + background-image: url(../../../modules/hotelreservationsystem/views/img/Slices/icon-contact.png);} +.hotel-address-container img.htl-img { + border-radius: 6px;} +.empty-properties-image-container { + background-image: url(../../../modules/hotelreservationsystem/views/img/Slices/no-hotel.png) ; + background-repeat:no-repeat; + background-position: center center; + padding: 200px 0px 10px 0px; + display: block;} +.hotel-address-container span.htl-phone-icon { + background-image: url(../../../modules/hotelreservationsystem/views/img/Slices/icon-contact.png); + padding: 1px 15px 0px 2px; + background-position: 37px; + margin-right: 5px; + font-size: 14px;} +.hotel-address-container span.htl-email-icon { + padding: 1px 10px 1px; + background-position: 19px; + margin-right: 5px;} +span.htl-map-icon { + background-image: url(../../../modules/hotelreservationsystem/views/img/Slices/icon-contact.png); + padding: 1px 20px 0px 0px; + background-position: 0px 0px; + margin-right: 5px; + font-size: 14px;} +.view_rooms_btn, .htl-map-direction-btn { + border-radius: 4px; + padding: 10px 12px; + text-transform: uppercase;} +.htl-map-direction-btn{ + background-color: #DEDEDE; + color: #333333; } +.view_rooms_btn { + background-color: #1292FF; + border-color: #1292FF; + font-weight: 600;} +.view_rooms_btn:hover { + background-color: #3c89cb; + border-color: #3a75a7;} +.pagination-container { + text-align: center;} +.hotel-branch-info-actions{ + display: flex; + gap: 10px;} +.pagination-container .pagination > li > a, .pagination-container .pagination > li > span { + border: unset;} +.pagination-container .pagination > li .active { + border: 1px solid #333333; + border-radius: 12px; + z-index: 10;} +.hotel-address-container p.hotel-branch-info-value { + font-size: 14px; + color: rgba(0, 0, 0, 1); + font-weight: 400; + line-height: 25px;} +.hotel-address-container .htl-map-direction-btn span { + font-size: 12px; + color: rgba(0, 0, 0, 1); + font-weight: 400;} + +@media screen and (max-width: 726px) { + .hotel-branch-info-actions{ + flex-direction: column;} +} + + /* ==== google map ==== */ +#googleMapWrapper { + clear: both; + height: 500px;} +#map { + width: 100%; + height: 100%;} +#map .view-link { + padding-top: 4px;} +.gm-btn-get-directions { + text-decoration: none; + color: #427fed; + font-weight: bold;} +.gm-btn-get-directions:hover { + text-decoration: underline; + color: #427fed;} +.gm-btn-get-directions:focus { + outline: none; + color: #427fed;} diff --git a/themes/hotel-reservation-theme/css/properties.css b/themes/hotel-reservation-theme/css/properties.css deleted file mode 100644 index c96b81421..000000000 --- a/themes/hotel-reservation-theme/css/properties.css +++ /dev/null @@ -1,286 +0,0 @@ -/** -* NOTICE OF LICENSE -* -* This source file is subject to the Open Software License version 3.0 -* that is bundled with this package in the file LICENSE.md -* It is also available through the world-wide-web at this URL: -* https://opensource.org/license/osl-3-0-php -* If you did not receive a copy of the license and are unable to -* obtain it through the world-wide-web, please send an email -* to support@qloapps.com so we can send you a copy immediately. -* -* DISCLAIMER -* -* Do not edit or add to this file if you wish to upgrade this module to a newer -* versions in the future. If you wish to customize this module for your needs -* please refer to https://store.webkul.com/customisation-guidelines for more information. -* -* @author Webkul IN -* @copyright Since 2010 Webkul -* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0 -*/ - -.margin-top-50 { - margin-top: 50px; -} -.margin-bottom-30 { - margin-bottom: 30px; -} -.margin-bottom-20 { - margin-bottom: 20px; -} -.margin-top-20 { - margin-top: 20px; -} -.htl-contact-page { - padding: 10px; -} -.page-heading { - font-size: 32px; -} -.empty-properties-container{ - margin: 30px; -} -.htl-contact-page .contact-header { - font-size: 42px; - color: rgba(0, 0, 0, 1); - text-align: center; - font-weight: 300; - margin-bottom: 20px; -} -.htl-contact-page .contact-desc { - font-size: 16px; - color: rgba(0, 0, 0, 1); - text-align: center; - font-weight: 300; - margin-bottom: 20px; - line-height: 30px; -} -.htl-contact-page .contact-form-box { - padding: 30px; - border-radius: 4px; - box-shadow: 2px 2px 15px 3px rgba(0,0,0,.1); -} -.htl-contact-page .contact-form-box .control-label { - font-size: 14px; - color: rgba(0, 0, 0, 1); - font-weight: 400; -} -.htl-contact-page .contact-form-box .form-control, .htl-contact-page .uploader span.filename { - border: 1px solid rgba(0, 0, 0, 1); - font-size: 14px; - color: rgba(0, 0, 0, 1); - font-weight: 400; -} -.htl-contact-page .uploader span.filename { - font-size: 12px; -} -.htl-contact-page .contact-form-box #contact_type { - width: 90%; - text-align: left; -} -.title-container { - margin-left: 150px; - margin-right: 150px; - color: #333333;} -.htl-contact-page .contact_type_ul { - font-size: 14px; - font-weight: 400; - top: 45px; - padding: 0px; - width: 100%; - border-bottom: 1px solid rgba(0, 0, 0, 1); - border-left: 1px solid rgba(0, 0, 0, 1); - border-right: 1px solid rgba(0, 0, 0, 1); - max-height: 145px; - overflow-y: auto; -} -.htl-contact-page .contact_type_ul li { - cursor: default; - font-size: 14px; - color: rgba(0, 0, 0, 1); - font-weight: 400; - padding: 11px; -} -.htl-contact-page .contact_type_ul li:hover, .htl-contact-page .contact_type_ul li:focus, .htl-contact-page .contact_type_ul li:active { - background-color: #379bf0; - color: #FFFFFF; -} -.htl-contact-page .contact_btn { - font-size: 14px; - color: rgba(255, 255, 255, 1); - font-weight: 600; - text-transform: uppercase; - border-radius: 4px; - padding: 0 20px; -} -.htl-contact-page .global-address-header { - font-weight: 400; - font-size: 12px; - color: rgba(0, 0, 0, .6); - text-transform: uppercase; - margin-bottom: 5px; -} -.htl-contact-page .global-address-value { - font-weight: 400; - font-size: 14px; - margin-bottom: 10px; - color: rgba(0, 0, 0, 1); - line-height: 22px; -} -.htl-contact-page .htl-global-address-div { - padding: 20px; - border-radius: 4px; - margin-bottom: 10px; - box-shadow: 2px 2px 15px 3px rgba(0,0,0,.1); -} -@media screen and (min-width: 767px) { - .htl-contact-page .htl-global-address-div { - margin-top: 60px; - } -} -.htl-contact-page .hotels-container { - display: flex; - flex-wrap: wrap; - justify-content: flex-start; -} -.hotels-container .hotel-header { - margin-bottom: 40px; - text-align: center; -} -.hotels-container .hotel-header>span { - font-size: 30px; - font-weight: 400; - color: rgba(0, 0, 0, 1); - border-bottom: 1px solid rgba(0, 0, 0, 1); -} -.htl-contact-page span.action { - background:#379bf0!important; -} -.htl-contact-page .hotel-address-container { - border-radius: 4px; - box-shadow: 2px 2px 15px 3px rgba(0,0,0,.1); - float: left; - padding: 15px 0px; - width: 100%; -} -.htl-contact-page .hotel-city-container>span { - font-size: 20px; - font-weight: 400; - color: rgba(0, 0, 0, 1); -} -.hotel-address-container .hotel-name { - font-size: 18px; - font-weight: 400; - color: rgba(0, 0, 0, 1); - margin-bottom: 15px; -} -.hotel-address-container span.htl-address-icon { - background-image: url(../../../modules/hotelreservationsystem/views/img/Slices/icon-contact.png); -} -.hotel-address-container img.htl-img { - border-radius: 6px; -} -.empty-properties-image-container { - background-image: url(../../../modules/hotelreservationsystem/views/img/Slices/no-hotel.png) ; - background-repeat:no-repeat; - background-position: center center; - padding: 200px 0px 10px 0px; - display: block; -} -.hotel-address-container span.htl-phone-icon { - background-image: url(../../../modules/hotelreservationsystem/views/img/Slices/icon-contact.png); - padding: 1px 15px 0px 2px; - background-position: 37px; - margin-right: 5px; - font-size: 14px; -} -.hotel-address-container span.htl-email-icon { - padding: 1px 10px 1px; - background-position: 19px; - margin-right: 5px; -} -.htl-contact-page .hotel-city-container { - margin-bottom: 10px; -} -span.htl-map-icon { - background-image: url(../../../modules/hotelreservationsystem/views/img/Slices/icon-contact.png); - padding: 1px 20px 0px 0px; - background-position: 0px 0px; - margin-right: 5px; - font-size: 14px; -} -.view_rooms_btn, .htl-map-direction-btn { - border-radius: 4px; - padding: 10px 12px; - text-transform: uppercase; -} - -.htl-map-direction-btn{ - background-color: #DEDEDE; - color: #333333; -} -.view_rooms_btn { - background-color: #1292FF; - border-color: #1292FF; - font-weight: 600; -} -.view_rooms_btn:hover { - background-color: #3c89cb; - border-color: #3a75a7; -} -.pagination-container { - text-align: center; -} -.hotel-branch-info-actions{ - display: flex; - gap: 10px; -} -.pagination-container .pagination > li > a, .pagination-container .pagination > li > span { - border: unset; -} -.pagination-container .pagination > li .active { - border: 1px solid #333333; - border-radius: 12px; - z-index: 10; -} -.hotel-address-container p.hotel-branch-info-value { - font-size: 14px; - color: rgba(0, 0, 0, 1); - font-weight: 400; - line-height: 25px; -} -.hotel-address-container .htl-map-direction-btn span { - font-size: 12px; - color: rgba(0, 0, 0, 1); - font-weight: 400; -} -/* ==== google map ==== */ -#googleMapWrapper { - clear: both; - height: 500px; -} -#map { - width: 100%; - height: 100%; -} - -#map .view-link { - padding-top: 4px; -} - -.gm-btn-get-directions { - text-decoration: none; - color: #427fed; - font-weight: bold; -} - -.gm-btn-get-directions:hover { - text-decoration: underline; - color: #427fed; -} - -.gm-btn-get-directions:focus { - outline: none; - color: #427fed; -} diff --git a/themes/hotel-reservation-theme/header.tpl b/themes/hotel-reservation-theme/header.tpl index 4de30a7cc..721a71cef 100644 --- a/themes/hotel-reservation-theme/header.tpl +++ b/themes/hotel-reservation-theme/header.tpl @@ -1,154 +1,4 @@ -{* -* 2007-2017 PrestaShop -* -* NOTICE OF LICENSE -* -* This source file is subject to the Academic Free License (AFL 3.0) -* that is bundled with this package in the file LICENSE.txt. -* It is also available through the world-wide-web at this URL: -* http://opensource.org/licenses/afl-3.0.php -* If you did not receive a copy of the license and are unable to -* obtain it through the world-wide-web, please send an email -* to license@prestashop.com so we can send you a copy immediately. -* -* DISCLAIMER -* -* Do not edit or add to this file if you wish to upgrade PrestaShop to newer -* versions in the future. If you wish to customize PrestaShop for your -* needs please refer to http://www.prestashop.com for more information. -* -* @author PrestaShop SA -* @copyright 2007-2017 PrestaShop SA -* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -* International Registered Trademark & Property of PrestaShop SA -*} - - - - - - - - - {$meta_title|escape:'html':'UTF-8'} - {if isset($meta_description) AND $meta_description} - - {/if} - {if isset($meta_keywords) AND $meta_keywords} - - {/if} - - - - - - - {if isset($css_files)} - {foreach from=$css_files key=css_uri item=media} - {if $css_uri == 'lteIE9'} - - {else} - - {/if} - {/foreach} - {/if} - {if isset($js_defer) && !$js_defer && isset($js_files) && isset($js_def)} - {$js_def} - {foreach from=$js_files item=js_uri} - - {/foreach} - {/if} - {block name='displayHeader'} - {$HOOK_HEADER} - {/block} - - - - - - - - - - - {if !isset($content_only) || !$content_only} - {if isset($restricted_country_mode) && $restricted_country_mode} -
-

{l s='You cannot place a new order from your country.'}{if isset($geolocation_country) && $geolocation_country} {$geolocation_country|escape:'html':'UTF-8'}{/if}

-
- {/if} -
-
- -
-
-
- {if $show_breadcrump} - {block name='breadcrumb'} - {include file="$tpl_dir./breadcrumb.tpl"} - {/block} - {/if} -
-
{hook h="displayTopColumn"}
-
-
- {if isset($left_column_size) && !empty($left_column_size)} -
{$HOOK_LEFT_COLUMN}
- {/if} - {if isset($left_column_size) && isset($right_column_size)}{assign var='cols' value=(12 - $left_column_size - $right_column_size)}{else}{assign var='cols' value=12}{/if} -
- {/if} +/home/users/vishal.singh/www/html/Review/QloApps-gli-2489/tools/smarty/sysplugins/smarty_internal_compile_foreach.php + 33,56: public $optional_attributes = array('name', 'key', 'properties'); + 142,27: if (isset($_attr[ 'properties' ]) && preg_match_all('/[\'](.*?)[\']/', $_attr[ 'properties' ], $match)) { + 142,88: if (isset($_attr[ 'properties' ]) && preg_match_all('/[\'](.*?)[\']/', $_attr[ 'properties' ], $match)) { \ No newline at end of file diff --git a/themes/hotel-reservation-theme/js/properties.js b/themes/hotel-reservation-theme/js/our-properties.js similarity index 93% rename from themes/hotel-reservation-theme/js/properties.js rename to themes/hotel-reservation-theme/js/our-properties.js index c48b6944d..ba9408875 100644 --- a/themes/hotel-reservation-theme/js/properties.js +++ b/themes/hotel-reservation-theme/js/our-properties.js @@ -21,7 +21,6 @@ */ $(document).ready(function() { - //By Webkul JS for Map locations of the hotels on google Map if (typeof hotelLocationArray != 'undefined' && $('#map').length @@ -30,6 +29,12 @@ $(document).ready(function() { ) { initMap(); } + + $(document).on('click', 'ul.pagination li a', function(e){ + e.preventDefault(); + $('#pagination').val($(this).data('pagination')); + $('form#our-properties-list').submit(); + }); }); function initMap() { diff --git a/themes/hotel-reservation-theme/modules/blockuserinfo/nav.tpl b/themes/hotel-reservation-theme/modules/blockuserinfo/nav.tpl index 0c17e55b6..b68943311 100644 --- a/themes/hotel-reservation-theme/modules/blockuserinfo/nav.tpl +++ b/themes/hotel-reservation-theme/modules/blockuserinfo/nav.tpl @@ -47,10 +47,5 @@ {/if} {if !isset($ajaxCustomerLogin)}
- {if isset($WK_DISPLAY_OUR_HOTEL_TAB_IN_HEADER) && $WK_DISPLAY_OUR_HOTEL_TAB_IN_HEADER} - - {/if} {/if} {/block} diff --git a/themes/hotel-reservation-theme/properties.tpl b/themes/hotel-reservation-theme/our-properties.tpl similarity index 86% rename from themes/hotel-reservation-theme/properties.tpl rename to themes/hotel-reservation-theme/our-properties.tpl index 12ade303e..094f83dff 100644 --- a/themes/hotel-reservation-theme/properties.tpl +++ b/themes/hotel-reservation-theme/our-properties.tpl @@ -25,8 +25,8 @@ {if isset($hotelsInfo) && $hotelsInfo} {block name='our_properties_list_title'}
-

{l s='Our Hotels'}

-
+

{l s='Our Properties'}

+

{$WK_HTL_SHORT_DESC|escape:'html':'UTF-8'}

@@ -38,7 +38,7 @@ {block name='our_properties_location'} {if isset($hotelLocationArray) && $hotelLocationArray && isset($displayHotelMap) && $displayHotelMap} -
+
@@ -55,11 +55,11 @@ {hook h='displayPropertiesListBefore'} {/block} -
+
{block name='our_properties_list'}
{foreach $hotelsInfo as $hotel} -
+
@@ -74,9 +74,9 @@ {$hotel['email']}

- {l s='View Rooms'} + {l s='View Rooms'} {if ($hotel['latitude'] != 0 || $hotel['longitude'] != 0) && $viewOnMap} - {l s='View on map'} + {l s='View on map'} {/if}
@@ -91,7 +91,7 @@ {/block} {if (isset($pageLimit)) && $pageLimit > 1} -
+
From 2233c55efdb846f1405bfa1899bcb231ecae3213 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Sat, 17 May 2025 12:54:10 +0530 Subject: [PATCH 22/29] Fixed some minor issues and improved ajax responses --- .../controllers/carts/helpers/view/view.tpl | 43 ++++---- controllers/admin/AdminCartsController.php | 63 ++++++------ controllers/admin/AdminOrdersController.php | 99 ++++++++++++------- 3 files changed, 112 insertions(+), 93 deletions(-) diff --git a/admin/themes/default/template/controllers/carts/helpers/view/view.tpl b/admin/themes/default/template/controllers/carts/helpers/view/view.tpl index 09decd44b..2fd68d44f 100644 --- a/admin/themes/default/template/controllers/carts/helpers/view/view.tpl +++ b/admin/themes/default/template/controllers/carts/helpers/view/view.tpl @@ -195,30 +195,31 @@ {if isset($room['selected_services']) && $room['selected_services']} {foreach $room['selected_services'] as $service}
-
-
-
-

{$service['name']|escape:'html':'UTF-8'}

- {if $service.allow_multiple_quantity} -
- {l s='Quantity:'} {$service.quantity} -
- {/if} -
+
+
+
+
{$service['name']|escape:'html':'UTF-8'}
+ {if $service.allow_multiple_quantity} +
+ {l s='Quantity:'} {$service.quantity} +
+ {/if}
-
- {if $service['auto_add_to_cart'] && $service['price_addition_type'] == Product::PRICE_ADDITION_TYPE_INDEPENDENT} - {l s='Convenience fee'} - {/if} - {if $service['auto_add_to_cart'] && $service['price_addition_type'] == Product::PRICE_ADDITION_TYPE_WITH_ROOM} - {l s='Auto added'} - {/if} -
-
- {convertPrice price=$service.total_price} -
+
+ {if $service['auto_add_to_cart'] && $service['price_addition_type'] == Product::PRICE_ADDITION_TYPE_INDEPENDENT} + {l s='Convenience fee'} + {/if} + {if $service['auto_add_to_cart'] && $service['price_addition_type'] == Product::PRICE_ADDITION_TYPE_WITH_ROOM} + {l s='Auto added'} + {/if} +
+
+ {convertPrice price=$service.total_price} +
+
+

{/foreach} {/if}
diff --git a/controllers/admin/AdminCartsController.php b/controllers/admin/AdminCartsController.php index 5449fa338..557fca655 100644 --- a/controllers/admin/AdminCartsController.php +++ b/controllers/admin/AdminCartsController.php @@ -1148,11 +1148,6 @@ class AdminCartsControllerCore extends AdminController $objRoomTypeServPrice = new RoomTypeServiceProductPrice(); foreach ($serviceProducts as $key => $servProduct) { $serviceProducts[$key]['price_tax_exc'] = $objRoomTypeServPrice->getServicePrice($servProduct['id_product'], 0, 1, null, null, false, $idCart); - if ($additionalServices - && (in_array($servProduct['id_product'], array_column($additionalServices['additional_services'], 'id_product'))) - ) { - unset($serviceProducts[$key]); - } } } @@ -1190,7 +1185,7 @@ class AdminCartsControllerCore extends AdminController ); } else { $response['hasError'] = true; - $response['errors'][] = $this->l('Some error occurred. please try again.'); + $response['errors'][] = Tools::displayError('Some error occurred. please try again.'); } $this->ajaxDie(json_encode($response)); @@ -1218,15 +1213,15 @@ class AdminCartsControllerCore extends AdminController public function ajaxProcessUpdateServiceProduct() { - if ($this->tabAccess['edit'] === '1') { + if ($this->tabAccess['edit'] === '1') { $operator = Tools::getValue('operator', 'up'); $idServiceProduct = Tools::getValue('id_product'); $idCartBooking = Tools::getValue('id_cart_booking'); $qty = Tools::getValue('qty'); - + if (Validate::isLoadedObject($objHotelCartBookingData = new HotelCartBookingData($idCartBooking))) { $objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail(); - + if ($operator == 'up') { $objRoomTypeServiceProduct = new RoomTypeServiceProduct(); if ($objRoomTypeServiceProduct->isRoomTypeLinkedWithProduct($objHotelCartBookingData->id_product, $idServiceProduct)) { @@ -1248,7 +1243,7 @@ class AdminCartsControllerCore extends AdminController $this->errors[] = Tools::displayError('This Service is not available with selected room.'); } } - + if (empty($this->errors)) { if ($objRoomTypeServiceProductCartDetail->updateCartServiceProduct( $idCartBooking, @@ -1263,7 +1258,7 @@ class AdminCartsControllerCore extends AdminController } else { $this->errors[] = Tools::displayError('Unable to update services. Please try reloading the page.'); } - + } } else { $this->errors[] = Tools::displayError('Room not found. Please try reloading the page.'); @@ -1369,28 +1364,28 @@ class AdminCartsControllerCore extends AdminController $priceAdditionType = 0; if (empty($productQty)) { $response['hasError'] = true; - $response['errors'][] = $this->l('Service quantity is required'); + $response['errors'][] = Tools::displayError('Service quantity is required'); } elseif (!Validate::isUnsignedInt($productQty)) { $response['hasError'] = true; - $response['errors'][] = $this->l('Invalid service quantity'); + $response['errors'][] = Tools::displayError('Invalid service quantity'); } } // Validate service data provided if (empty($name)) { $response['hasError'] = true; - $response['errors'][] = $this->l('Service name is required'); + $response['errors'][] = Tools::displayError('Service name is required'); } elseif (!Validate::isCatalogName($name)) { $response['hasError'] = true; - $response['errors'][] = $this->l('Invalid service name'); + $response['errors'][] = Tools::displayError('Invalid service name'); } if (empty($price)) { $response['hasError'] = true; - $response['errors'][] = $this->l('Service price is required'); + $response['errors'][] = Tools::displayError('Service price is required'); } elseif (!Validate::isPrice($price)) { $response['hasError'] = true; - $response['errors'][] = $this->l('Invalid service price'); + $response['errors'][] = Tools::displayError('Invalid service price'); } // if no validation errors then add service @@ -1457,28 +1452,28 @@ class AdminCartsControllerCore extends AdminController $response['service_panel'] = $this->getBookingServicesTabContent($objHtlCartBooking->id); } else { $response['hasError'] = true; - $response['errors'][] = $this->l('Some error occurred while adding service to the room'); + $response['errors'][] = Tools::displayError('Some error occurred while adding service to the room'); } } else { $response['hasError'] = true; - $response['errors'][] = $this->l('Unable to add service to the room'); + $response['errors'][] = Tools::displayError('Unable to add service to the room'); } } else { $response['hasError'] = true; - $response['errors'][] = $this->l('Unable to add service to the room'); + $response['errors'][] = Tools::displayError('Unable to add service to the room'); } } } else { $response['hasError'] = true; - $response['errors'][] = $this->l('Room not found'); + $response['errors'][] = Tools::displayError('Room not found'); } } else { $response['hasError'] = true; - $response['errors'][] = $this->l('Adding a new custom service is not allowed.'); + $response['errors'][] = Tools::displayError('Adding a new custom service is not allowed.'); } } else { $response['hasError'] = true; - $response['errors'][] = $this->l('You do not have permission to edit this order.'); + $response['errors'][] = Tools::displayError('You do not have permission to edit this order.'); } $this->ajaxDie(json_encode($response)); @@ -1562,14 +1557,14 @@ class AdminCartsControllerCore extends AdminController if ($objProduct->allow_multiple_quantity) { if (!isset($serviceQuantities[$idServiceProduct])) { $response['hasError'] = true; - $response['errors'] = $this->l('Quantity not provided for service').': '.$objProduct->name; + $response['errors'][] = Tools::displayError('Quantity not provided for service').': '.$objProduct->name; } else if (!Validate::isUnsignedInt($serviceQuantities[$idServiceProduct])) { $response['hasError'] = true; - $response['errors'] = $this->l('Invalid quantity provided for service').': '.$objProduct->name; + $response['errors'][] = Tools::displayError('Invalid quantity provided for service').': '.$objProduct->name; } } elseif ($serviceQuantities[$idServiceProduct] > 1) { $response['hasError'] = true; - $response['errors'] = $this->l('Can not order multiple quanitity for service').': '.$objProduct->name; + $response['errors'][] = Tools::displayError('Can not order multiple quanitity for service').': '.$objProduct->name; } if (!$objProduct->allow_multiple_quantity) { @@ -1580,12 +1575,10 @@ class AdminCartsControllerCore extends AdminController || !ValidateCore::isPrice($serviceUnitPrices[$idServiceProduct]) ) { $response['hasError'] = true; - $response['errors'] = $this->l('Invalid unit price for service').': '.$objProduct->name; + $response['errors'][] = Tools::displayError('Invalid unit price for service').': '.$objProduct->name; } - } else { - die($idServiceProduct); - $response['errors'] = $this->l('Some services not found. please try after refreshing the page'); + $response['errors'][] = Tools::displayError('Some services not found. please try after refreshing the page'); } } @@ -1609,7 +1602,7 @@ class AdminCartsControllerCore extends AdminController )) { $originalPrice = Product::getPriceStatic($idServiceProduct, false); // if price is different than the original service price then update the price - if ($operator == 'up' && $originalPrice != $price) { + if ($operator == 'up' && $originalPrice != $unitPrice) { if ($specificPriceInfo = SpecificPrice::getSpecificPrice( (int)$idServiceProduct, 0, @@ -1649,20 +1642,20 @@ class AdminCartsControllerCore extends AdminController if (!$result) { $response['hasError'] = true; - $response['errors'] = $this->l('Error while updating services, please try again after refresing the page'); + $response['errors'][] = Tools::displayError('Error while updating services, please try again after refresing the page'); } } } else { $response['hasError'] = true; - $response['errors'] = $this->l('No service found'); + $response['errors'][] = Tools::displayError('No service found'); } } else { $response['hasError'] = true; - $response['errors'] = $this->l('Room info not found'); + $response['errors'][] = Tools::displayError('Room info not found'); } } else { $response['hasError'] = true; - $response['errors'] = $this->l('You do not have permission to edit this order.'); + $response['errors'][] = Tools::displayError('You do not have permission to edit this order.'); } $this->ajaxDie(json_encode($response)); diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index a719d7d26..64d22fd82 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -3515,18 +3515,18 @@ class AdminOrdersControllerCore extends AdminController $response['msg'] = $this->l('Guest details are updated.'); } else { - $response['errors'][] = $this->l('Unable to save guest details.'); + $response['errors'][] = Tools::displayError('Unable to save guest details.'); } } else { - $response['errors'][] = $this->l('Guest details not found.'); + $response['errors'][] = Tools::displayError('Guest details not found.'); } } else { - $response['errors'][] = $this->l('Guest details not found.'); + $response['errors'][] = Tools::displayError('Guest details not found.'); } } } } else { - $response['errors'][] = $this->l('You do not have permission to edit this order.'); + $response['errors'][] = Tools::displayError('You do not have permission to edit this order.'); } if ($response['errors']) { @@ -5068,7 +5068,6 @@ class AdminOrdersControllerCore extends AdminController } } - if ($qty_diff != 0) { $cartQty = $qty_diff; $op = 'up'; @@ -5679,7 +5678,9 @@ class AdminOrdersControllerCore extends AdminController )) { $objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail((int) $idRoomTypServiceProductCartDetail); $serviceQuantity = $objRoomTypeServiceProductCartDetail->quantity; - if ($objRoomTypeServiceProductCartDetail->delete()) { + if ($objRoomTypeServiceProductCartDetail->delete() + && Validate::isLoadedObject(new Product((int) $service['id_product'])) + ) { $objCart = new Cart($service['id_cart']); $objCart->updateQty((int)abs($serviceQuantity), $service['id_product'], null, false, 'down'); } @@ -6588,25 +6589,25 @@ class AdminOrdersControllerCore extends AdminController if ($objOrderDetail->product_allow_multiple_quantity) { if (!isset($serviceQuantities[$idRoomTypeServiceProductOrderDetail])) { $response['hasError'] = true; - $response['errors'] = $this->l('Quantity not provided for service').': '.$objRoomTypeServiceOrderDetail->name; + $response['errors'][] = Tools::displayError('Quantity not provided for service').': '.$objRoomTypeServiceOrderDetail->name; } else if (!Validate::isUnsignedInt($serviceQuantities[$idRoomTypeServiceProductOrderDetail])) { $response['hasError'] = true; - $response['errors'] = $this->l('Invalid quantity provided for service').': '.$objRoomTypeServiceOrderDetail->name; + $response['errors'][] = Tools::displayError('Invalid quantity provided for service').': '.$objRoomTypeServiceOrderDetail->name; } } elseif ($serviceQuantities[$idRoomTypeServiceProductOrderDetail] > 1) { $response['hasError'] = true; - $response['errors'] = $this->l('Can not order multiple quanitity for service').': '.$objRoomTypeServiceOrderDetail->name; + $response['errors'][] = Tools::displayError('Can not order multiple quanitity for service').': '.$objRoomTypeServiceOrderDetail->name; } if (!isset($serviceUnitPrices[$idRoomTypeServiceProductOrderDetail]) || !ValidateCore::isPrice($serviceUnitPrices[$idRoomTypeServiceProductOrderDetail]) ) { $response['hasError'] = true; - $response['errors'] = $this->l('Invalid unit price for service').': '.$objRoomTypeServiceOrderDetail->name; + $response['errors'][] = Tools::displayError('Invalid unit price for service').': '.$objRoomTypeServiceOrderDetail->name; } } else { $response['hasError'] = true; - $response['errors'] = $this->l('Service not found for service').': '.$objRoomTypeServiceOrderDetail->name; + $response['errors'][] = Tools::displayError('Service not found for service').': '.$objRoomTypeServiceOrderDetail->name; } } @@ -6704,7 +6705,7 @@ class AdminOrdersControllerCore extends AdminController if (!$result) { $response['hasError'] = true; - $response['errors'] = $this->l('Error while updating service, please try again after refresing the page'); + $response['errors'][] = Tools::displayError('Error while updating service, please try again after refresing the page'); } else { $response['service_panel']= $servicesBlock = $this->processRenderServicesPanel( $objOrderDetail->id_order, @@ -6719,11 +6720,11 @@ class AdminOrdersControllerCore extends AdminController } } else { $response['hasError'] = true; - $response['errors'] = $this->l('Service not found'); + $response['errors'][] = Tools::displayError('Service not found'); } } else { $response['hasError'] = true; - $response['errors'] = $this->l('You do not have permission to edit this order.'); + $response['errors'][] = Tools::displayError('You do not have permission to edit this order.'); } $this->ajaxDie(json_encode($response)); @@ -6954,12 +6955,12 @@ class AdminOrdersControllerCore extends AdminController ); } else { $response['hasError'] = true; - $response['errors'][] = $this->l('Room not found'); + $response['errors'][] = Tools::displayError('Room not found'); } } } else { $response['hasError'] = true; - $response['errors'][] = $this->l('You do not have permission to edit this order.'); + $response['errors'][] = Tools::displayError('You do not have permission to edit this order.'); } $this->ajaxDie(json_encode($response)); @@ -6982,7 +6983,7 @@ class AdminOrdersControllerCore extends AdminController $objHotelBookingDetail->date_from, $objHotelBookingDetail->date_to, $objHotelBookingDetail->id_room - )) { + )) { $name = Tools::getValue('new_service_name'); $price = Tools::getValue('new_service_price'); $priceCalcMethod = Tools::getValue('new_service_price_calc_method'); @@ -7003,28 +7004,28 @@ class AdminOrdersControllerCore extends AdminController $priceAdditionType = 0; if (empty($productQty)) { $response['hasError'] = true; - $response['errors'][] = $this->l('Service quantity is required'); + $response['errors'][] = Tools::displayError('Service quantity is required'); } elseif (!Validate::isUnsignedInt($productQty)) { $response['hasError'] = true; - $response['errors'][] = $this->l('Invalid service quantity'); + $response['errors'][] = Tools::displayError('Invalid service quantity'); } } // Validate service data provided if (empty($name)) { $response['hasError'] = true; - $response['errors'][] = $this->l('Service name is required'); + $response['errors'][] = Tools::displayError('Service name is required'); } elseif (!Validate::isCatalogName($name)) { $response['hasError'] = true; - $response['errors'][] = $this->l('Invalid service name'); + $response['errors'][] = Tools::displayError('Invalid service name'); } if (empty($price)) { $response['hasError'] = true; - $response['errors'][] = $this->l('Service price is required'); + $response['errors'][] = Tools::displayError('Service price is required'); } elseif (!Validate::isPrice($price)) { $response['hasError'] = true; - $response['errors'][] = $this->l('Invalid service price'); + $response['errors'][] = Tools::displayError('Invalid service price'); } // if no validation errors then add service @@ -7232,7 +7233,7 @@ class AdminOrdersControllerCore extends AdminController ); } else { $response['hasError'] = true; - $response['errors'][] = $this->l('Some error occurred while updating the order'); + $response['errors'][] = Tools::displayError('Some error occurred while updating the order'); } // at last delete the specific price created for the service @@ -7242,42 +7243,42 @@ class AdminOrdersControllerCore extends AdminController } } else { $response['hasError'] = true; - $response['errors'][] = $this->l('Some error occurred while updating the order'); + $response['errors'][] = Tools::displayError('Some error occurred while updating the order'); } } else { $response['hasError'] = true; - $response['errors'][] = $this->l('Unable to add service to the room'); + $response['errors'][] = Tools::displayError('Unable to add service to the room'); } } else { $response['hasError'] = true; - $response['errors'][] = $this->l('Unable to add service to the room'); + $response['errors'][] = Tools::displayError('Unable to add service to the room'); } } else { $response['hasError'] = true; - $response['errors'][] = $this->l('Unable to add service to the room'); + $response['errors'][] = Tools::displayError('Unable to add service to the room'); } } else { $response['hasError'] = true; - $response['errors'][] = $this->l('Unable to add service to the room'); + $response['errors'][] = Tools::displayError('Unable to add service to the room'); } // at last delete the created service $objServiceProduct->delete(); } } else { $response['hasError'] = true; - $response['errors'][] = $this->l('Unable to add service to the room'); + $response['errors'][] = Tools::displayError('Unable to add service to the room'); } } else { $response['hasError'] = true; - $response['errors'][] = $this->l('Room not found'); + $response['errors'][] = Tools::displayError('Room not found'); } } else { $response['hasError'] = true; - $response['errors'][] = $this->l('Adding a new custom service is not allowed.'); + $response['errors'][] = Tools::displayError('Adding a new custom service is not allowed.'); } } else { $response['hasError'] = true; - $response['errors'][] = $this->l('You do not have permission to edit this order.'); + $response['errors'][] = Tools::displayError('You do not have permission to edit this order.'); } $this->ajaxDie(json_encode($response)); @@ -7289,15 +7290,39 @@ class AdminOrdersControllerCore extends AdminController $response = array('hasError' => false); // Check tab access is allowed to edit if ($this->tabAccess['edit'] == 1) { - $id_room_type_service_product_order_detail = Tools::getValue('id_room_type_service_product_order_detail'); - - if (Validate::isLoadedObject($objRoomTypeServiceProductOrderDetail = new RoomTypeServiceProductOrderDetail($id_room_type_service_product_order_detail))) { + $idRoomTypeServiceProductOrderDetail = Tools::getValue('id_room_type_service_product_order_detail'); + if (Validate::isLoadedObject($objRoomTypeServiceProductOrderDetail = new RoomTypeServiceProductOrderDetail($idRoomTypeServiceProductOrderDetail))) { $objOrderDetail = new OrderDetail($objRoomTypeServiceProductOrderDetail->id_order_detail); $priceTaxExcl = $objRoomTypeServiceProductOrderDetail->total_price_tax_excl; $priceTaxIncl = $objRoomTypeServiceProductOrderDetail->total_price_tax_incl; $quantity = $objRoomTypeServiceProductOrderDetail->quantity; $res = true; $objHotelBookingDetail = new HotelBookingDetail($objRoomTypeServiceProductOrderDetail->id_htl_booking_detail); + $objHotelCartBookingData = new HotelCartBookingData(); + $objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail(); + + if ($roomHtlCartInfo = $objHotelCartBookingData->getRoomRowByIdProductIdRoomInDateRange( + $objHotelBookingDetail->id_cart, + $objHotelBookingDetail->id_product, + $objHotelBookingDetail->date_from, + $objHotelBookingDetail->date_to, + $objHotelBookingDetail->id_room + )) { + if ($idRoomTypServiceProductCartDetail = $objRoomTypeServiceProductCartDetail->alreadyExists( + $objRoomTypeServiceProductOrderDetail->id_product, + $objRoomTypeServiceProductOrderDetail->id_cart, + $roomHtlCartInfo['id'] + )) { + $objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail($idRoomTypServiceProductCartDetail); + if ($objRoomTypeServiceProductCartDetail->delete() + // Since the service product is deleted after adding them directly from the order the cart will throw exception on the service delete process. + && Validate::isLoadedObject(new Product($objRoomTypeServiceProductOrderDetail->id_product)) + ) { + $objCart = new Cart($objRoomTypeServiceProductOrderDetail->id_cart); + $objCart->updateQty((int) abs($quantity), $objRoomTypeServiceProductOrderDetail->id_product, null, false, 'down'); + } + } + } if ($res &= $objRoomTypeServiceProductOrderDetail->delete()) { $order = new Order($objRoomTypeServiceProductOrderDetail->id_order); @@ -7502,7 +7527,7 @@ class AdminOrdersControllerCore extends AdminController } } else { $response['hasError'] = true; - $response['errors'][] = $this->l('You do not have permission to edit this order.'); + $response['errors'][] = Tools::displayError('You do not have permission to edit this order.'); } die(json_encode($response)); } From dddd6881305708b0ec3ed3a938215000495b06d3 Mon Sep 17 00:00:00 2001 From: azhar bhat Date: Mon, 19 May 2025 10:51:02 +0530 Subject: [PATCH 23/29] Added ellipsis (...) to hotel name when it exceeds parent div width --- modules/wkroomsearchblock/views/css/wk-global-search.css | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/wkroomsearchblock/views/css/wk-global-search.css b/modules/wkroomsearchblock/views/css/wk-global-search.css index d54af2d05..39628251b 100644 --- a/modules/wkroomsearchblock/views/css/wk-global-search.css +++ b/modules/wkroomsearchblock/views/css/wk-global-search.css @@ -79,6 +79,11 @@ padding-right: 20px; background: url("../../views/img/icon-hotel.svg") no-repeat 10px 50%, url("../../views/img/icon-dropdown-arrow.svg") no-repeat calc(100% - 10px) 50%; background-color: #FFF;} + #id_hotel_button{ + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + } #search_hotel_block_form .input-date { display: grid; cursor: text;} From 678f593752a87eeb5fcec798d373eab659cc5f6e Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Mon, 19 May 2025 13:14:01 +0530 Subject: [PATCH 24/29] Revert change to header.tpl --- themes/hotel-reservation-theme/header.tpl | 158 +++++++++++++++++++++- 1 file changed, 154 insertions(+), 4 deletions(-) diff --git a/themes/hotel-reservation-theme/header.tpl b/themes/hotel-reservation-theme/header.tpl index 721a71cef..4de30a7cc 100644 --- a/themes/hotel-reservation-theme/header.tpl +++ b/themes/hotel-reservation-theme/header.tpl @@ -1,4 +1,154 @@ -/home/users/vishal.singh/www/html/Review/QloApps-gli-2489/tools/smarty/sysplugins/smarty_internal_compile_foreach.php - 33,56: public $optional_attributes = array('name', 'key', 'properties'); - 142,27: if (isset($_attr[ 'properties' ]) && preg_match_all('/[\'](.*?)[\']/', $_attr[ 'properties' ], $match)) { - 142,88: if (isset($_attr[ 'properties' ]) && preg_match_all('/[\'](.*?)[\']/', $_attr[ 'properties' ], $match)) { \ No newline at end of file +{* +* 2007-2017 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2017 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} + + + + + + + + + {$meta_title|escape:'html':'UTF-8'} + {if isset($meta_description) AND $meta_description} + + {/if} + {if isset($meta_keywords) AND $meta_keywords} + + {/if} + + + + + + + {if isset($css_files)} + {foreach from=$css_files key=css_uri item=media} + {if $css_uri == 'lteIE9'} + + {else} + + {/if} + {/foreach} + {/if} + {if isset($js_defer) && !$js_defer && isset($js_files) && isset($js_def)} + {$js_def} + {foreach from=$js_files item=js_uri} + + {/foreach} + {/if} + {block name='displayHeader'} + {$HOOK_HEADER} + {/block} + + + + + + + + + + + {if !isset($content_only) || !$content_only} + {if isset($restricted_country_mode) && $restricted_country_mode} +
+

{l s='You cannot place a new order from your country.'}{if isset($geolocation_country) && $geolocation_country} {$geolocation_country|escape:'html':'UTF-8'}{/if}

+
+ {/if} +
+
+ +
+
+
+ {if $show_breadcrump} + {block name='breadcrumb'} + {include file="$tpl_dir./breadcrumb.tpl"} + {/block} + {/if} +
+
{hook h="displayTopColumn"}
+
+
+ {if isset($left_column_size) && !empty($left_column_size)} +
{$HOOK_LEFT_COLUMN}
+ {/if} + {if isset($left_column_size) && isset($right_column_size)}{assign var='cols' value=(12 - $left_column_size - $right_column_size)}{else}{assign var='cols' value=12}{/if} +
+ {/if} From 45269f7d3da9e6d2191dfa050d4b0b9a66260595 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Mon, 19 May 2025 16:53:18 +0530 Subject: [PATCH 25/29] Fixed: undefined index issues and display issue --- themes/hotel-reservation-theme/_partials/room_type_list.tpl | 2 +- themes/hotel-reservation-theme/header.tpl | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/themes/hotel-reservation-theme/_partials/room_type_list.tpl b/themes/hotel-reservation-theme/_partials/room_type_list.tpl index 7af810b91..5613be05c 100644 --- a/themes/hotel-reservation-theme/_partials/room_type_list.tpl +++ b/themes/hotel-reservation-theme/_partials/room_type_list.tpl @@ -20,7 +20,7 @@ {block name='displayRoomTypeListBefore'} {hook h='displayRoomTypeListBefore'} {/block} -{if isset($booking_data['stats']) && $booking_data['stats']['num_avail'] || isset($display_all_room_types) && $display_all_room_types} +{if isset($booking_data['stats']) && $booking_data['stats']['num_avail'] || isset($display_all_room_types) && $display_all_room_types && isset($booking_data['rm_data'])} {foreach from=$booking_data['rm_data'] key=room_k item=room_v} {if $room_v['data']['available']|count || isset($display_all_room_types) && $display_all_room_types }
diff --git a/themes/hotel-reservation-theme/header.tpl b/themes/hotel-reservation-theme/header.tpl index 4de30a7cc..bc3339ca1 100644 --- a/themes/hotel-reservation-theme/header.tpl +++ b/themes/hotel-reservation-theme/header.tpl @@ -121,6 +121,11 @@ {block name='displayTop'} {if isset($HOOK_TOP)}{$HOOK_TOP}{/if} {/block} + {if isset($WK_DISPLAY_PROPERTIES_LINK_IN_HEADER) && $WK_DISPLAY_PROPERTIES_LINK_IN_HEADER} + + {/if}
From 14886b285dacdd0d1f50b6448d2018121adad9ea Mon Sep 17 00:00:00 2001 From: azhar bhat Date: Mon, 19 May 2025 17:22:20 +0530 Subject: [PATCH 26/29] removed select hotel from hoteloptions --- .../wkroomsearchblock/views/templates/front/hotel-options.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/wkroomsearchblock/views/templates/front/hotel-options.tpl b/modules/wkroomsearchblock/views/templates/front/hotel-options.tpl index ad3409356..ee292d0a2 100644 --- a/modules/wkroomsearchblock/views/templates/front/hotel-options.tpl +++ b/modules/wkroomsearchblock/views/templates/front/hotel-options.tpl @@ -17,7 +17,7 @@ * @license LICENSE.txt *} - + {if isset($hotels_info) && is_array($hotels_info)} {foreach from=$hotels_info item=hotel_info}