diff --git a/classes/pdf/HTMLTemplateInvoice.php b/classes/pdf/HTMLTemplateInvoice.php
index a277f4b66..4c0d096d9 100644
--- a/classes/pdf/HTMLTemplateInvoice.php
+++ b/classes/pdf/HTMLTemplateInvoice.php
@@ -329,17 +329,20 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
}
}
- $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) {
@@ -355,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) {