From 8b749566a43c8b5982751ef703679dbcbbc4afdd Mon Sep 17 00:00:00 2001 From: Shreesh Arora Date: Fri, 19 Apr 2024 15:15:12 +0530 Subject: [PATCH 01/29] 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 1a72a65037055b76e3200a8d091f3ab359b101bb Mon Sep 17 00:00:00 2001 From: Sumit Panwar Date: Sat, 20 Apr 2024 10:38:05 +0530 Subject: [PATCH 02/29] Fixed: Name of the guest user is not present on order detail page in backoffice --- .../default/template/controllers/orders/helpers/view/view.tpl | 1 + 1 file changed, 1 insertion(+) 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 f28080e92..d875932f1 100644 --- a/admin/themes/default/template/controllers/orders/helpers/view/view.tpl +++ b/admin/themes/default/template/controllers/orders/helpers/view/view.tpl @@ -542,6 +542,7 @@
+
 {$customer->firstname} {$customer->lastname}
 {$customer->email}
{if $addresses.invoice->phone_mobile || $addresses.invoice->phone}
 {if $addresses.invoice->phone_mobile}{$addresses.invoice->phone_mobile}{else}{$addresses.invoice->phone}{/if}
From e67f9be5e87f48348930cb89c9c0223bdbf7d766 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Mon, 22 Apr 2024 09:35:33 +0530 Subject: [PATCH 03/29] 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 b1474bb9b6cdc80ed467191f6f23a77b56dbd9ba Mon Sep 17 00:00:00 2001 From: Shreesh Arora Date: Wed, 24 Apr 2024 11:12:19 +0530 Subject: [PATCH 04/29] Fixed: Unable to send customer request mail from contact us page --- controllers/front/ContactController.php | 172 +++++----- .../hotel-reservation-theme/contact-form.tpl | 311 +++++++++--------- 2 files changed, 243 insertions(+), 240 deletions(-) diff --git a/controllers/front/ContactController.php b/controllers/front/ContactController.php index ba68dd08c..75f4cf868 100644 --- a/controllers/front/ContactController.php +++ b/controllers/front/ContactController.php @@ -118,96 +118,96 @@ class ContactControllerCore extends FrontController $this->context->smarty->assign('alreadySent', 1); $contact->email = ''; $contact->customer_service = 0; - } - - if ($contact->customer_service) { - if ((int)$id_customer_thread) { - $ct = new CustomerThread($id_customer_thread); - $ct->status = 'open'; - $ct->id_lang = (int)$this->context->language->id; - $ct->id_contact = (int)$id_contact; - $ct->id_order = (int)$id_order; - if ($id_product = (int)Tools::getValue('id_product')) { - $ct->id_product = $id_product; + } else { + if ($contact->customer_service) { + if ((int)$id_customer_thread) { + $ct = new CustomerThread($id_customer_thread); + $ct->status = 'open'; + $ct->id_lang = (int)$this->context->language->id; + $ct->id_contact = (int)$id_contact; + $ct->id_order = (int)$id_order; + if ($id_product = (int)Tools::getValue('id_product')) { + $ct->id_product = $id_product; + } + $ct->update(); + } else { + $ct = new CustomerThread(); + if (isset($customer->id)) { + $ct->id_customer = (int)$customer->id; + } + $ct->id_shop = (int)$this->context->shop->id; + $ct->id_order = (int)$id_order; + if ($id_product = (int)Tools::getValue('id_product')) { + $ct->id_product = $id_product; + } + $ct->id_contact = (int)$id_contact; + $ct->id_lang = (int)$this->context->language->id; + $ct->email = $from; + $ct->status = 'open'; + $ct->token = Tools::passwdGen(12); + $ct->add(); } - $ct->update(); - } else { - $ct = new CustomerThread(); - if (isset($customer->id)) { - $ct->id_customer = (int)$customer->id; - } - $ct->id_shop = (int)$this->context->shop->id; - $ct->id_order = (int)$id_order; - if ($id_product = (int)Tools::getValue('id_product')) { - $ct->id_product = $id_product; - } - $ct->id_contact = (int)$id_contact; - $ct->id_lang = (int)$this->context->language->id; - $ct->email = $from; - $ct->status = 'open'; - $ct->token = Tools::passwdGen(12); - $ct->add(); - } - if ($ct->id) { - $cm = new CustomerMessage(); - $cm->id_customer_thread = $ct->id; - $cm->message = $message; - if (isset($file_attachment['rename']) && !empty($file_attachment['rename']) && rename($file_attachment['tmp_name'], _PS_UPLOAD_DIR_.basename($file_attachment['rename']))) { - $cm->file_name = $file_attachment['rename']; - @chmod(_PS_UPLOAD_DIR_.basename($file_attachment['rename']), 0664); - } - $cm->ip_address = (int)ip2long(Tools::getRemoteAddr()); - $cm->user_agent = $_SERVER['HTTP_USER_AGENT']; - if (!$cm->add()) { - $this->errors[] = Tools::displayError('An error occurred while sending the message.'); - } - } else { - $this->errors[] = Tools::displayError('An error occurred while sending the message.'); - } - } - - if (!count($this->errors)) { - $var_list = array( - '{order_name}' => '-', - '{attached_file}' => '-', - '{message}' => Tools::nl2br(stripslashes($message)), - '{email}' => $from, - '{product_name}' => '', - ); - - if (isset($file_attachment['name'])) { - $var_list['{attached_file}'] = $file_attachment['name']; - } - - $id_product = (int)Tools::getValue('id_product'); - - if (isset($ct) && Validate::isLoadedObject($ct) && $ct->id_order) { - $order = new Order((int)$ct->id_order); - $var_list['{order_name}'] = $order->getUniqReference(); - $var_list['{id_order}'] = (int)$order->id; - } - - if ($id_product) { - $product = new Product((int)$id_product); - if (Validate::isLoadedObject($product) && isset($product->name[Context::getContext()->language->id])) { - $var_list['{product_name}'] = $product->name[Context::getContext()->language->id]; - } - } - - if (!empty($contact->email)) { - if (!Mail::Send($this->context->language->id, 'contact', Mail::l('Message from contact form').' [no_sync]', - $var_list, $contact->email, $contact->name, null, null, - $file_attachment, null, _PS_MAIL_DIR_, false, null, null, $from)) { + if ($ct->id) { + $cm = new CustomerMessage(); + $cm->id_customer_thread = $ct->id; + $cm->message = $message; + if (isset($file_attachment['rename']) && !empty($file_attachment['rename']) && rename($file_attachment['tmp_name'], _PS_UPLOAD_DIR_.basename($file_attachment['rename']))) { + $cm->file_name = $file_attachment['rename']; + @chmod(_PS_UPLOAD_DIR_.basename($file_attachment['rename']), 0664); + } + $cm->ip_address = (int)ip2long(Tools::getRemoteAddr()); + $cm->user_agent = $_SERVER['HTTP_USER_AGENT']; + if (!$cm->add()) { + $this->errors[] = Tools::displayError('An error occurred while sending the message.'); + } + } else { $this->errors[] = Tools::displayError('An error occurred while sending the message.'); } } - } - if (count($this->errors) > 1) { - array_unique($this->errors); - } elseif (!count($this->errors)) { - $this->context->smarty->assign('confirmation', 1); + if (!count($this->errors)) { + $var_list = array( + '{order_name}' => '-', + '{attached_file}' => '-', + '{message}' => Tools::nl2br(stripslashes($message)), + '{email}' => $from, + '{product_name}' => '', + ); + + if (isset($file_attachment['name'])) { + $var_list['{attached_file}'] = $file_attachment['name']; + } + + $id_product = (int)Tools::getValue('id_product'); + + if (isset($ct) && Validate::isLoadedObject($ct) && $ct->id_order) { + $order = new Order((int)$ct->id_order); + $var_list['{order_name}'] = $order->getUniqReference(); + $var_list['{id_order}'] = (int)$order->id; + } + + if ($id_product) { + $product = new Product((int)$id_product); + if (Validate::isLoadedObject($product) && isset($product->name[Context::getContext()->language->id])) { + $var_list['{product_name}'] = $product->name[Context::getContext()->language->id]; + } + } + + if (!empty($contact->email)) { + if (!Mail::Send($this->context->language->id, 'contact', Mail::l('Message from contact form').' [no_sync]', + $var_list, $contact->email, $contact->name, null, null, + $file_attachment, null, _PS_MAIL_DIR_, false, null, null, $from)) { + $this->errors[] = Tools::displayError('An error occurred while sending the message.'); + } + } + } + + if (count($this->errors) > 1) { + array_unique($this->errors); + } elseif (!count($this->errors)) { + Tools::redirect($this->context->link->getPageLink('contact', null, null, array('confirm' => 1))); + } } } } @@ -312,6 +312,10 @@ class ContactControllerCore extends FrontController } } //End + + if (Tools::getValue('confirm')) { + $this->context->smarty->assign('confirmation', 1); + } $this->setTemplate(_PS_THEME_DIR_.'contact-form.tpl'); } diff --git a/themes/hotel-reservation-theme/contact-form.tpl b/themes/hotel-reservation-theme/contact-form.tpl index 6e7cbdc7e..9c16eca35 100644 --- a/themes/hotel-reservation-theme/contact-form.tpl +++ b/themes/hotel-reservation-theme/contact-form.tpl @@ -45,174 +45,173 @@ -{else} - {include file="$tpl_dir./errors.tpl"} -
-
-

{l s='Contact Us'}

-

{l s='Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry`s standard dummy text.'}

-
-
- {if (isset($gblHtlAddress) && $gblHtlAddress) && (isset($gblHtlPhone) && $gblHtlPhone) && (isset($gblHtlEmail) && $gblHtlEmail)} -
-
- {if isset($gblHtlPhone) && $gblHtlPhone } -
-

{l s='Main Branch'}

-

- {$gblHtlAddress} -

-
- {/if} - {if isset($gblHtlPhone) && $gblHtlPhone} -
-

{l s='Phone'}

-

- {$gblHtlPhone} -

-
- {/if} - {if isset($gblHtlEmail) && $gblHtlEmail} -
-

{l s='Mail Us'}

-

- {$gblHtlEmail} -

-
- {/if} -
-
- {/if} -
-
- {if isset($customerThread.id_contact) && $customerThread.id_contact && $contacts|count} - {assign var=flag value=true} - {foreach from=$contacts item=contact} - {if $contact.id_contact == $customerThread.id_contact} - - - {$flag=false} - {/if} - {/foreach} - {if $flag && isset($contacts.0.id_contact)} - - - {/if} - {else} -
-
- - -
+{/if} +{include file="$tpl_dir./errors.tpl"} +
+
+

{l s='Contact Us'}

+

{l s='Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry`s standard dummy text.'}

+
+
+ {if (isset($gblHtlAddress) && $gblHtlAddress) && (isset($gblHtlPhone) && $gblHtlPhone) && (isset($gblHtlEmail) && $gblHtlEmail)} +
+
+ {if isset($gblHtlPhone) && $gblHtlPhone } +
+

{l s='Main Branch'}

+

+ {$gblHtlAddress} +

{/if} -
-
- - {if isset($customerThread.email)} - - {else} - - {/if} + {if isset($gblHtlPhone) && $gblHtlPhone} +
+

{l s='Phone'}

+

+ {$gblHtlPhone} +

-
+ {/if} + {if isset($gblHtlEmail) && $gblHtlEmail} +
+

{l s='Mail Us'}

+

+ {$gblHtlEmail} +

+
+ {/if} +
+
+ {/if} +
+ + {if isset($customerThread.id_contact) && $customerThread.id_contact && $contacts|count} + {assign var=flag value=true} + {foreach from=$contacts item=contact} + {if $contact.id_contact == $customerThread.id_contact} + + + {$flag=false} + {/if} + {/foreach} + {if $flag && isset($contacts.0.id_contact)} + + + {/if} + {else}
- -
-
- {if $fileupload == 1} -
-
- - - +
- {/if} - {hook h='displayGDPRConsent' moduleName='contactform'} -
- - -
- + {/if} +
+
+ + {if isset($customerThread.email)} + + {else} + + {/if} +
+
+
+
+ + +
+
+ {if $fileupload == 1} +
+
+ + + +
+
+ {/if} + {hook h='displayGDPRConsent' moduleName='contactform'} +
+ + + +
+ +
+
+ {if isset($hotelsInfo) && $hotelsInfo} +
+
+ {l s='Our Hotels'} +
+ {foreach $hotelsInfo as $hotel} +
+
+ {$hotel['city']} +
+
+
+ +
+
+

{$hotel['hotel_name']}

+

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

+ {if $hotel['latitude'] != 0 || $hotel['longitude'] != 0} +

+ + {l s='View on map'} + +

+ {/if} +

+ {$hotel['phone']} +

+

+ {$hotel['email']} +

+
+
+
+ {/foreach} +
+ {/if} + {if isset($hotelLocationArray)} +
+
+
- {if isset($hotelsInfo) && $hotelsInfo} -
-
- {l s='Our Hotels'} -
- {foreach $hotelsInfo as $hotel} -
-
- {$hotel['city']} -
-
-
- -
-
-

{$hotel['hotel_name']}

-

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

- {if $hotel['latitude'] != 0 || $hotel['longitude'] != 0} -

- - {l s='View on map'} - -

- {/if} -

- {$hotel['phone']} -

-

- {$hotel['email']} -

-
-
-
- {/foreach} -
- {/if} - {if isset($hotelLocationArray)} -
-
-
-
-
- {/if} -
-
-{/if} + {/if} +
+
{strip} {addJsDefL name='contact_fileDefaultHtml'}{l s='No file selected' js=1}{/addJsDefL} From 4d67e38fa0b9a43c1b03269807475176632148e9 Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Tue, 30 Apr 2024 18:19:32 +0530 Subject: [PATCH 05/29] 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 @@ -

{l s='Please note that position numbering starts from 0. A position of 0 means room type will be displayed at the topmost.'}

+

{l s='Please note that position numbering starts from 0. A position of 0 means room type will be displayed at the topmost position.'}

+
+ {l s='You can manage positions of the room types of this hotel from'} + {l s='here.'} +
{/if} - {if isset($product->id) && $product->id} -
- {l s='You can change positions of room types of this hotel from '} - {l s='here.'} -
- {/if} - {*