added use reduct in get service product price function, removed hotel details from invoice for orders without hotel, fixed some minor issues
This commit is contained in:
@@ -1740,6 +1740,7 @@
|
||||
$('#room_type_services_desc').show();
|
||||
$('#add_new_room_services_block').hide();
|
||||
$('#back_to_service_btn').hide();
|
||||
$('#btn_new_room_service').show();
|
||||
});
|
||||
|
||||
// Add new custom service: Show hide new custom service form
|
||||
@@ -1747,6 +1748,7 @@
|
||||
$('#add_new_room_services_block').show();
|
||||
$('#back_to_service_btn').show();
|
||||
$('#room_type_services_desc').hide();
|
||||
$('#btn_new_room_service').hide();
|
||||
});
|
||||
|
||||
// Add new custom service: change auto added option
|
||||
|
||||
@@ -318,12 +318,15 @@ 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);
|
||||
@@ -580,10 +583,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']];
|
||||
}
|
||||
|
||||
|
||||
@@ -986,14 +986,12 @@ class AdminOrdersControllerCore extends AdminController
|
||||
}
|
||||
|
||||
if ($serviceProducts) {
|
||||
if ($additionalServices) {
|
||||
foreach ($serviceProducts as $key => $servProduct) {
|
||||
$serviceProducts[$key]['price_tax_exc'] = $servProduct['price'];
|
||||
if (isset($additionalServices[$productLineData['id']])
|
||||
&& in_array($servProduct['id_product'], array_column($additionalServices[$productLineData['id']]['additional_services'], 'id_product'))
|
||||
) {
|
||||
unset($serviceProducts[$key]);
|
||||
}
|
||||
foreach ($serviceProducts as $key => $servProduct) {
|
||||
$serviceProducts[$key]['price_tax_exc'] = $servProduct['price'];
|
||||
if (isset($additionalServices[$productLineData['id']])
|
||||
&& in_array($servProduct['id_product'], array_column($additionalServices[$productLineData['id']]['additional_services'], 'id_product'))
|
||||
) {
|
||||
unset($serviceProducts[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1017,6 +1015,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$smartyVars['taxRulesGroups'] = $taxRulesGroups;
|
||||
$smartyVars['invoices_collection'] = $objOrder->getInvoicesCollection();
|
||||
$smartyVars['customServiceAllowed'] = Configuration::get('PS_ALLOW_CREATE_CUSTOM_SERVICES_IN_BOOKING');
|
||||
$smartyVars['current_id_lang'] = $this->context->language->id;
|
||||
|
||||
$this->context->smarty->assign($smartyVars);
|
||||
|
||||
|
||||
@@ -891,6 +891,14 @@ class ProductControllerCore extends FrontController
|
||||
$useTax,
|
||||
$quantity
|
||||
);
|
||||
$smartyVars['service_price_without_reduction'] = RoomTypeServiceProductPrice::getPrice(
|
||||
$this->product->id,
|
||||
$idHotel,
|
||||
$idProductOption,
|
||||
$useTax,
|
||||
$quantity,
|
||||
false
|
||||
);
|
||||
if ($quantity) {
|
||||
$smartyVars['quantity'] = $quantity;
|
||||
}
|
||||
|
||||
@@ -113,17 +113,18 @@ class RoomTypeServiceProductPrice extends ObjectModel
|
||||
$idHotel,
|
||||
$idProductOption = null,
|
||||
$useTax = null,
|
||||
$quantity = 1
|
||||
$quantity = 1,
|
||||
$useReduc = true
|
||||
) {
|
||||
$idHotelAddress = Cart::getIdAddressForTaxCalculation($idProduct, $idHotel);
|
||||
$price = ProductCore::getPriceStatic(
|
||||
$price = Product::getPriceStatic(
|
||||
$idProduct,
|
||||
$useTax,
|
||||
$idProductOption,
|
||||
6,
|
||||
null,
|
||||
false,
|
||||
true,
|
||||
$useReduc,
|
||||
$quantity,
|
||||
false,
|
||||
null,
|
||||
|
||||
@@ -140,15 +140,15 @@ class ServiceProductOrderDetail extends ObjectModel
|
||||
|
||||
$sql = 'SELECT spod.*';
|
||||
if (!$getTotalPrice) {
|
||||
$sql .= ', hbd.`id_product` as `id_room_type`, od.`product_allow_multiple_quantity`, od.`product_price_calculation_method`,
|
||||
hbd.`id_room`, hbd.`adults`, hbd.`children`, hbd.`id_product`, hbd.`date_from`, hbd.`date_to`, hbd.`room_type_name`,
|
||||
$sql .= ', hbd.`id_product` as `id_room_type`, od.`product_price_calculation_method`,
|
||||
hbd.`id_room`, hbd.`adults`, hbd.`children`, hbd.`date_from`, hbd.`date_to`, hbd.`room_type_name`,
|
||||
spod.`id_product` as id_product, od.`product_allow_multiple_quantity`, od.`product_price_calculation_method`, od.`product_auto_add`, od.`product_price_addition_type`';
|
||||
}
|
||||
$sql .= ' FROM `'._DB_PREFIX_.'htl_booking_detail` hbd
|
||||
LEFT JOIN `'._DB_PREFIX_.'service_product_order_detail` spod ON(spod.`id_htl_booking_detail` = hbd.`id`)';
|
||||
|
||||
$sql .= ' LEFT JOIN `'._DB_PREFIX_.'order_detail` od ON(od.`id_order_detail` = spod.`id_order_detail`)';
|
||||
$sql .= ' WHERE 1';
|
||||
$sql .= ' WHERE spod.`id_htl_booking_detail` IS NOT NULL';
|
||||
|
||||
if ($idOrder) {
|
||||
$sql .= ' AND spod.`id_order` = '.(int)$idOrder;
|
||||
|
||||
@@ -32,8 +32,8 @@
|
||||
{/if}
|
||||
</td> -->
|
||||
<td width="33%">
|
||||
<span class="bold">{l s='Hotel Detail' pdf='true'}</span><br/><br/>
|
||||
{if $hotel_address}
|
||||
{if !empty($hotel_address)}
|
||||
<span class="bold">{l s='Hotel Detail' pdf='true'}</span><br/><br/>
|
||||
{$hotel_address}
|
||||
{/if}
|
||||
</td>
|
||||
|
||||
@@ -280,12 +280,12 @@
|
||||
<div class="total_price_block col-xs-7 form-group">
|
||||
<label class="control-label">{l s='Price'}</label>
|
||||
<p>
|
||||
{if $service_price && $service_price_without_reduction > $service_price}
|
||||
<span class="room_type_old_price">
|
||||
{convertPrice price=$service_price_without_reduction|floatval}
|
||||
</span>
|
||||
{/if}
|
||||
{convertPrice price=$service_price}
|
||||
{* {if !$priceDisplay || $priceDisplay == 2}
|
||||
{convertPrice price=$product->getPrice(true, $smarty.const.NULL, 6)|floatval}
|
||||
{elseif $priceDisplay == 1}
|
||||
{convertPrice price=$product->getPrice(false, $smarty.const.NULL, 6)|floatval}
|
||||
{/if} *}
|
||||
</p>
|
||||
</div>
|
||||
{/block}
|
||||
|
||||
Reference in New Issue
Block a user