Fixed: standalone product contains booking voucher having Rooms and Room type related fields
Co-authored-by: Name <azharbhat.qlo098@webkul.in>
This commit is contained in:
@@ -141,6 +141,8 @@ class HTMLTemplateBookingVoucherCore extends HTMLTemplate
|
||||
$serviceGroups = array();
|
||||
$roomTypeRows = array();
|
||||
|
||||
$objServiceProductOrderDetail = new ServiceProductOrderDetail();
|
||||
|
||||
foreach ($bookings as $booking) {
|
||||
$nights = (int)HotelHelper::getNumberOfDays($booking['date_from'], $booking['date_to']);
|
||||
if ($nights <= 0) {
|
||||
@@ -160,7 +162,6 @@ class HTMLTemplateBookingVoucherCore extends HTMLTemplate
|
||||
$bookingServices = array();
|
||||
|
||||
// Auto-added services bundled with room price (for cost calculation only)
|
||||
$objServiceProductOrderDetail = new ServiceProductOrderDetail();
|
||||
$autoAddedWithRoomPriceTaxExcl = (float)$objServiceProductOrderDetail->getRoomTypeServiceProducts(
|
||||
(int)$this->order->id, 0, 0,
|
||||
isset($booking['id_product']) ? (int)$booking['id_product'] : 0,
|
||||
@@ -245,6 +246,43 @@ class HTMLTemplateBookingVoucherCore extends HTMLTemplate
|
||||
}
|
||||
unset($roomTypeRow);
|
||||
|
||||
// --- Hotel products ---
|
||||
$hotelProducts = array();
|
||||
|
||||
$products = $objServiceProductOrderDetail->getServiceProductsInOrder(
|
||||
(int) $this->order->id,
|
||||
0,
|
||||
0,
|
||||
Product::SELLING_PREFERENCE_WITH_HOTEL
|
||||
);
|
||||
|
||||
if (is_array($products)) {
|
||||
foreach ($products as $product) {
|
||||
$taxLabel = self::l('No tax');
|
||||
if ($taxes = OrderDetail::getTaxListStatic((int) $product['id_order_detail'])) {
|
||||
$taxTemp = array();
|
||||
foreach ($taxes as $tax) {
|
||||
$objTax = new Tax($tax['id_tax']);
|
||||
$taxTemp[] = sprintf(self::l('%1$s%2$s%%'), $objTax->rate + 0, ' ');
|
||||
}
|
||||
$taxLabel = implode(', ', $taxTemp);
|
||||
}
|
||||
$hotelName = '';
|
||||
if (!empty($product['id_hotel'])) {
|
||||
$objProductHotel = new HotelBranchInformation((int) $product['id_hotel'], (int) $this->order->id_lang);
|
||||
$hotelName = $objProductHotel->hotel_name;
|
||||
}
|
||||
$hotelProducts[] = array(
|
||||
'name' => $product['name'].(!empty($product['option_name']) ? ' : '.$product['option_name'] : ''),
|
||||
'hotel_name' => $hotelName,
|
||||
'tax_label' => $taxLabel,
|
||||
'quantity' => (int) $product['quantity'],
|
||||
'unit_price_tax_excl' => (float) $product['unit_price_tax_excl'],
|
||||
'total_price_tax_excl' => (float) $product['total_price_tax_excl'],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$guestAddress = '';
|
||||
$guest = new Customer((int)$this->order->id_customer);
|
||||
|
||||
@@ -353,6 +391,7 @@ class HTMLTemplateBookingVoucherCore extends HTMLTemplate
|
||||
'total_room_nights' => (int)$totalRoomNights,
|
||||
'room_type_rows' => array_values($roomTypeRows),
|
||||
'service_groups' => $serviceGroups,
|
||||
'hotel_products' => $hotelProducts,
|
||||
'payment_method' => $paymentMethod,
|
||||
'footer' => $footer,
|
||||
'payment_policy' => $paymentPolicy,
|
||||
|
||||
@@ -560,6 +560,7 @@ class GuestTrackingControllerCore extends FrontController
|
||||
'refund_allowed' => false,
|
||||
'invoiceAllowed' => (int)Configuration::get('PS_INVOICE'),
|
||||
'is_guest' => true,
|
||||
'has_room_booking' => (bool) HotelBookingDetail::getIdHotelByIdOrder((int) $order->id, false),
|
||||
'group_use_tax' => (Group::getPriceDisplayMethod($customer->id_default_group) == PS_TAX_INC),
|
||||
'CUSTOMIZE_FILE' => Product::CUSTOMIZE_FILE,
|
||||
'CUSTOMIZE_TEXTFIELD' => Product::CUSTOMIZE_TEXTFIELD,
|
||||
|
||||
@@ -464,6 +464,7 @@ class OrderDetailControllerCore extends FrontController
|
||||
'deliveryAddressFormatedValues' => $deliveryAddressFormatedValues,
|
||||
'deliveryState' => (Validate::isLoadedObject($addressDelivery) && $addressDelivery->id_state) ? new State($addressDelivery->id_state) : false,
|
||||
'is_guest' => false,
|
||||
'has_room_booking' => (bool) HotelBookingDetail::getIdHotelByIdOrder((int) $order->id, false),
|
||||
'messages' => CustomerMessage::getMessagesByOrderId((int) $order->id, false),
|
||||
'CUSTOMIZE_FILE' => Product::CUSTOMIZE_FILE,
|
||||
'CUSTOMIZE_TEXTFIELD' => Product::CUSTOMIZE_TEXTFIELD,
|
||||
|
||||
@@ -59,6 +59,10 @@ class PdfBookingVoucherControllerCore extends FrontController
|
||||
die(Tools::displayError('The booking voucher was not found.'));
|
||||
}
|
||||
|
||||
if (!HotelBookingDetail::getIdHotelByIdOrder((int) $order->id, false)) {
|
||||
die(Tools::displayError('The booking voucher was not found.'));
|
||||
}
|
||||
|
||||
$this->order = $order;
|
||||
}
|
||||
|
||||
|
||||
@@ -198,6 +198,39 @@
|
||||
</tr>
|
||||
{/if}
|
||||
|
||||
{if $hotel_products}
|
||||
<tr>
|
||||
<td colspan="12" height="12"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="12">
|
||||
<table class="bordered-table" width="100%" cellpadding="5" cellspacing="0">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th colspan="5" class="header-left small">{l s='PRODUCTS DETAILS' pdf='true'}</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="header-left small" width="40%">{l s='Product Name' pdf='true'}</th>
|
||||
<th class="header-left small" width="12%">{l s='Tax' pdf='true'}</th>
|
||||
<th class="header-left small" width="18%">{l s='Unit Price (tax excl.)' pdf='true'}</th>
|
||||
<th class="header-left small" width="10%">{l s='Qty' pdf='true'}</th>
|
||||
<th class="header-left small" width="20%">{l s='Total (tax excl.)' pdf='true'}</th>
|
||||
</tr>
|
||||
{foreach from=$hotel_products item=product}
|
||||
<tr>
|
||||
<td class="small white" width="40%">{$product.name|escape:'html':'UTF-8'}{if $product.hotel_name}<br />{$product.hotel_name|escape:'html':'UTF-8'}{/if}</td>
|
||||
<td class="small white" width="12%">{$product.tax_label nofilter}</td>
|
||||
<td class="small white" width="18%">{displayPrice currency=$order->id_currency price=$product.unit_price_tax_excl}</td>
|
||||
<td class="small white" width="10%">{$product.quantity|intval}</td>
|
||||
<td class="small white" width="20%">{displayPrice currency=$order->id_currency price=$product.total_price_tax_excl}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
|
||||
</table>
|
||||
|
||||
<table width="100%" border="0" cellpadding="0" cellspacing="0" style="margin:0;"><tr><td height="12"> </td></tr></table>
|
||||
|
||||
@@ -148,6 +148,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{if $has_room_booking}
|
||||
<div class="detail-row">
|
||||
<div class=" title">{l s='Booking Voucher'}</div>
|
||||
<div class=" value payment-method">
|
||||
@@ -157,6 +158,7 @@
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<div class="detail-row">
|
||||
<div class="pull-left title">{l s='Status'}</div>
|
||||
@@ -673,6 +675,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{if $has_room_booking}
|
||||
<div class="detail-row">
|
||||
<div class=" title">{l s='Booking Voucher'}</div>
|
||||
<div class=" value payment-method">
|
||||
@@ -682,6 +685,7 @@
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<div class="detail-row">
|
||||
<div class="pull-left title">{l s='Status'}</div>
|
||||
|
||||
Reference in New Issue
Block a user