Merge branch 'develop' into gli-2721

This commit is contained in:
vishalsingh.qlo325
2025-06-12 18:56:42 +05:30
54 changed files with 532 additions and 360 deletions

View File

@@ -1034,7 +1034,7 @@ class CartCore extends ObjectModel
$shop = Context::getContext()->shop;
}
if (Context::getContext()->customer->id) {
if (!empty(Context::getContext()->customer->id)) {
if ($id_address_delivery == 0 && (int)$this->id_address_delivery) { // The $id_address_delivery is null, use the cart delivery address
$id_address_delivery = $this->id_address_delivery;
} elseif (!Customer::customerHasAddress(Context::getContext()->customer->id, $id_address_delivery)) { // The $id_address_delivery must be linked with customer
@@ -2432,7 +2432,7 @@ class CartCore extends ObjectModel
$array[$selectedProduct['id_room_type_hotel']]['total_price_tax_incl'] += $selectedProduct['total_price_tax_incl'];
} else {
$array[$selectedProduct['id_room_type_hotel']] = array(
'quantity' => 0,
'quantity' => $selectedProduct['quantity'],
'id_hotel' => $selectedProduct['id_room_type_hotel'],
'total_price_tax_excl' => $selectedProduct['total_price_tax_excl'],
'total_price_tax_incl' => $selectedProduct['total_price_tax_incl'],
@@ -2452,35 +2452,37 @@ class CartCore extends ObjectModel
}
}
foreach($array as $selectedProduct) {
$product['cart_quantity'] = $selectedProduct['quantity'];
$product['total'] = $selectedProduct['total_price_tax_excl'];
$product['total_wt'] = $selectedProduct['total_price_tax_incl'];
$product['price_wt'] = $selectedProduct['total_price_tax_incl'] / $selectedProduct['quantity'];
$product['price'] = $selectedProduct['total_price_tax_excl'] / $selectedProduct['quantity'];
$product['id_hotel'] = $selectedProduct['id_hotel'];
$product['id_room_type'] = $selectedProduct['id_room_type'];
$product['id_hotel_cart_booking'] = $selectedProduct['id_hotel_cart_booking'];
$productinfo = $product;
$productinfo['selling_preference_type'] = Product::SELLING_PREFERENCE_WITH_ROOM_TYPE;
$orderPackage[$id_address][$selectedProduct['id_hotel']]['product_list'][] = $productinfo;
if (!isset($orderPackage[$id_address][$selectedProduct['id_hotel']]['id_hotel'])) {
$orderPackage[$id_address][$selectedProduct['id_hotel']]['id_hotel'] = $selectedProduct['id_hotel'];
}
if (!isset($orderPackage[$id_address][$selectedProduct['id_hotel']]['carrier_list'])) {
$orderPackage[$id_address][$selectedProduct['id_hotel']]['carrier_list'] = $product['carrier_list'];
} else {
$orderPackage[$id_address][$selectedProduct['id_hotel']]['carrier_list'] = array_intersect($orderPackage[$id_address][$selectedProduct['id_hotel']]['carrier_list'], $product['carrier_list']);
}
if (!isset($orderPackage[$id_address][$selectedProduct['id_hotel']]['warehouse_list'])) {
$orderPackage[$id_address][$selectedProduct['id_hotel']]['warehouse_list'] = $package['warehouse_list'];
}
if (!isset($orderPackage[$id_address][$selectedProduct['id_hotel']]['id_warehouse'])) {
$orderPackage[$id_address][$selectedProduct['id_hotel']]['id_warehouse'] = $package['id_warehouse'];
}
if (isset($package['id_carrier'])) {
if (!isset($orderPackage[$id_address][$selectedProduct['id_hotel']]['id_carrier'])) {
$orderPackage[$id_address][$selectedProduct['id_hotel']]['id_carrier'] = $package['id_carrier'];
if ($array) {
foreach($array as $selectedProduct) {
$product['cart_quantity'] = $selectedProduct['quantity'];
$product['total'] = $selectedProduct['total_price_tax_excl'];
$product['total_wt'] = $selectedProduct['total_price_tax_incl'];
$product['price_wt'] = $selectedProduct['total_price_tax_incl'] / $selectedProduct['quantity'];
$product['price'] = $selectedProduct['total_price_tax_excl'] / $selectedProduct['quantity'];
$product['id_hotel'] = $selectedProduct['id_hotel'];
$product['id_room_type'] = $selectedProduct['id_room_type'];
$product['id_hotel_cart_booking'] = $selectedProduct['id_hotel_cart_booking'];
$productinfo = $product;
$productinfo['selling_preference_type'] = Product::SELLING_PREFERENCE_WITH_ROOM_TYPE;
$orderPackage[$id_address][$selectedProduct['id_hotel']]['product_list'][] = $productinfo;
if (!isset($orderPackage[$id_address][$selectedProduct['id_hotel']]['id_hotel'])) {
$orderPackage[$id_address][$selectedProduct['id_hotel']]['id_hotel'] = $selectedProduct['id_hotel'];
}
if (!isset($orderPackage[$id_address][$selectedProduct['id_hotel']]['carrier_list'])) {
$orderPackage[$id_address][$selectedProduct['id_hotel']]['carrier_list'] = $product['carrier_list'];
} else {
$orderPackage[$id_address][$selectedProduct['id_hotel']]['carrier_list'] = array_intersect($orderPackage[$id_address][$selectedProduct['id_hotel']]['carrier_list'], $product['carrier_list']);
}
if (!isset($orderPackage[$id_address][$selectedProduct['id_hotel']]['warehouse_list'])) {
$orderPackage[$id_address][$selectedProduct['id_hotel']]['warehouse_list'] = $package['warehouse_list'];
}
if (!isset($orderPackage[$id_address][$selectedProduct['id_hotel']]['id_warehouse'])) {
$orderPackage[$id_address][$selectedProduct['id_hotel']]['id_warehouse'] = $package['id_warehouse'];
}
if (isset($package['id_carrier'])) {
if (!isset($orderPackage[$id_address][$selectedProduct['id_hotel']]['id_carrier'])) {
$orderPackage[$id_address][$selectedProduct['id_hotel']]['id_carrier'] = $package['id_carrier'];
}
}
}
}
@@ -2528,38 +2530,41 @@ class CartCore extends ObjectModel
);
}
}
foreach($array as $hotelProduct) {
$serviceProduct = $product;
$serviceProduct['cart_quantity'] = $hotelProduct['quantity'];
$serviceProduct['id_hotel'] = $hotelProduct['id_hotel'];
$serviceProduct['total'] = $hotelProduct['total_price_tax_excl'];
$serviceProduct['total_wt'] = $hotelProduct['total_price_tax_incl'];
$serviceProduct['price'] = $hotelProduct['total_price_tax_excl'] / $hotelProduct['quantity'];
$serviceProduct['price_wt'] = $hotelProduct['total_price_tax_incl'] / $hotelProduct['quantity'];
$serviceProduct['id_room_type'] = $hotelProduct['id_room_type'];
$serviceProduct['id_hotel_cart_booking'] = $hotelProduct['id_hotel_cart_booking'];
// if (!empty($hotelProducts['products'])) {
// foreach($hotelProducts['products'] as $hotelProduct) {
$productinfo = $serviceProduct;
$productinfo['selling_preference_type'] = Product::SELLING_PREFERENCE_HOTEL_STANDALONE;
$orderPackage[$id_address][$hotelProduct['id_hotel']]['product_list'][] = $productinfo;
if (!isset($orderPackage[$id_address][$hotelProduct['id_hotel']]['id_hotel'])) {
$orderPackage[$id_address][$hotelProduct['id_hotel']]['id_hotel'] = $hotelProduct['id_hotel'];
}
if (!isset($orderPackage[$id_address][$hotelProduct['id_hotel']]['carrier_list'])) {
$orderPackage[$id_address][$hotelProduct['id_hotel']]['carrier_list'] = $product['carrier_list'];
} else {
$orderPackage[$id_address][$hotelProduct['id_hotel']]['carrier_list'] = array_intersect($orderPackage[$id_address][$hotelProduct['id_hotel']]['carrier_list'], $product['carrier_list']);
}
if (!isset($orderPackage[$id_address][$hotelProduct['id_hotel']]['warehouse_list'])) {
$orderPackage[$id_address][$hotelProduct['id_hotel']]['warehouse_list'] = $package['warehouse_list'];
}
if (!isset($orderPackage[$id_address][$hotelProduct['id_hotel']]['id_warehouse'])) {
$orderPackage[$id_address][$hotelProduct['id_hotel']]['id_warehouse'] = $package['id_warehouse'];
}
if (isset($package['id_carrier'])) {
if (!isset($orderPackage[$id_address][$hotelProduct['id_hotel']]['id_carrier'])) {
$orderPackage[$id_address][$hotelProduct['id_hotel']]['id_carrier'] = $package['id_carrier'];
if ($array) {
foreach($array as $hotelProduct) {
$serviceProduct = $product;
$serviceProduct['cart_quantity'] = $hotelProduct['quantity'];
$serviceProduct['id_hotel'] = $hotelProduct['id_hotel'];
$serviceProduct['total'] = $hotelProduct['total_price_tax_excl'];
$serviceProduct['total_wt'] = $hotelProduct['total_price_tax_incl'];
$serviceProduct['price'] = $hotelProduct['total_price_tax_excl'] / $hotelProduct['quantity'];
$serviceProduct['price_wt'] = $hotelProduct['total_price_tax_incl'] / $hotelProduct['quantity'];
$serviceProduct['id_room_type'] = $hotelProduct['id_room_type'];
$serviceProduct['id_hotel_cart_booking'] = $hotelProduct['id_hotel_cart_booking'];
// if (!empty($hotelProducts['products'])) {
// foreach($hotelProducts['products'] as $hotelProduct) {
$productinfo = $serviceProduct;
$productinfo['selling_preference_type'] = Product::SELLING_PREFERENCE_HOTEL_STANDALONE;
$orderPackage[$id_address][$hotelProduct['id_hotel']]['product_list'][] = $productinfo;
if (!isset($orderPackage[$id_address][$hotelProduct['id_hotel']]['id_hotel'])) {
$orderPackage[$id_address][$hotelProduct['id_hotel']]['id_hotel'] = $hotelProduct['id_hotel'];
}
if (!isset($orderPackage[$id_address][$hotelProduct['id_hotel']]['carrier_list'])) {
$orderPackage[$id_address][$hotelProduct['id_hotel']]['carrier_list'] = $product['carrier_list'];
} else {
$orderPackage[$id_address][$hotelProduct['id_hotel']]['carrier_list'] = array_intersect($orderPackage[$id_address][$hotelProduct['id_hotel']]['carrier_list'], $product['carrier_list']);
}
if (!isset($orderPackage[$id_address][$hotelProduct['id_hotel']]['warehouse_list'])) {
$orderPackage[$id_address][$hotelProduct['id_hotel']]['warehouse_list'] = $package['warehouse_list'];
}
if (!isset($orderPackage[$id_address][$hotelProduct['id_hotel']]['id_warehouse'])) {
$orderPackage[$id_address][$hotelProduct['id_hotel']]['id_warehouse'] = $package['id_warehouse'];
}
if (isset($package['id_carrier'])) {
if (!isset($orderPackage[$id_address][$hotelProduct['id_hotel']]['id_carrier'])) {
$orderPackage[$id_address][$hotelProduct['id_hotel']]['id_carrier'] = $package['id_carrier'];
}
}
}
}

View File

@@ -652,7 +652,7 @@ class DispatcherCore
if (!isset($this->routes[$id_shop][$id_lang][$route_id])) {
$query = http_build_query($params, '', '&');
$index_link = $this->use_routes ? '' : 'index.php';
return ($route_id == 'index') ? $index_link.(($query) ? '?'.$query : '') : ((trim($route_id) == '') ? '' : 'index.php?controller='.$route_id).(($query) ? '&'.$query : '').$anchor;
return ($route_id == 'index') ? $index_link.(($query) ? '?'.$query : '') : ((!is_null($route_id) ? (trim($route_id) == '') : 1) ? '' : 'index.php?controller='.$route_id).(($query) ? '&'.$query : '').$anchor;
}
$route = $this->routes[$id_shop][$id_lang][$route_id];
// Check required fields

View File

@@ -621,7 +621,7 @@ abstract class PaymentModuleCore extends Module
$product_list_txt = '';
$product_list_html = '';
if (count($product_var_tpl_list) > 0) {
$product_list_txt = $this->getEmailTemplateContent('order_conf_product_list.txt', Mail::TYPE_TEXT, $product_var_tpl_list);
$product_list_txt = $this->getEmailTemplateContent('order_conf_product_list_text.tpl', Mail::TYPE_TEXT, $product_var_tpl_list);
$product_list_html = $this->getEmailTemplateContent('order_conf_product_list.tpl', Mail::TYPE_HTML, $product_var_tpl_list);
}
@@ -698,7 +698,7 @@ abstract class PaymentModuleCore extends Module
$cart_rules_list_txt = '';
$cart_rules_list_html = '';
if (count($cart_rules_list) > 0) {
$cart_rules_list_txt = $this->getEmailTemplateContent('order_conf_cart_rules.txt', Mail::TYPE_TEXT, $cart_rules_list);
$cart_rules_list_txt = $this->getEmailTemplateContent('order_conf_cart_rules_text.tpl', Mail::TYPE_TEXT, $cart_rules_list);
$cart_rules_list_html = $this->getEmailTemplateContent('order_conf_cart_rules.tpl', Mail::TYPE_HTML, $cart_rules_list);
}
@@ -1342,6 +1342,7 @@ abstract class PaymentModuleCore extends Module
'{products_txt}' => $product_list_txt,
'{discounts}' => $cart_rules_list_html,
'{discounts_txt}' => $cart_rules_list_txt,
'{total_paid}' => Tools::displayPrice($order->total_paid, $this->context->currency, false),
'{total_products}' => Tools::displayPrice($total_products, $this->context->currency, false),
'{total_discounts}' => Tools::displayPrice(-$order->total_discounts, $this->context->currency, false),
'{total_shipping}' => Tools::displayPrice($order->total_shipping, $this->context->currency, false),

View File

@@ -326,9 +326,10 @@ class OrderReturnCore extends ObjectModel
*/
public function getOrderRefundRequestedProducts($idOrder, $idOrderReturn = 0, $onlyIds = 0, $skipReqCompletedNonRefunded = 0)
{
$sql = 'SELECT spod.*, ord.*, orr.`state` as id_return_state FROM `'._DB_PREFIX_.'order_return` orr';
$sql = 'SELECT spod.*, ord.*, orr.`state` as id_return_state, p.`allow_multiple_quantity` FROM `'._DB_PREFIX_.'order_return` orr';
$sql .= ' INNER JOIN `'._DB_PREFIX_.'order_return_detail` ord ON (orr.`id_order_return` = ord.`id_order_return`)';
$sql .= ' INNER JOIN `'._DB_PREFIX_.'service_product_order_detail` spod ON (spod.`id_service_product_order_detail` = ord.`id_service_product_order_detail`)';
$sql .= ' LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = spod.`id_product`)';
$sql .= ' WHERE orr.`id_order` = '.(int)$idOrder;
if ($idOrderReturn) {
@@ -368,7 +369,7 @@ class OrderReturnCore extends ObjectModel
}
$sql = 'SELECT orr.`id_order`, orr.`state`, orr.`id_order_return`, orr.`payment_mode`, orr.`id_transaction`,
orr.`id_return_type`, orr.`return_type`, ors.`id_cart_rule`, orr.`date_add`, orr.`date_upd`, orr.`refunded_amount`,
hbd.`is_cancelled`, SUM(IF(ord.`id_htl_booking`, 1, 0)) AS total_rooms
hbd.`is_cancelled`, SUM(IF(ord.`id_htl_booking`, 1, 0)) AS total_rooms, SUM(IF(ord.`id_service_product_order_detail`, 1, 0)) AS total_products
FROM `'._DB_PREFIX_.'order_return` orr
LEFT JOIN `'._DB_PREFIX_.'order_return_detail` ord
ON (ord.`id_order_return` = orr.`id_order_return`)

View File

@@ -318,25 +318,31 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
if (Module::isInstalled('hotelreservationsystem')) {
$obj_htl_bk_dtl = new HotelBookingDetail();
$objServiceProductOrderDetail = new ServiceProductOrderDetail();
$objHotelBranchInfo = new HotelBranchInformation((int) HotelBookingDetail::getIdHotelByIdOrder($order_obj->id), $context->language->id);
$invoiceAddressPatternRules['avoid'][] = 'lastname';
if ($idHotelAddress = $objHotelBranchInfo->getHotelIdAddress()) {
$objHotelAddress = new Address((int) $idHotelAddress);
$objHotelAddress->firstname = $objHotelBranchInfo->hotel_name;
$formattedHotelAddress = AddressFormat::generateAddress($objHotelAddress, $invoiceAddressPatternRules, '<br />', ' ');
if ($idHotel = HotelBookingDetail::getIdHotelByIdOrder($order_obj->id)) {
$objHotelBranchInfo = new HotelBranchInformation((int) $idHotel, $context->language->id);
$invoiceAddressPatternRules['avoid'][] = 'lastname';
if ($idHotelAddress = $objHotelBranchInfo->getHotelIdAddress()) {
$objHotelAddress = new Address((int) $idHotelAddress);
$objHotelAddress->firstname = $objHotelBranchInfo->hotel_name;
$formattedHotelAddress = AddressFormat::generateAddress($objHotelAddress, $invoiceAddressPatternRules, '<br />', ' ');
}
}
$customer = new Customer($this->order->id_customer);
$idCustomer = 0;
if (ValidateCore::isLoadedObject($customer = new Customer($this->order->id_customer))) {
$idCustomer = $customer->id;
}
if (!empty($order_details)) {
$processed_product = array();
$totalDemandsPriceTE = 0;
$totalDemandsPriceTI = 0;
foreach ($order_details as $type_key => $type_value) {
$processProuctKey = $type_value['product_id'].'_'.$type_value['selling_preference_type'].'_'.$type_value['id_order_detail'];
if (isset($processed_product[$processProuctKey])) {
$processProductKey = $type_value['product_id'].'_'.$type_value['selling_preference_type'].'_'.$type_value['id_order_detail'];
if (isset($processed_product[$processProductKey])) {
continue;
}
$processed_product[$processProuctKey] = $type_value['product_id'];
$processed_product[$processProductKey] = $type_value['product_id'];
if ($type_value['is_booking_product']) {
if ($display_product_images) {
@@ -352,14 +358,7 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
$cart_htl_data[$type_key]['cover_img'] = $cover_img;
}
if ($type_value)
if (isset($customer->id)) {
$cart_obj = new Cart($this->order->id_cart);
$order_bk_data = $obj_htl_bk_dtl->getOnlyOrderBookingData($this->order->id, $cart_obj->id_guest, $type_value['product_id'], $customer->id);
} else {
$order_bk_data = $obj_htl_bk_dtl->getOnlyOrderBookingData($this->order->id, $customer->id_guest, $type_value['product_id'], 0);
}
$order_bk_data = $obj_htl_bk_dtl->getOnlyOrderBookingData($this->order->id, 0, $type_value['product_id'], $idCustomer, $type_value['id_order_detail']);
$cart_htl_data[$type_key]['id_product'] = $type_value['product_id'];
$objBookingDemand = new HotelBookingDemands();
foreach ($order_bk_data as $data_k => $data_v) {
@@ -580,10 +579,7 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
0,
$data_v['id']
)) {
$additionalServices['product_id'] = $type_value['product_id'];
$additionalServices['room_type_name'] = $type_value['product_name'];
$additionalServices['date_from'] = $data_v['date_from'];
$additionalServices['date_to'] = $data_v['date_to'];
$additionalServices[$data_v['id']]['product_id'] = $type_value['product_id'];
$room_additinal_services[] = $additionalServices[$data_v['id']];
}