From 8b749566a43c8b5982751ef703679dbcbbc4afdd Mon Sep 17 00:00:00 2001 From: Shreesh Arora Date: Fri, 19 Apr 2024 15:15:12 +0530 Subject: [PATCH 01/10] Fixed: Service product associated room types are shown according to hotel permission --- .../admin/AdminNormalProductsController.php | 39 ++----------------- 1 file changed, 3 insertions(+), 36 deletions(-) diff --git a/controllers/admin/AdminNormalProductsController.php b/controllers/admin/AdminNormalProductsController.php index 87a959951..b0c0715b8 100644 --- a/controllers/admin/AdminNormalProductsController.php +++ b/controllers/admin/AdminNormalProductsController.php @@ -186,19 +186,17 @@ class AdminNormalProductsControllerCore extends AdminController $id_shop = Shop::isFeatureActive() && Shop::getContext() == Shop::CONTEXT_SHOP? (int)$this->context->shop->id : 'a.id_shop_default'; $this->_join .= ' JOIN `'._DB_PREFIX_.'product_shop` sa ON (a.`id_product` = sa.`id_product` AND sa.id_shop = '.$id_shop.') - LEFT JOIN `'._DB_PREFIX_.'htl_room_type` hrt ON (a.`id_product` = hrt.`id_product`) - LEFT JOIN `'._DB_PREFIX_.'htl_branch_info` hb ON (hrt.`id_hotel` = hb.`id`) - LEFT JOIN `'._DB_PREFIX_.'htl_branch_info_lang` hbl ON (hb.`id` = hbl.`id` AND b.`id_lang` = hbl.`id_lang`) LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON ('.$alias.'.`id_category_default` = cl.`id_category` AND b.`id_lang` = cl.`id_lang` AND cl.id_shop = '.$id_shop.') LEFT JOIN `'._DB_PREFIX_.'shop` shop ON (shop.id_shop = '.$id_shop.') LEFT JOIN `'._DB_PREFIX_.'image_shop` image_shop ON (image_shop.`id_product` = a.`id_product` AND image_shop.`cover` = 1 AND image_shop.id_shop = '.$id_shop.') LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_image` = image_shop.`id_image`) LEFT JOIN `'._DB_PREFIX_.'product_download` pd ON (pd.`id_product` = a.`id_product` AND pd.`active` = 1) LEFT JOIN `'._DB_PREFIX_.'htl_room_type_service_product` rsp ON (rsp.`id_product` = a.`id_product`) - LEFT JOIN `'._DB_PREFIX_.'address` aa ON (aa.`id_hotel` = hb.`id`)'; + LEFT JOIN `'._DB_PREFIX_.'htl_room_type` hrt ON (rsp.`id_element` = hrt.`id_product` AND rsp.`element_type` = '.(int)RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE.') + '.HotelBranchInformation::addHotelRestriction(false, 'hrt'); $this->_select .= ' IF(a.`auto_add_to_cart`, "'.$this->l('Yes').'", "'.$this->l('No').'") as auto_added, IF(a.`auto_add_to_cart`, 1, 0) as badge_success, IF(a.`show_at_front`, "'.$this->l('Yes').'", "'.$this->l('No').'") as show_at_front_txt, IF(a.`price_calculation_method` = '.(int)Product::PRICE_CALCULATION_METHOD_PER_DAY.', "'.$this->l('Per Day').'", "'.$this->l('Per Booking').'") as price_calculation_method_txt, (SELECT COUNT(hri.`id`) FROM `'._DB_PREFIX_.'htl_room_information` hri WHERE hri.`id_product` = a.`id_product`) as num_rooms, '; - $this->_select .= ' COUNT(rsp.`id_product`) as products_associated, hrt.`adults`, hrt.`children`, hb.`id` as id_hotel, aa.`city`, hbl.`hotel_name`, '; + $this->_select .= ' COUNT(hrt.`id_product`) as products_associated, '; $this->_select .= 'shop.`name` AS `shopname`, a.`id_shop_default`, '; $this->_select .= $alias_image.'.`id_image` AS `id_image`, cl.`name` AS `name_category`, '.$alias.'.`price`, 0 AS `price_final`, a.`is_virtual`, pd.`nb_downloadable`, sav.`quantity` AS `sav_quantity`, '.$alias.'.`active`, IF(sav.`quantity`<=0, 1, 0) AS `badge_danger`'; @@ -368,15 +366,6 @@ class AdminNormalProductsControllerCore extends AdminController return '--'; } - public function getHotelName($hotelName, $row) - { - if ($hotelName && isset($row['city'])) { - return $hotelName.' - '.$row['city']; - } - - return '--'; - } - public static function getQuantities($hotelName, $tr) { if ((int)$tr['is_virtual'] == 1 && $tr['nb_downloadable'] == 0) { @@ -3531,15 +3520,6 @@ class AdminNormalProductsControllerCore extends AdminController )); $data->assign($this->tpl_form_vars); - $objRoomType = new HotelRoomType(); - $objHotelInfo = new HotelBranchInformation(); - $data->assign('htl_info', $objHotelInfo->hotelsNameAndId()); - if ($hotelRoomType = $objRoomType->getRoomTypeInfoByIdProduct($product->id)) { - $data->assign('htl_room_type', $hotelRoomType); - $hotelFullInfo = $objHotelInfo->hotelBranchInfoById($hotelRoomType['id_hotel']); - $data->assign('htl_full_info', $hotelFullInfo); - } - $this->tpl_form_vars['product'] = $product; $this->tpl_form_vars['custom_form'] = $data->fetch(); } @@ -4113,19 +4093,6 @@ class AdminNormalProductsControllerCore extends AdminController } } - public function ajaxProcessGetIdHotelByIdProduct() - { - $response = array('status' => 'failed'); - $idProduct = Tools::getValue('id_product'); - $objHotelRoomType = new HotelRoomType(); - $roomTypeInfo = $objHotelRoomType->getRoomTypeInfoByIdProduct($idProduct); - if ($roomTypeInfo) { - $response['status'] = 'success'; - $response['id_hotel'] = (int)$roomTypeInfo['id_hotel']; - } - die(json_encode($response)); - } - public function processImageLegends() { if (Tools::getValue('key_tab') == 'Images' && Tools::getValue('submitAddproductAndStay') == 'update_legends' && Validate::isLoadedObject($product = new Product((int)Tools::getValue('id_product')))) { From e67f9be5e87f48348930cb89c9c0223bdbf7d766 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Mon, 22 Apr 2024 09:35:33 +0530 Subject: [PATCH 02/10] Fixed: notice on product page when service product has tax rule with no tax as option --- classes/tax/TaxRulesTaxManager.php | 1 + 1 file changed, 1 insertion(+) diff --git a/classes/tax/TaxRulesTaxManager.php b/classes/tax/TaxRulesTaxManager.php index 6f78d4de7..3956fa95e 100644 --- a/classes/tax/TaxRulesTaxManager.php +++ b/classes/tax/TaxRulesTaxManager.php @@ -104,6 +104,7 @@ class TaxRulesTaxManagerCore implements TaxManagerInterface AND tr.`id_country` = '.(int)$this->address->id_country.' AND tr.`id_tax_rules_group` = '.(int)$this->type.' AND tr.`id_state` IN (0, '.(int)$this->address->id_state.') + AND tr.`id_tax` !=0 AND (\''.pSQL($postcode).'\' BETWEEN tr.`zipcode_from` AND tr.`zipcode_to` OR (tr.`zipcode_to` = 0 AND tr.`zipcode_from` IN(0, \''.pSQL($postcode).'\'))) ORDER BY tr.`zipcode_from` DESC, tr.`zipcode_to` DESC, tr.`id_state` DESC, tr.`id_country` DESC'); From 4d67e38fa0b9a43c1b03269807475176632148e9 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Tue, 30 Apr 2024 18:19:32 +0530 Subject: [PATCH 03/10] Updated: The room type dropdown for customer message on order detail front controller will now show a room type only once --- controllers/front/OrderDetailController.php | 4 +++- themes/hotel-reservation-theme/order-detail.tpl | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/controllers/front/OrderDetailController.php b/controllers/front/OrderDetailController.php index afa1ea9e8..915847a1f 100644 --- a/controllers/front/OrderDetailController.php +++ b/controllers/front/OrderDetailController.php @@ -100,6 +100,7 @@ class OrderDetailControllerCore extends FrontController $total_demands_price_ti = 0; $total_convenience_fee_te = 0; $total_convenience_fee_ti = 0; + $formattedProducts = array(); if (!empty($products)) { foreach ($products as $type_key => $type_value) { if (in_array($type_value['product_id'], $processedProducts)) { @@ -374,7 +375,7 @@ class OrderDetailControllerCore extends FrontController } } - + $formattedProducts[$type_value['id_product']] = $type_value; } $redirectTermsLink = $this->context->link->getCMSLink(new CMS(3, $this->context->language->id), null, $this->context->language->id); @@ -437,6 +438,7 @@ class OrderDetailControllerCore extends FrontController 'order_history' => $order->getHistory($this->context->language->id, false, true), 'overbooking_order_states' => OrderState::getOverBookingStates(), 'products' => $products, + 'formattedProducts' => $formattedProducts, 'discounts' => $order->getCartRules(), 'carrier' => $carrier, 'address_invoice' => $addressInvoice, diff --git a/themes/hotel-reservation-theme/order-detail.tpl b/themes/hotel-reservation-theme/order-detail.tpl index b265ab018..4dfe3737d 100644 --- a/themes/hotel-reservation-theme/order-detail.tpl +++ b/themes/hotel-reservation-theme/order-detail.tpl @@ -450,7 +450,7 @@ - {foreach from=$formattedProducts item=product} + {foreach from=$roomTypes item=product} {if $product.is_booking_product} {/if} From 9fc25e0beea56da8415b3138d2b5231ef8cd8c8b Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Thu, 27 Jun 2024 19:59:51 +0530 Subject: [PATCH 09/10] Fixed the design changes --- themes/hotel-reservation-theme/css/order-detail.css | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/themes/hotel-reservation-theme/css/order-detail.css b/themes/hotel-reservation-theme/css/order-detail.css index 415abbb38..c84de4477 100644 --- a/themes/hotel-reservation-theme/css/order-detail.css +++ b/themes/hotel-reservation-theme/css/order-detail.css @@ -522,20 +522,20 @@ border-radius: 4px; } -.button-medium { +.button.button-medium { padding: 8px 15px; background-color: #379bf0; background-image: none; border-radius: 2px; } -.button-medium span { +.button.button-medium span { padding: 0; } -.button-medium:hover, -.button-medium:focus, -.button-medium:active { +.button.button-medium:hover, +.button.button-medium:focus, +.button.button-medium:active { opacity: 0.8; } From 182f27dd62a282f7dfb237a692cc713b65875ccc Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Thu, 27 Jun 2024 20:03:31 +0530 Subject: [PATCH 10/10] Updated the error message for theme compatible check --- controllers/admin/AdminThemesController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/admin/AdminThemesController.php b/controllers/admin/AdminThemesController.php index 0a6046a13..3a25fe8bb 100644 --- a/controllers/admin/AdminThemesController.php +++ b/controllers/admin/AdminThemesController.php @@ -1983,7 +1983,7 @@ class AdminThemesControllerCore extends AdminController } } if ($xml_version_too_old && !$this->_checkConfigForFeatures(array_keys(AdminThemes::$check_features))) { - $this->errors[] = Tools::displayError('The config.xml file has not been created for this version of PrestaShop.'); + $this->errors[] = Tools::displayError('The config.xml file has not been created for this version of QloApps.'); $return = false; }