Merge branch 'develop' into gli-2486

This commit is contained in:
vishalsingh.qlo325
2025-05-15 13:06:24 +05:30
37 changed files with 1144 additions and 437 deletions

View File

@@ -109,7 +109,7 @@
</td>
<td>{displayWtPriceWithCurrency price=$room['feature_price_tax_excl'] currency=$currency}</td>
<td>
{if (isset($room['extra_demands']) && $room['extra_demands']) || (isset($room['additional_service']) && $room['additional_service'])}
{if (isset($room['selected_demands']) && $room['selected_demands']) || (isset($room['selected_services']) && $room['selected_services'])}
<a href="#" data-toggle="modal" data-target="#rooms_type_extra_demands_{$room['id']}">
{displayWtPriceWithCurrency price=($room['demand_price'] + $room['additional_service_price'] + $room['additional_services_auto_add_price'])|escape:'html':'UTF-8' currency=$currency}
</a>
@@ -118,7 +118,7 @@
{/if}
</td>
<td class="text-right">
{if (isset($room['extra_demands']) && $room['extra_demands']) || (isset($room['additional_service']) && $room['additional_service'])}
{if (isset($room['selected_demands']) && $room['selected_demands']) || (isset($room['selected_services']) && $room['selected_services'])}
{displayWtPriceWithCurrency price=($room['amt_with_qty'] + $room['additional_services_auto_add_price'] + $room['demand_price'] + $room['additional_service_price'])|escape:'html':'UTF-8' currency=$currency}
{else}
{displayWtPriceWithCurrency price=$room['amt_with_qty']|escape:'html':'UTF-8' currency=$currency}
@@ -166,7 +166,13 @@
</div>
</div>
<div class="col-xs-6">
<p><span class="pull-right extra_demand_option_price">{if isset($roomDemand['adv_option']) && $roomDemand['adv_option']}{convertPrice price = $roomDemand['adv_option'][$idGlobalDemand]['price']|escape:'html':'UTF-8'}{else}{convertPrice price = $roomDemand['price']|escape:'html':'UTF-8'}{/if}</span></p>
<p><span class="pull-right extra_demand_option_price">
{if isset($roomDemand['adv_option']) && $roomDemand['adv_option']}
{convertPrice price = $roomDemand['adv_option'][$demand['id_option']]['price']|escape:'html':'UTF-8'}
{else}
{convertPrice price = $roomDemand['price']|escape:'html':'UTF-8'}
{/if}
</span></p>
</div>
</div>
{/if}

View File

@@ -446,12 +446,11 @@
</label>
<div class="col-lg-9">
{include
file="controllers/products/textarea_lang.tpl"
file="controllers/normal_products/textarea_lang.tpl"
languages=$languages
input_name='description_short'
class="autoload_rte"
input_value=$product->description_short
max=$PS_PRODUCT_SHORT_DESC_LIMIT}
maxlength=$PS_SHORT_DESC_LIMIT}
</div>
</div>
{* <div class="form-group">

View File

@@ -357,7 +357,7 @@
languages=$languages
input_name='description_short'
input_value=$product->description_short
maxlength=$PS_PRODUCT_SHORT_DESC_LIMIT}
maxlength=$PS_SHORT_DESC_LIMIT}
</div>
</div>
<div class="form-group">

View File

@@ -733,11 +733,18 @@ class CartCore extends ObjectModel
$totalPriceByProductTaxExcl = 0;
$priceDisplay = Group::getPriceDisplayMethod(Group::getCurrent()->id);
foreach ($roomTypesByIdProduct as $key => $cartRoomInfo) {
$occupancy = array(
array(
'adults' => $cartRoomInfo['adults'],
'children' => $cartRoomInfo['children'],
'child_ages' => json_decode($cartRoomInfo['child_ages'])
)
);
$roomTotalPrice = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice(
$cartRoomInfo['id_product'],
$cartRoomInfo['date_from'],
$cartRoomInfo['date_to'],
0,
$occupancy,
Group::getCurrent()->id,
$cartRoomInfo['id_cart'],
$cartRoomInfo['id_guest'],
@@ -1780,12 +1787,19 @@ class CartCore extends ObjectModel
$totalPriceByProduct = 0;
$priceDisplay = Group::getPriceDisplayMethod(Group::getCurrent()->id);
foreach ($roomTypesByIdProduct as $key => $cartRoomInfo) {
$occupancy = array(
array(
'adults' => $cartRoomInfo['adults'],
'children' => $cartRoomInfo['children'],
'child_ages' => json_decode($cartRoomInfo['child_ages'])
)
);
// get the real price of the room type
$roomTotalPrice = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice(
$cartRoomInfo['id_product'],
$cartRoomInfo['date_from'],
$cartRoomInfo['date_to'],
0,
$occupancy,
Group::getCurrent()->id,
$cartRoomInfo['id_cart'],
$cartRoomInfo['id_guest'],

View File

@@ -43,6 +43,8 @@ class ConfigurationCore extends ObjectModel
/** @var string Object last modification date */
public $date_upd;
const PS_SHORT_DESC_LIMIT = 400;
/**
* @see ObjectModel::$definition
*/

View File

@@ -808,11 +808,18 @@ abstract class PaymentModuleCore extends Module
$objBookingDetail->is_back_order = $objCartBookingData->is_back_order;
$objBookingDetail->comment = $objCartBookingData->comment;
$occupancy = array(
array(
'adults' => $objCartBookingData->adults,
'children' => $objCartBookingData->children,
'child_ages' => json_decode($objCartBookingData->child_ages)
)
);
$total_price = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice(
$idProduct,
$objCartBookingData->date_from,
$objCartBookingData->date_to,
0,
$occupancy,
Group::getCurrent()->id,
$objCartBookingData->id_cart,
$objCartBookingData->id_guest,
@@ -1700,6 +1707,7 @@ abstract class PaymentModuleCore extends Module
} else {
$cart_bk_data = $obj_htl_bk_dtl->getOnlyOrderBookingData($order->id, $customer->id_guest, $type_value['product_id']);
}
if ($cart_bk_data) {
$rm_dtl = $obj_rm_type->getRoomTypeInfoByIdProduct($type_value['product_id']);
@@ -1720,11 +1728,20 @@ abstract class PaymentModuleCore extends Module
$cart_htl_data[$type_key]['date_diff'][$date_join]['adults'] += $data_v['adults'];
$cart_htl_data[$type_key]['date_diff'][$date_join]['children'] += $data_v['children'];
$occupancy = array(
array(
'adults' => $data_v['adults'],
'children' => $data_v['children'],
'child_ages' => json_decode($data_v['child_ages'])
)
);
$roomTypeDateRangePrice = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice($type_value['id_product'], $data_v['date_from'], $data_v['date_to']);
$roomTypeDateRangePrice = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice(
$type_value['id_product'],
$data_v['date_from'],
$data_v['date_to'],
$occupancy
);
$cart_htl_data[$type_key]['date_diff'][$date_join]['amount'] = $roomTypeDateRangePrice['total_price_tax_incl']*$vart_quant;
$cart_htl_data[$type_key]['date_diff'][$date_join]['paid_unit_price_tax_incl'] = $data_v['total_price_tax_incl']/$num_days;
@@ -1745,9 +1762,7 @@ abstract class PaymentModuleCore extends Module
$cart_htl_data[$type_key]['date_diff'][$date_join]['adults'] = $data_v['adults'];
$cart_htl_data[$type_key]['date_diff'][$date_join]['children'] = $data_v['children'];
// extra demands prices
// extra demands prices
$cart_htl_data[$type_key]['date_diff'][$date_join]['extra_demands'] = $objBookingDemand->getRoomTypeBookingExtraDemands(
$order->id,
$type_value['product_id'],
@@ -1831,6 +1846,7 @@ abstract class PaymentModuleCore extends Module
}
$result['cart_htl_data'] = $cart_htl_data;
}
return $result;
}
}

View File

@@ -945,14 +945,12 @@ class ProductCore extends ObjectModel
public function validateField($field, $value, $id_lang = null, $skip = array(), $human_errors = false)
{
if ($field == 'description_short') {
$limit = (int)Configuration::get('PS_PRODUCT_SHORT_DESC_LIMIT');
$limit = (int)Configuration::get('PS_SHORT_DESC_LIMIT');
if ($limit <= 0) {
$limit = 800;
$limit = Configuration::PS_SHORT_DESC_LIMIT;
}
$size_without_html = Tools::strlen(strip_tags($value));
$size_with_html = Tools::strlen($value);
$this->def['fields']['description_short']['size'] = $limit + $size_with_html - $size_without_html;
$this->def['fields']['description_short']['size'] = $limit;
}
return parent::validateField($field, $value, $id_lang, $skip, $human_errors);
}

View File

@@ -649,8 +649,8 @@ abstract class ControllerCore
$method = $bt[1]['function'];
}
Hook::exec('actionBeforeAjaxDie', array('controller' => $controller, 'method' => $method, 'value' => $value));
Hook::exec('actionBeforeAjaxDie'.$controller.$method, array('value' => $value));
Hook::exec('actionBeforeAjaxDie', array('controller' => $controller, 'method' => $method, 'value' => &$value));
Hook::exec('actionBeforeAjaxDie'.$controller.$method, array('value' => &$value));
die($value);
}

View File

@@ -314,10 +314,17 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
$service_product_data = array();
$room_extra_demands = array();
$room_additinal_services = array();
$formattedHotelAddress = '';
if (Module::isInstalled('hotelreservationsystem')) {
$obj_htl_bk_dtl = new HotelBookingDetail();
$obj_rm_type = new HotelRoomType();
$objRoomTypeServiceProductOrderDetail = new RoomTypeServiceProductOrderDetail();
$objHotelBranchInfo = new HotelBranchInformation((int) HotelBookingDetail::getIdHotelByIdOrder($order_obj->id), $this->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);
if (!empty($order_details)) {
@@ -591,6 +598,7 @@ class HTMLTemplateInvoiceCore extends HTMLTemplate
'cart_rules' => $cart_rules,
'delivery_address' => $formatted_delivery_address,
'invoice_address' => $formatted_invoice_address,
'hotel_address' => $formattedHotelAddress,
'addresses' => array('invoice' => $invoice_address, 'delivery' => $delivery_address),
'tax_excluded_display' => $tax_excluded_display,
'display_product_images' => $display_product_images,

View File

@@ -380,6 +380,21 @@ class AdminAddressesControllerCore extends AdminController
return parent::renderForm();
}
public function processExport($text_delimiter = '"')
{
$this->fields_list = array_merge($this->fields_list, array(
'email' => array('title' => $this->l('Customer Email')),
'phone' => array('title' => $this->l('Phone')),
'phone_mobile' => array('title' => $this->l('Mobile phone')),
'address1' => array('title' => $this->l('Address (2)')),
'dni' => array('title' => $this->l('Identification Number')),
'vat_number' => array('title' => $this->l('VAT number')),
'other' => array('title' => $this->l('Other')),
));
return parent::processExport($text_delimiter);
}
// public function postProcess()
// {

View File

@@ -302,6 +302,31 @@ class AdminCartsControllerCore extends AdminController
$product['image'] = (isset($image['id_image']) ? ImageManager::thumbnail(_PS_IMG_DIR_.'p/'.$image_product->getExistingImgPath().'.jpg', 'product_mini_'.(int)$product['id_product'].(isset($product['id_product_attribute']) ? '_'.(int)$product['id_product_attribute'] : '').'.jpg', 45, 'jpg') : '--');
}
// by webkul to show rooms available in the cart
$cartHtlData = array();
$objHotelCartBookingData = new HotelCartBookingData();
$objHotelRoomType = new HotelRoomType();
if ($cartHtlData = $objHotelCartBookingData->getCartFormatedBookinInfoByIdCart((int) $cart->id)) {
foreach ($cartHtlData as $key => $value) {
$cartHtlData[$key]['room_type_info'] = $objHotelRoomType->getRoomTypeInfoByIdProduct($value['id_product']);
if (isset($value['selected_services']) && $value['selected_services']) {
foreach ($value['selected_services'] as $service) {
if ($service['id_cart'] != $value['id_cart']) {
if ($tax_calculation_method == PS_TAX_EXC) {
$total_price += ($service['quantity'] * $service['total_price_tax_excl']);
$total_products += ($service['quantity'] * $service['total_price_tax_excl']);
} else {
$total_price += ($service['quantity'] * $service['total_price_tax_incl']);
$total_products += ($service['quantity'] * $service['total_price_tax_incl']);
}
}
}
}
}
} else {
$cartHtlData = array();
}
$helper = new HelperKpi();
$helper->id = 'box-kpi-cart';
$helper->icon = 'icon-shopping-cart';
@@ -310,17 +335,6 @@ class AdminCartsControllerCore extends AdminController
$helper->subtitle = sprintf($this->l('Cart #%06d', null, null, false), $cart->id);
$helper->value = Tools::displayPrice($total_price, $currency);
$kpi = $helper->generate();
// by webkul to show rooms available in the cart
$cartHtlData = array();
$objHotelCartBookingData = new HotelCartBookingData();
$objHotelRoomType = new HotelRoomType();
if ($cartHtlData = $objHotelCartBookingData->getCartFormatedBookinInfoByIdCart((int) $cart->id)) {
foreach ($cartHtlData as $key => $value) {
$cartHtlData[$key]['room_type_info'] = $objHotelRoomType->getRoomTypeInfoByIdProduct($value['id_product']);
}
} else {
$cartHtlData = array();
}
//end
$this->tpl_view_vars = array(
'cart_htl_data' => $cartHtlData,//by webkul hotel rooms in order data

View File

@@ -97,13 +97,16 @@ class AdminCustomersControllerCore extends AdminController
'order_key' => 'gl!name'
),
'firstname' => array(
'title' => $this->l('First name')
'title' => $this->l('First name'),
'filter_key' => 'a!firstname'
),
'lastname' => array(
'title' => $this->l('Last name')
'title' => $this->l('Last name'),
'filter_key' => 'a!lastname'
),
'email' => array(
'title' => $this->l('Email address')
'title' => $this->l('Email address'),
'filter_key' => 'a!email'
),
);
@@ -143,6 +146,7 @@ class AdminCustomersControllerCore extends AdminController
),
'phone' => array(
'title' => $this->l('Phone'),
'filter_key' => 'a!phone',
'optional' => true,
'visible_default' => false,
),
@@ -152,7 +156,8 @@ class AdminCustomersControllerCore extends AdminController
'active' => 'status',
'type' => 'bool',
'orderby' => false,
'filter_key' => 'a!active'
'filter_key' => 'a!active',
'callback' => 'formatStatusAsLabel',
),
'newsletter' => array(
'title' => $this->l('Newsletter'),
@@ -184,6 +189,7 @@ class AdminCustomersControllerCore extends AdminController
'title' => $this->l('Banned'),
'type' => 'bool',
'displayed' => false,
'callback' => 'getCustomerStatusLabel',
),
'order_date' => array(
'title' => $this->l('Order date'),
@@ -235,6 +241,28 @@ class AdminCustomersControllerCore extends AdminController
}
}
public function formatStatusAsLabel($val, $row)
{
if ($val) {
$str_return = $this->l('Yes');
} else {
$str_return = $this->l('No');
}
return $str_return;
}
public function getCustomerStatusLabel($deleted, $tr)
{
if ($deleted == Customer::STATUS_DELETED) {
return $this->l('Deleted');
} else if ($deleted == Customer::STATUS_BANNED) {
return $this->l('Banned');
}
return;
}
public function initContent()
{
if ($this->action == 'select_delete') {
@@ -268,8 +296,11 @@ class AdminCustomersControllerCore extends AdminController
public function getList($id_lang, $orderBy = null, $orderWay = null, $start = 0, $limit = null, $id_lang_shop = null)
{
parent::getList($id_lang, $orderBy, $orderWay, $start, $limit, $id_lang_shop);
if ($this->action == 'export') {
$this->deleted = false;
}
parent::getList($id_lang, $orderBy, $orderWay, $start, $limit, $id_lang_shop);
if ($this->_list) {
foreach ($this->_list as &$row) {
$row['badge_success'] = $row['total_spent'] > 0;
@@ -1040,6 +1071,14 @@ class AdminCustomersControllerCore extends AdminController
}
}
public function processExport($text_delimiter = '"')
{
$this->fields_list['newsletter']['callback'] = 'formatStatusAsLabel';
$this->fields_list['optin']['callback'] = 'formatStatusAsLabel';
return parent::processExport($text_delimiter);
}
protected function processBulkDelete()
{
// If customer is going to be deleted permanently then if customer has orders the change this customer as an anonymous customer

View File

@@ -257,12 +257,14 @@ class AdminNormalProductsControllerCore extends AdminController
'title' => $this->l('Available for order'),
'filter_key' => 'a!available_for_order',
'type' => 'bool',
'callback' => 'formatStatusAsLabel',
);
$this->fields_list['price_addition_type'] = array(
'displayed' => false,
'title' => $this->l('Price display preference'),
'filter_key' => 'a!price_addition_type',
'type' => 'select',
'callback' => 'getPriceDisplayPreference',
'list' => $priceAdditionType,
);
$this->fields_list['price_calculation_method_txt'] = array(
@@ -311,7 +313,8 @@ class AdminNormalProductsControllerCore extends AdminController
'title' => $this->l('Base price'),
'type' => 'price',
'align' => 'text-left',
'filter_key' => 'a!price'
'filter_key' => 'a!price',
'callback' => 'displayPrice',
);
$this->fields_list['price_final'] = array(
'title' => $this->l('Final price'),
@@ -319,7 +322,8 @@ class AdminNormalProductsControllerCore extends AdminController
'align' => 'text-left',
'havingFilter' => true,
'orderby' => false,
'search' => false
'search' => false,
'callback' => 'displayPrice',
);
$this->fields_list['active'] = array(
@@ -329,6 +333,7 @@ class AdminNormalProductsControllerCore extends AdminController
'align' => 'text-center',
'type' => 'bool',
'class' => 'fixed-width-sm',
'callback' => 'formatStatusAsLabel',
'orderby' => false
);
@@ -342,6 +347,34 @@ class AdminNormalProductsControllerCore extends AdminController
}
}
public function formatStatusAsLabel($val, $row)
{
if ($val) {
$str_return = $this->l('Yes');
} else {
$str_return = $this->l('No');
}
return $str_return;
}
public function getPriceDisplayPreference($val, $row)
{
$str_return = $val;
if ($val == Product::PRICE_ADDITION_TYPE_WITH_ROOM) {
$str_return = $this->l('Add price in room price');
} else if ($val == Product::PRICE_ADDITION_TYPE_INDEPENDENT) {
$str_return = $this->l('Convenience Fee');
}
return $str_return;
}
public static function displayPrice($basePrice, $tr)
{
return Tools::displayPrice($basePrice, (int) Configuration::get('PS_CURRENCY_DEFAULT'));
}
private function buildCategoryOptions($category)
{
$space = str_repeat('&nbsp;', 5 * (($category['level_depth'] - $this->objLocationsCategory->level_depth) - 1));
@@ -655,33 +688,52 @@ class AdminNormalProductsControllerCore extends AdminController
}
}
}
$limit = (int)Configuration::get('PS_SHORT_DESC_LIMIT');
if ($limit <= 0) {
$limit = Configuration::PS_SHORT_DESC_LIMIT;
}
$className = 'Product';
foreach (Language::getLanguages(true) as $language) {
if (Tools::strlen(strip_tags($product->name[$language['id_lang']])) > $limit) {
$this->errors[] = sprintf(
Tools::displayError('This %1$s field in %2$s is too long: %3$d chars max (current count %4$d).'),
call_user_func(array($className, 'displayFieldName'), 'description_short'),
$language['name'],
$limit,
Tools::strlen(strip_tags($product->name[$language['id_lang']]))
);
}
}
unset($product->id);
unset($product->id_product);
$product->indexed = 0;
$product->active = 0;
if ($product->add()
&& Category::duplicateProductCategories($id_product_old, $product->id)
&& ($combination_images = Product::duplicateAttributes($id_product_old, $product->id)) !== false
&& GroupReduction::duplicateReduction($id_product_old, $product->id)
// && Product::duplicateFeatures($id_product_old, $product->id)
&& Product::duplicateTags($id_product_old, $product->id)) {
if ($product->hasAttributes()) {
Product::updateDefaultAttribute($product->id);
} else {
Product::duplicateSpecificPrices($id_product_old, $product->id);
}
if (!Tools::getValue('noimage') && !Image::duplicateProductImages($id_product_old, $product->id, $combination_images)) {
$this->errors[] = Tools::displayError('An error occurred while copying images.');
} else {
Hook::exec('actionProductAdd', array('id_product' => (int)$product->id, 'product' => $product));
if (in_array($product->visibility, array('both', 'search')) && Configuration::get('PS_SEARCH_INDEXATION')) {
Search::indexation(false, $product->id);
if (!$this->errors) {
if ($product->add()
&& Category::duplicateProductCategories($id_product_old, $product->id)
&& ($combination_images = Product::duplicateAttributes($id_product_old, $product->id)) !== false
&& GroupReduction::duplicateReduction($id_product_old, $product->id)
// && Product::duplicateFeatures($id_product_old, $product->id)
&& Product::duplicateTags($id_product_old, $product->id)
) {
if ($product->hasAttributes()) {
Product::updateDefaultAttribute($product->id);
} else {
Product::duplicateSpecificPrices($id_product_old, $product->id);
}
$this->redirect_after = self::$currentIndex.(Tools::getIsset('id_category') ? '&id_category='.(int)Tools::getValue('id_category') : '').'&conf=19&token='.$this->token;
if (!Tools::getValue('noimage') && !Image::duplicateProductImages($id_product_old, $product->id, $combination_images)) {
$this->errors[] = Tools::displayError('An error occurred while copying images.');
} else {
Hook::exec('actionProductAdd', array('id_product' => (int)$product->id, 'product' => $product));
if (in_array($product->visibility, array('both', 'search')) && Configuration::get('PS_SEARCH_INDEXATION')) {
Search::indexation(false, $product->id);
}
$this->redirect_after = self::$currentIndex.(Tools::getIsset('id_category') ? '&id_category='.(int)Tools::getValue('id_category') : '').'&conf=19&token='.$this->token;
}
} else {
$this->errors[] = Tools::displayError('An error occurred while creating an object.');
}
} else {
$this->errors[] = Tools::displayError('An error occurred while creating an object.');
}
}
}
@@ -1408,8 +1460,7 @@ class AdminNormalProductsControllerCore extends AdminController
'ajaxfileupload',
'date',
'tagify',
'select2',
'validate'
'select2'
));
$this->addJS(array(
@@ -2160,15 +2211,15 @@ class AdminNormalProductsControllerCore extends AdminController
}
// Check description short size without html
$limit = (int)Configuration::get('PS_PRODUCT_SHORT_DESC_LIMIT');
$limit = (int)Configuration::get('PS_SHORT_DESC_LIMIT');
if ($limit <= 0) {
$limit = 400;
$limit = Configuration::PS_SHORT_DESC_LIMIT;
}
foreach ($languages as $language) {
if ($this->isProductFieldUpdated('description_short', $language['id_lang']) && ($value = Tools::getValue('description_short_'.$language['id_lang']))) {
if (Tools::strlen(strip_tags($value)) > $limit) {
$this->errors[] = sprintf(
Tools::displayError('This %1$s field (%2$s) is too long: %3$d chars max (current count %4$d).'),
Tools::displayError('This %1$s field in %2$s is too long: %3$d chars max (current count %4$d).'),
call_user_func(array($className, 'displayFieldName'), 'description_short'),
$language['name'],
$limit,
@@ -3527,7 +3578,7 @@ class AdminNormalProductsControllerCore extends AdminController
'token' => $this->token,
'currency' => $currency,
'link' => $this->context->link,
'PS_PRODUCT_SHORT_DESC_LIMIT' => Configuration::get('PS_PRODUCT_SHORT_DESC_LIMIT') ? Configuration::get('PS_PRODUCT_SHORT_DESC_LIMIT') : 400
'PS_SHORT_DESC_LIMIT' => Configuration::get('PS_SHORT_DESC_LIMIT') ? Configuration::get('PS_SHORT_DESC_LIMIT') : Configuration::PS_SHORT_DESC_LIMIT
));
$data->assign($this->tpl_form_vars);

View File

@@ -79,8 +79,7 @@ class AdminOrdersControllerCore extends AdminController
LEFT JOIN `'._DB_PREFIX_.'order_state` os ON (os.`id_order_state` = a.`current_state`)
LEFT JOIN `'._DB_PREFIX_.'order_state_lang` osl ON (os.`id_order_state` = osl.`id_order_state` AND osl.`id_lang` = '.(int) $this->context->language->id.')
LEFT JOIN `'._DB_PREFIX_.'htl_booking_detail` hbd ON (hbd.`id_order` = a.`id_order`)
LEFT JOIN `'._DB_PREFIX_.'htl_branch_info_lang` hbil ON (hbil.`id` = hbd.`id_hotel`)';
LEFT JOIN `'._DB_PREFIX_.'htl_branch_info_lang` hbil ON (hbil.`id` = hbd.`id_hotel` AND osl.`id_lang` = hbil.`id_lang`)';
$this->_orderBy = 'id_order';
$this->_orderWay = 'DESC';
@@ -1194,6 +1193,127 @@ class AdminOrdersControllerCore extends AdminController
return parent::renderList();
}
public function getList(
$id_lang,
$order_by = null,
$order_way = null,
$start = 0,
$limit = null,
$id_lang_shop = false
){
if ($this->action == 'export' && empty($this->_listsql)) {
$this->_select .= ', c.`email`, cgd.`phone`, a.`total_paid_real`,
orf.`cancellation_date`, orf.`cancellation_fee`,
cy.`iso_code` AS country, st.`iso_code` as state, ad.`city`,
CONCAT(ad.`address1`, \', \', ad.`postcode`) AS `cus_address`, hbdtl.*';
$this->_join .= ' LEFT JOIN `'._DB_PREFIX_.'cart_customer_guest_detail` cgd ON cgd.`email` = c.`email` AND cgd.`id_cart` = 0
LEFT JOIN `'._DB_PREFIX_.'address` ad ON a.`id_customer`= ad.`id_customer` AND ad.`id_customer`!=0
LEFT JOIN `'._DB_PREFIX_.'country` cy ON cy.`id_country`= ad.`id_country`
LEFT JOIN `'._DB_PREFIX_.'state` st ON st.`id_state`= ad.`id_state`
LEFT JOIN (
SELECT ref.`id_order`, IF(refst.refunded = 1, GROUP_CONCAT(ref.`date_upd`), NULL) AS `cancellation_date`,
IF(refst.refunded = 1, SUM(ref.`refunded_amount`), NULL) AS `cancellation_fee`
FROM `'._DB_PREFIX_.'order_return` ref
LEFT JOIN `'._DB_PREFIX_.'order_return_state` refst
ON refst.`id_order_return_state` = ref.`state` AND refst.`refunded` = 1
GROUP BY ref.`id_order`
) AS orf ON orf.`id_order` = a.`id_order`
LEFT JOIN (
SELECT GROUP_CONCAT(
CASE
WHEN `id_status`='.HotelBookingDetail::STATUS_ALLOTED.' THEN \''.$this->l('Alloted').'\'
WHEN `id_status`='.HotelBookingDetail::STATUS_CHECKED_IN.' THEN \''.$this->l('Checked in').'\'
WHEN `id_status`='.HotelBookingDetail::STATUS_CHECKED_OUT.' THEN \''.$this->l('Checked out').'\'
ELSE \''.$this->l('Invalid status').'\'
END
) AS `room_status`, `id_order`,
GROUP_CONCAT(DISTINCT(`room_type_name`)) AS `room_types`,
GROUP_CONCAT(`date_from`) AS `date_from`,
GROUP_CONCAT(`date_to`) AS `date_to`,
GROUP_CONCAT(`room_num`) AS `rooms`,
GROUP_CONCAT(`check_in`) AS `check_in_dates`,
GROUP_CONCAT(`check_out`) AS `check_out_dates`
FROM `'._DB_PREFIX_.'htl_booking_detail`
GROUP BY `id_order`
) AS hbdtl ON hbdtl.`id_order` = a.`id_order`';
$this->fields_list = array_merge($this->fields_list, array(
'email' => array(
'title' => $this->l('Email')
),
'phone' => array(
'title' => $this->l('Phone')
),
'room_types' => array(
'title' => $this->l('Room Types')
),
'rooms' => array(
'title' => $this->l('Rooms')
),
'currency' => array(
'title' => $this->l('Currency')
),
'total_paid_real' => array(
'title' => $this->l('Amount Paid')
),
'check_in_dates' => array(
'title' => $this->l('Check In')
),
'check_out_dates' => array(
'title' => $this->l('Check Out')
),
'date_from' => array(
'title' => $this->l('Date From'),
'filter_key' => 'hbd!date_from',
),
'date_to' => array(
'title' => $this->l('Date To'),
'filter_key' => 'hbd!date_to',
),
'date_add' => array(
'title' => $this->l('Reservation Date'),
'filter_key' => 'a!date_add',
),
'room_status' => array(
'title' => $this->l('Room Status'),
),
'country' => array(
'title' => $this->l('Country'),
),
'state' => array(
'title' => $this->l('State'),
),
'city' => array(
'title' => $this->l('City'),
),
'cus_address' => array(
'title' => $this->l('Address'),
),
'cancellation_date' => array(
'title' => $this->l('Cancellation date'),
),
'cancellation_fee' => array(
'title' => $this->l('Cancellation fee'),
),
));
unset($this->fields_list['id_status']);
unset($this->fields_list['id_room_information']);
unset($this->fields_list['room_type_name']);
unset($this->fields_list['id_currency']);
}
parent::getList(
$id_lang,
$order_by,
$order_way,
$start,
$limit,
$id_lang_shop
);
}
public function postProcess()
{
// Process reallocation of rooms
@@ -3508,7 +3628,7 @@ class AdminOrdersControllerCore extends AdminController
}
}
}
$this->content = json_encode($to_return);
$this->ajaxDie(json_encode($to_return));
}
// public function ajaxProcessSearchProducts()
@@ -4581,11 +4701,19 @@ class AdminOrdersControllerCore extends AdminController
$objBookingDetail->children = $objCartBookingData->children;
$objBookingDetail->child_ages = $objCartBookingData->child_ages;
$occupancy = array(
array(
'adults' => $objCartBookingData->adults,
'children' => $objCartBookingData->children,
'child_ages' => json_decode($objCartBookingData->child_ages)
)
);
$total_price = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice(
$idProduct,
$objCartBookingData->date_from,
$objCartBookingData->date_to,
0,
$occupancy,
Group::getCurrent()->id,
$this->context->cart->id,
$this->context->cookie->id_guest,
@@ -5454,6 +5582,15 @@ class AdminOrdersControllerCore extends AdminController
$idHotelBooking
);
//This is added to remove the services from the cart along with room deletion process.
$objHotelCartBookingData = new HotelCartBookingData();
$roomHtlCartInfo = $objHotelCartBookingData->getRoomRowByIdProductIdRoomInDateRange(
$objBookingDetail->id_cart,
$objBookingDetail->id_product,
$objBookingDetail->date_from,
$objBookingDetail->date_to,
$objBookingDetail->id_room
);
/*$totalProductPriceBeforeTE = $order_detail->total_price_tax_excl;
$totalProductPriceBeforeTI = $order_detail->total_price_tax_incl;*/
@@ -5488,6 +5625,7 @@ class AdminOrdersControllerCore extends AdminController
$res &= $order_detail->update();
}
// update order detail for selected aditional services
$objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail();
foreach ($selectedAdditonalServices['additional_services'] as $service) {
$serviceOrderDetail = new OrderDetail($service['id_order_detail']);
@@ -5508,6 +5646,21 @@ class AdminOrdersControllerCore extends AdminController
// Save order detail
$res &= $serviceOrderDetail->update();
}
if (isset($roomHtlCartInfo['id'])) {
if ($idRoomTypServiceProductCartDetail = $objRoomTypeServiceProductCartDetail->alreadyExists(
$service['id_product'],
$service['id_cart'],
$roomHtlCartInfo['id']
)) {
$objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail((int) $idRoomTypServiceProductCartDetail);
$serviceQuantity = $objRoomTypeServiceProductCartDetail->quantity;
if ($objRoomTypeServiceProductCartDetail->delete()) {
$objCart = new Cart($service['id_cart']);
$objCart->updateQty((int)abs($serviceQuantity), $service['id_product'], null, false, 'down');
}
}
}
}
/*End*/
@@ -5586,7 +5739,9 @@ class AdminOrdersControllerCore extends AdminController
$objBookingDetail->id_product,
$objBookingDetail->id_room,
$objBookingDetail->date_from,
$objBookingDetail->date_to
$objBookingDetail->date_to,
1,
$objBookingDetail->id_order
);
$objBookingDetail->delete();
@@ -6148,24 +6303,17 @@ class AdminOrdersControllerCore extends AdminController
$del_id = Tools::getValue('del_id');
$room_id = Tools::getValue('id_room');
$obj_hotel_cart_detail = new HotelCartBookingData();
$deleted = $obj_hotel_cart_detail->deleteCartBookingData($cart_id, $id_product, $room_id, $dt_frm, $dt_to);
if ($deleted) {
if ($obj_hotel_cart_detail->deleteCartBookingData($cart_id, $id_product, $room_id, $dt_frm, $dt_to)) {
$obj_product_process = new HotelCartBookingData();
$num_cart_rooms = 0;
$dt_to = date('Y-m-d H:i:s', strtotime($dt_to) - _TIME_1_DAY_);
HotelRoomTypeFeaturePricing::deleteFeaturePrices($cart_id, $id_product, $room_id, $dt_frm, $dt_to);
if ($rooms = $obj_hotel_cart_detail->getCartCurrentDataByCartId($cart_id)) {
$num_cart_rooms = count($rooms);
}
$numDays = HotelHelper::getNumberOfDays($dt_frm, $dt_to);
$dt_to = date('Y-m-d H:i:s', strtotime($dt_to) - _TIME_1_DAY_);
HotelRoomTypeFeaturePricing::deleteFeaturePrices($cart_id, $id_product, $room_id, $dt_frm, $dt_to);
$changed = $obj_product_process->changeProductDataByRoomId($room_id, $id_product, $numDays, $cart_id);
if ($changed) {
$result['status'] = 'deleted';
$result['cart_rooms'] = $num_cart_rooms;
} else {
$result['status'] = 'failed';
}
$result['status'] = 'deleted';
$result['cart_rooms'] = $num_cart_rooms;
} else {
$result['status'] = 'failed';
}
@@ -6506,8 +6654,31 @@ class AdminOrdersControllerCore extends AdminController
$quantity = $objRoomTypeServiceProductOrderDetail->quantity;
$res = true;
$objHotelBookingDetail = new HotelBookingDetail($objRoomTypeServiceProductOrderDetail->id_htl_booking_detail);
$idServiceProduct = $objRoomTypeServiceProductOrderDetail->id_product;
$objHotelCartBookingData = new HotelCartBookingData();
$roomHtlCartInfo = $objHotelCartBookingData->getRoomRowByIdProductIdRoomInDateRange(
$objHotelBookingDetail->id_cart,
$objHotelBookingDetail->id_product,
$objHotelBookingDetail->date_from,
$objHotelBookingDetail->date_to,
$objHotelBookingDetail->id_room
);
$objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail();
if ($res &= $objRoomTypeServiceProductOrderDetail->delete()) {
if (isset($roomHtlCartInfo['id'])) {
if ($idRoomTypServiceProductCartDetail = $objRoomTypeServiceProductCartDetail->alreadyExists(
$idServiceProduct,
$objRoomTypeServiceProductOrderDetail->id_cart,
$roomHtlCartInfo['id']
)) {
$objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail($idRoomTypServiceProductCartDetail);
if ($objRoomTypeServiceProductCartDetail->delete()) {
$objCart = new Cart($objRoomTypeServiceProductOrderDetail->id_cart);
$objCart->updateQty((int)abs($quantity), $objRoomTypeServiceProductOrderDetail->id_product, null, false, 'down');
}
}
}
$order = new Order($objRoomTypeServiceProductOrderDetail->id_order);
if ($quantity >= $objOrderDetail->product_quantity) {
$objOrderDetail->delete();
@@ -6705,12 +6876,12 @@ class AdminOrdersControllerCore extends AdminController
$unitPriceTaxExcl = 0;
foreach ($productList as &$product) {
// This is used to get the actual quanity of the service as it is calculated incorrectly if the service is per night
if ($id_room_type_service_product_cart_detail = $objRoomTypeServiceProductCartDetail->alreadyExists(
if ($idRoomTypServiceProductCartDetail = $objRoomTypeServiceProductCartDetail->alreadyExists(
$service['id'],
$cart->id,
$roomHtlCartInfo['id'])
) {
$objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail((int) $id_room_type_service_product_cart_detail);
$objRoomTypeServiceProductCartDetail = new RoomTypeServiceProductCartDetail((int) $idRoomTypServiceProductCartDetail);
$unitPriceTaxExcl = $objRoomTypeServiceProductPrice->getServicePrice(
(int)$product['id_product'],
@@ -7196,6 +7367,13 @@ class AdminOrdersControllerCore extends AdminController
// set context currency So that we can get prices in the order currency
$objOrder = new Order($objHotelBooking->id_order);
$this->context->currency = new Currency($objOrder->id_currency);
$occupancy = array(
array(
'adults' => $objHotelBooking->adults,
'children' => $objHotelBooking->children,
'child_ages' => json_decode($objHotelBooking->child_ages)
)
);
$newRoomTotalPrice = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice(
$idNewRoomType,
$objHotelBooking->date_from,

View File

@@ -82,16 +82,6 @@ class AdminPPreferencesControllerCore extends AdminController
1 => $this->l('Cart summary')
)
),*/
'PS_PRODUCT_SHORT_DESC_LIMIT' => array(
'title' => $this->l('Max size of short description'),
'hint' => $this->l('Set the maximum size of room type short description (in characters).'),
'validation' => 'isUnsignedInt',
'cast' => 'intval',
'type' => 'text',
'suffix' => $this->l('characters'),
'class' => 'fixed-width-xl',
'desc' => $this->l('If set to 0, the maximum limit will be 400 characters.')
),
/*'PS_QTY_DISCOUNT_ON_COMBINATION' => array(
'title' => $this->l('Quantity discounts based on'),
'hint' => $this->l('How to calculate quantity discounts.'),

View File

@@ -185,6 +185,16 @@ class AdminPreferencesControllerCore extends AdminController
'type' => 'text',
'class' => 'fixed-width-xxl'
),
'PS_SHORT_DESC_LIMIT' => array(
'title' => $this->l('Short description Max Size'),
'hint' => $this->l('Set the maximum size of room type, services and hotel short description (in characters).'),
'validation' => 'isUnsignedInt',
'cast' => 'intval',
'type' => 'text',
'suffix' => $this->l('characters'),
'class' => 'fixed-width-xl',
'desc' => sprintf($this->l('If set to 0, the maximum limit will be %d characters.'), Configuration::PS_SHORT_DESC_LIMIT)
),
// 'PS_DISPLAY_SUPPLIERS' => array(
// 'title' => $this->l('Display suppliers and manufacturers'),
// 'desc' => $this->l('Enable suppliers and manufacturers pages on your front office even when their respective modules are disabled.'),

View File

@@ -201,7 +201,13 @@ class AdminProductsControllerCore extends AdminController
LEFT JOIN `'._DB_PREFIX_.'address` aa ON (aa.`id_hotel` = hb.`id`)
LEFT JOIN `'._DB_PREFIX_.'feature_product` fp ON (fp.`id_product` = a.`id_product`)
LEFT JOIN `'._DB_PREFIX_.'htl_room_type_demand` hrtd ON (hrtd.`id_product` = a.`id_product`)
LEFT JOIN `'._DB_PREFIX_.'htl_room_type_service_product` hrtsp ON ((hrtsp.`element_type` = '.(int) RoomTypeServiceProduct::WK_ELEMENT_TYPE_HOTEL.' AND hrtsp.`id_element` = hrt.`id_hotel`) OR (hrtsp.`element_type` = '.(int) RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE.' AND hrtsp.`id_element` = a.`id_product`))
LEFT JOIN (
SELECT rsp.*, GROUP_CONCAT(pl.`name`) AS service_products
FROM `'._DB_PREFIX_.'htl_room_type_service_product` rsp
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = rsp.`id_product`)
WHERE pl.`id_lang`='.$this->context->language->id.'
GROUP BY rsp.`id_element`)
AS hrtsp ON ((hrtsp.`element_type` = '.(int) RoomTypeServiceProduct::WK_ELEMENT_TYPE_HOTEL.' AND hrtsp.`id_element` = hrt.`id_hotel`) OR (hrtsp.`element_type` = '.(int) RoomTypeServiceProduct::WK_ELEMENT_TYPE_ROOM_TYPE.' AND hrtsp.`id_element` = a.`id_product`))
LEFT JOIN `'._DB_PREFIX_.'htl_advance_payment` hap ON (hap.`id_product` = a.`id_product`)';
$this->_select .= ' a.`show_at_front`, (SELECT COUNT(hri.`id`) FROM `'._DB_PREFIX_.'htl_room_information` hri WHERE hri.`id_product` = a.`id_product`) as num_rooms, ';
@@ -213,7 +219,7 @@ class AdminProductsControllerCore extends AdminController
if ($join_category) {
$this->_join .= ' INNER JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_product` = a.`id_product` AND cp.`id_category` = '.(int)$this->_category->id.') ';
$this->_select .= ' , cp.`position`, ';
$this->_select .= ' , cp.`position` ';
}
// show the list of the product according to the booking or service products
@@ -277,6 +283,13 @@ class AdminProductsControllerCore extends AdminController
'type' => 'range',
'align' => 'center',
);
$this->fields_list['max_guests'] = array(
'title' => $this->l('Maximum Occupancy'),
'filter_key' => 'hrt!max_guests',
'type' => 'range',
'align' => 'center',
'optional' => true,
);
// use it for total rooms
$this->fields_list['num_rooms'] = array(
'title' => $this->l('Total Rooms'),
@@ -290,7 +303,7 @@ class AdminProductsControllerCore extends AdminController
'validation' => 'isFloat',
'align' => 'text-left',
'filter_key' => 'a!price',
'callback' => 'displayBasePrice',
'callback' => 'displayPrice',
);
$this->fields_list['price_final'] = array(
'title' => $this->l('Final price'),
@@ -298,7 +311,8 @@ class AdminProductsControllerCore extends AdminController
'align' => 'text-left',
'havingFilter' => true,
'orderby' => false,
'search' => false
'search' => false,
'callback' => 'displayPrice',
);
$this->fields_list['active'] = array(
@@ -307,25 +321,18 @@ class AdminProductsControllerCore extends AdminController
'filter_key' => $alias.'!active',
'align' => 'text-center',
'type' => 'select',
'callback' => 'formatStatusAsLabel',
'list' => array(1 => $this->l('Yes'), 0 => $this->l('No')),
'optional' => true,
'visible_default' => true,
'orderby' => false
);
$this->fields_list['max_guests'] = array(
'title' => $this->l('Maximum Occupancy'),
'filter_key' => 'hrt!max_guests',
'type' => 'range',
'align' => 'center',
'optional' => true,
);
$this->fields_list['show_at_front'] = array(
'title' => $this->l('Show at front'),
'align' => 'text-center',
'type' => 'bool',
'active' => 'show_at_front',
'callback' => 'formatStatusAsLabel',
'optional' => true,
'havingFilter' => true,
'visible_default' => true,
@@ -335,7 +342,7 @@ class AdminProductsControllerCore extends AdminController
if (Configuration::get('WK_ALLOW_ADVANCED_PAYMENT')) {
$this->fields_list['advance_payment'] = array(
'title' => $this->l('Advance Payment'),
'callback' => 'getAdvancePaymentStatus',
'callback' => 'formatStatusAsLabel',
'badge_success' => true,
'badge_danger' => true,
'align' => 'text-center',
@@ -446,7 +453,7 @@ class AdminProductsControllerCore extends AdminController
}
}
public function getAdvancePaymentStatus($val, $row)
public function formatStatusAsLabel($val, $row)
{
if ($val) {
$str_return = $this->l('Yes');
@@ -457,7 +464,6 @@ class AdminProductsControllerCore extends AdminController
return $str_return;
}
private function buildCategoryOptions($category)
{
$space = str_repeat('&nbsp;', 5 * (($category['level_depth'] - $this->objLocationsCategory->level_depth) - 1));
@@ -470,7 +476,7 @@ class AdminProductsControllerCore extends AdminController
}
}
public static function displayBasePrice($basePrice, $tr)
public static function displayPrice($basePrice, $tr)
{
return Tools::displayPrice($basePrice, (int) Configuration::get('PS_CURRENCY_DEFAULT'));
}
@@ -629,6 +635,48 @@ class AdminProductsControllerCore extends AdminController
$orderBy = 'id_'.$this->table;
$orderWay = 'ASC';
}
if ($this->action == 'export' && empty($this->_listsql)) {
$this->_select .= ' , trg.`name` AS `id_tax_rules_group`, `features`, hrtdl.`global_demands`';
$this->_join .= ' LEFT JOIN `'._DB_PREFIX_.'tax_rules_group` trg
ON trg.`id_tax_rules_group` = a.`id_tax_rules_group`
LEFT JOIN (SELECT GROUP_CONCAT(fpl.`name`) AS features, fp.`id_product`
FROM `'._DB_PREFIX_.'feature_lang` fpl
LEFT JOIN `'._DB_PREFIX_.'feature_product` fp
ON (fp.`id_feature` = fpl.`id_feature`)
WHERE fpl.`id_lang`='.(int) $this->context->language->id.'
GROUP BY fp.`id_product`
) AS fpl ON (a.`id_product` = fpl.`id_product`)';
$this->_join .= ' LEFT JOIN (SELECT hrtgd.`id_product`, `id_lang`, GROUP_CONCAT(`name`) AS `global_demands`
FROM `'._DB_PREFIX_.'htl_room_type_global_demand_lang` hrtgdl
LEFT JOIN `'._DB_PREFIX_.'htl_room_type_demand` hrtgd
ON hrtgd.`id_global_demand` = hrtgdl.`id_global_demand`
WHERE `id_lang`='.(int) $this->context->language->id.'
GROUP BY hrtgd.`id_product`
) AS hrtdl ON (hrtdl.`id_product` = a.`id_product`)';
$this->fields_list = array_merge($this->fields_list, array(
'id_tax_rules_group' => array(
'title' => $this->l('Id Tax Rules group'),
'filter_key' => 'a!id_tax_rules_group',
),
'features' => array(
'title' => $this->l('Features'),
),
'service_products' => array(
'title' => $this->l('Services Products'),
),
'global_demands' => array(
'title' => $this->l('Additional Facilities'),
)
)
);
unset($this->fields_list['id_category_default']);
unset($this->fields_list['id_global_demand']);
unset($this->fields_list['id_feature']);
unset($this->fields_list['id_service_product']);
}
parent::getList($id_lang, $orderBy, $orderWay, $start, $limit, $this->context->shop->id);
/* update product quantity with attributes ...*/
@@ -813,10 +861,24 @@ class AdminProductsControllerCore extends AdminController
$id_hotel_new = Tools::getValue('id_hotel');
$obj_hotel_room_type = new HotelRoomType();
$room_type_info = $obj_hotel_room_type->getRoomTypeInfoByIdProduct($id_product_old);
$limit = (int)Configuration::get('PS_SHORT_DESC_LIMIT');
if ($limit <= 0) {
$limit = Configuration::PS_SHORT_DESC_LIMIT;
}
$className = 'Product';
if ($room_type_info && $room_type_info['id_hotel'] == $id_hotel_new) {
foreach (Language::getLanguages(true) as $language) {
$product->name[$language['id_lang']] = $product->name[$language['id_lang']].
' - '.$this->l('Duplicate');
if (Tools::strlen(strip_tags($product->description_short[$language['id_lang']])) > $limit) {
$this->errors[] = sprintf(
Tools::displayError('This %1$s field in %2$s is too long: %3$d chars max (current count %4$d).'),
call_user_func(array($className, 'displayFieldName'), 'description_short'),
$language['name'],
$limit,
Tools::strlen(strip_tags($product->description_short[$language['id_lang']]))
);
}
}
}
@@ -828,66 +890,69 @@ class AdminProductsControllerCore extends AdminController
foreach (Language::getLanguages(true) as $language) {
$product->link_rewrite[$language['id_lang']] = Tools::str2url($product->name[$language['id_lang']]);
}
if ($product->add()
// && Category::duplicateProductCategories($id_product_old, $product->id)
&& Product::duplicateSuppliers($id_product_old, $product->id)
&& ($combination_images = Product::duplicateAttributes($id_product_old, $product->id)) !== false
&& GroupReduction::duplicateReduction($id_product_old, $product->id)
&& Product::duplicateAccessories($id_product_old, $product->id)
&& Product::duplicateFeatures($id_product_old, $product->id)
&& Pack::duplicate($id_product_old, $product->id)
&& Product::duplicateCustomizationFields($id_product_old, $product->id)
&& Product::duplicateTags($id_product_old, $product->id)
&& Product::duplicateDownload($id_product_old, $product->id)
) {
$obj_hotel_room_type = new HotelRoomType();
$room_type_info = $obj_hotel_room_type->getRoomTypeInfoByIdProduct($id_product_old);
$id_room_type_old = $room_type_info['id'];
if (!$id_hotel_new) {
$id_hotel_new = $room_type_info['id_hotel'];
}
if ($product->hasAttributes()) {
Product::updateDefaultAttribute($product->id);
} else {
Product::duplicateSpecificPrices($id_product_old, $product->id);
}
if (!$this->errors) {
if ($product->add()
// && Category::duplicateProductCategories($id_product_old, $product->id)
&& Product::duplicateSuppliers($id_product_old, $product->id)
&& ($combination_images = Product::duplicateAttributes($id_product_old, $product->id)) !== false
&& GroupReduction::duplicateReduction($id_product_old, $product->id)
&& Product::duplicateAccessories($id_product_old, $product->id)
&& Product::duplicateFeatures($id_product_old, $product->id)
&& Pack::duplicate($id_product_old, $product->id)
&& Product::duplicateCustomizationFields($id_product_old, $product->id)
&& Product::duplicateTags($id_product_old, $product->id)
&& Product::duplicateDownload($id_product_old, $product->id)
) {
$obj_hotel_room_type = new HotelRoomType();
$room_type_info = $obj_hotel_room_type->getRoomTypeInfoByIdProduct($id_product_old);
$id_room_type_old = $room_type_info['id'];
if (!$id_hotel_new) {
$id_hotel_new = $room_type_info['id_hotel'];
}
$id_room_type_new = HotelRoomType::duplicateRoomType(
$id_product_old,
$product->id,
$id_hotel_new,
true
);
if ($id_room_type_new) {
if (!HotelRoomType::duplicateRooms(
if ($product->hasAttributes()) {
Product::updateDefaultAttribute($product->id);
} else {
Product::duplicateSpecificPrices($id_product_old, $product->id);
}
$id_room_type_new = HotelRoomType::duplicateRoomType(
$id_product_old,
$id_room_type_new,
$product->id,
$id_hotel_new
)) {
$this->errors[] = Tools::displayError('An error occurred while duplicating rooms.');
$id_hotel_new,
true
);
if ($id_room_type_new) {
if (!HotelRoomType::duplicateRooms(
$id_product_old,
$id_room_type_new,
$product->id,
$id_hotel_new
)) {
$this->errors[] = Tools::displayError('An error occurred while duplicating rooms.');
}
if (!HotelRoomTypeDemand::duplicateRoomTypeDemands($id_product_old, $product->id)) {
$this->errors[] = Tools::displayError(
'An error occurred while duplicating additional facilities.'
);
}
} else {
$this->errors[] = Tools::displayError('An error occurred while duplicating room type.');
}
if (!HotelRoomTypeDemand::duplicateRoomTypeDemands($id_product_old, $product->id)) {
$this->errors[] = Tools::displayError(
'An error occurred while duplicating additional facilities.'
);
}
} else {
$this->errors[] = Tools::displayError('An error occurred while duplicating room type.');
}
if (!Tools::getValue('noimage') && !Image::duplicateProductImages($id_product_old, $product->id, $combination_images)) {
$this->errors[] = Tools::displayError('An error occurred while copying images.');
} else {
Hook::exec('actionProductAdd', array('id_product' => (int)$product->id, 'product' => $product));
if (in_array($product->visibility, array('both', 'search')) && Configuration::get('PS_SEARCH_INDEXATION')) {
Search::indexation(false, $product->id);
if (!Tools::getValue('noimage') && !Image::duplicateProductImages($id_product_old, $product->id, $combination_images)) {
$this->errors[] = Tools::displayError('An error occurred while copying images.');
} else {
Hook::exec('actionProductAdd', array('id_product' => (int)$product->id, 'product' => $product));
if (in_array($product->visibility, array('both', 'search')) && Configuration::get('PS_SEARCH_INDEXATION')) {
Search::indexation(false, $product->id);
}
$this->redirect_after = self::$currentIndex.(Tools::getIsset('id_category') ? '&id_category='.(int)Tools::getValue('id_category') : '').'&conf=19&token='.$this->token;
}
$this->redirect_after = self::$currentIndex.(Tools::getIsset('id_category') ? '&id_category='.(int)Tools::getValue('id_category') : '').'&conf=19&token='.$this->token;
} else {
$this->errors[] = Tools::displayError('An error occurred while creating an object.');
}
} else {
$this->errors[] = Tools::displayError('An error occurred while creating an object.');
}
}
}
@@ -1503,8 +1568,7 @@ class AdminProductsControllerCore extends AdminController
'ajaxfileupload',
'date',
'tagify',
'select2',
'validate'
'select2'
));
$this->addJS(array(
@@ -2172,15 +2236,15 @@ class AdminProductsControllerCore extends AdminController
}
// Check description short size without html
$limit = (int)Configuration::get('PS_PRODUCT_SHORT_DESC_LIMIT');
$limit = (int)Configuration::get('PS_SHORT_DESC_LIMIT');
if ($limit <= 0) {
$limit = 400;
$limit = Configuration::PS_SHORT_DESC_LIMIT;
}
foreach ($languages as $language) {
if ($this->isProductFieldUpdated('description_short', $language['id_lang']) && ($value = Tools::getValue('description_short_'.$language['id_lang']))) {
if (Tools::strlen(strip_tags($value)) > $limit) {
$this->errors[] = sprintf(
Tools::displayError('This %1$s field (%2$s) is too long: %3$d chars max (current count %4$d).'),
Tools::displayError('This %1$s field in %2$s is too long: %3$d chars max (current count %4$d).'),
call_user_func(array($className, 'displayFieldName'), 'description_short'),
$language['name'],
$limit,
@@ -4371,7 +4435,7 @@ class AdminProductsControllerCore extends AdminController
'token' => $this->token,
'currency' => $currency,
'link' => $this->context->link,
'PS_PRODUCT_SHORT_DESC_LIMIT' => Configuration::get('PS_PRODUCT_SHORT_DESC_LIMIT') ? Configuration::get('PS_PRODUCT_SHORT_DESC_LIMIT') : 400,
'PS_SHORT_DESC_LIMIT' => Configuration::get('PS_SHORT_DESC_LIMIT') ? Configuration::get('PS_SHORT_DESC_LIMIT') : Configuration::PS_SHORT_DESC_LIMIT,
'category_position' => Tools::getValue('category_position', $product->getPositionInCategory()),
));
$data->assign($this->tpl_form_vars);

View File

@@ -419,7 +419,7 @@ class ProductControllerCore extends FrontController
)
);
$occupancy_value = array();
$occupancy_value = Tools::getValue('occupancy', array());
if (Configuration::get('PS_FRONT_ROOM_UNIT_SELECTION_TYPE') == HotelBookingDetail::PS_ROOM_UNIT_SELECTION_TYPE_QUANTITY) {
$occupancy_value = 1;
} else {
@@ -450,10 +450,10 @@ class ProductControllerCore extends FrontController
// product price after imposing feature prices...
if ($useTax) {
$priceProduct = Product::getPriceStatic($this->product->id, true);
$feature_price = HotelRoomTypeFeaturePricing::getRoomTypeFeaturePricesPerDay($this->product->id, $date_from, $date_to, true);
$feature_price = HotelRoomTypeFeaturePricing::getRoomTypeFeaturePricesPerDay($this->product->id, $date_from, $date_to, true, 0, 0, 0, 0, 1, 1, $occupancy_value);
} else {
$priceProduct = Product::getPriceStatic($this->product->id, false);
$feature_price = HotelRoomTypeFeaturePricing::getRoomTypeFeaturePricesPerDay($this->product->id, $date_from, $date_to, false);
$feature_price = HotelRoomTypeFeaturePricing::getRoomTypeFeaturePricesPerDay($this->product->id, $date_from, $date_to, false, 0, 0, 0, 0, 1, 1, $occupancy_value);
}
$productPriceWithoutReduction = $this->product->getPriceWithoutReduct(!$useTax);
$feature_price_diff = (float)($productPriceWithoutReduction - $feature_price);
@@ -649,7 +649,7 @@ class ProductControllerCore extends FrontController
$idProduct,
$dateFrom,
$dateTo,
0,
$occupancy,
0,
0,
0,
@@ -660,7 +660,8 @@ class ProductControllerCore extends FrontController
$roomTypeDateRangePrice = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice(
$idProduct,
$dateFrom,
$dateTo
$dateTo,
$occupancy
);
$featurePrice = 0;
@@ -669,7 +670,14 @@ class ProductControllerCore extends FrontController
$idProduct,
$dateFrom,
$dateTo,
true
true,
0,
0,
0,
0,
1,
1,
$occupancy
);
$roomTypeDateRangePrice = $roomTypeDateRangePrice['total_price_tax_incl'];
$totalPriceWithoutDiscount = $priceWithoutDiscount['total_price_tax_incl'];
@@ -679,14 +687,20 @@ class ProductControllerCore extends FrontController
$idProduct,
$dateFrom,
$dateTo,
false
false,
0,
0,
0,
0,
1,
1,
$occupancy
);
$roomTypeDateRangePrice = $roomTypeDateRangePrice['total_price_tax_excl'];
$totalPriceWithoutDiscount = $priceWithoutDiscount['total_price_tax_excl'];
}
$totalPriceWithoutDiscount *= $quantity;
$totalRoomPrice = $roomTypeDateRangePrice * $quantity;
$totalRoomPrice = $roomTypeDateRangePrice;
// calculate demand price now
$demandsPricePerRoom = 0;
$roomTypeDemands = $objHRTDemand->getRoomTypeDemands($idProduct);

View File

@@ -241,7 +241,7 @@ class Blockcart extends Module
$objProduct->id,
$addedProduct['date_from'],
$addedProduct['date_to'],
$addedProduct['req_rm']
$addedProduct['occupancy']
);
if ($priceDisplayMethod == PS_TAX_EXC) {
$addedProduct['price'] = Tools::displayPrice($price['total_price_tax_excl']);

View File

@@ -105,11 +105,18 @@ class HotelAdvancedPayment extends ObjectModel
$objHtlCartBook = new HotelCartBookingData();
if ($roomTypesByIdProduct = $objHtlCartBook->getCartInfoIdCartIdProduct((int) $idCart, (int)$idProduct)) {
foreach ($roomTypesByIdProduct as $cartRoomInfo) {
$occupancy = array(
array(
'adults' => $cartRoomInfo['adults'],
'children' => $cartRoomInfo['children'],
'child_ages' => json_decode($cartRoomInfo['child_ages'])
)
);
$roomTotalPrices = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice(
$cartRoomInfo['id_product'],
$cartRoomInfo['date_from'],
$cartRoomInfo['date_to'],
0,
$occupancy,
0,
$idCart,
$cartRoomInfo['id_guest'],

View File

@@ -1701,14 +1701,14 @@ class HotelBookingDetail extends ObjectModel
continue;
}
}
$productFeaturePrice = HotelRoomTypeFeaturePricing::getRoomTypeFeaturePricesPerDay($value['id_product'], $date_from, $date_to, self::useTax());
$productFeaturePrice = HotelRoomTypeFeaturePricing::getRoomTypeFeaturePricesPerDay($value['id_product'], $date_from, $date_to, self::useTax(), 0, 0, 0, 0, 1, 1, $bookingParams['occupancy']);
if (!empty($price) && ($price['from'] > $productFeaturePrice || $price['to'] < $productFeaturePrice)) {
unset($bookingData['rm_data'][$key]);
continue;
}
if (count($value['data']['available'])) {
$prod_price = Product::getPriceStatic($value['id_product'], self::useTax());
$productPriceWithoutReduction = HotelRoomTypeFeaturePricing::getRoomTypeFeaturePricesPerDay($value['id_product'], $date_from, $date_to, self::useTax(), 0, 0, 0, 0, 1, 0);
$productPriceWithoutReduction = HotelRoomTypeFeaturePricing::getRoomTypeFeaturePricesPerDay($value['id_product'], $date_from, $date_to, self::useTax(), 0, 0, 0, 0, 1, 0, $bookingParams['occupancy']);
$cover_image_arr = Product::getCover($value['id_product']);
if (!empty($cover_image_arr)) {
$cover_img = $this->context->link->getImageLink($value['link_rewrite'], $value['id_product'].'-'.$cover_image_arr['id_image'], 'home_default');
@@ -2064,11 +2064,19 @@ class HotelBookingDetail extends ObjectModel
$objBookingDetail->children = $objCartBookingData->children;
$objBookingDetail->child_ages = $objCartBookingData->child_ages;
$occupancy = array(
array(
'adults' => $objCartBookingData->adults,
'children' => $objCartBookingData->children,
'child_ages' => json_decode($objCartBookingData->child_ages)
)
);
$totalRoomTypePrice = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice(
$idNewRoomType,
$objCartBookingData->date_from,
$objCartBookingData->date_to,
0,
$occupancy,
Group::getCurrent()->id,
$this->context->cart->id,
$this->context->cookie->id_guest,

View File

@@ -1186,6 +1186,23 @@ class HotelBranchInformation extends ObjectModel
return parent::validateFields($die, $error_return);
}
/**
* @see ObjectModel::validateField()
*/
public function validateField($field, $value, $id_lang = null, $skip = array(), $human_errors = false)
{
if ($field == 'short_description') {
$limit = (int)Configuration::get('PS_SHORT_DESC_LIMIT');
if ($limit <= 0) {
$limit = Configuration::PS_SHORT_DESC_LIMIT;
}
$this->def['fields']['short_description']['size'] = $limit;
}
return parent::validateField($field, $value, $id_lang, $skip, $human_errors);
}
// Webservice :: function will run when hotel deleted from API
public function deleteWs()
{

View File

@@ -346,7 +346,8 @@ class HotelCartBookingData extends ObjectModel
$idRoom = 0,
$dateFrom = 0,
$dateTo = 0,
$updPsCart = 1
$updPsCart = 1,
$idOrder = 0
) {
$where = '1';
if ($idCart) {
@@ -364,8 +365,8 @@ class HotelCartBookingData extends ObjectModel
if ($dateTo) {
$where .= ' AND `date_to`=\''.pSQL($dateTo).'\'';
}
// we have to delete only rows which order is not created
$where .= ' AND `id_order`= 0';
$where .= ' AND `id_order`='.(int) $idOrder;
// If rooms is deleting from cart the we need to delete the ps_cart quantity of the product from table
// if product will delete the prestashop will handle
$numRooms = 0;
@@ -1114,7 +1115,13 @@ class HotelCartBookingData extends ObjectModel
$cart_detail_data[$key]['date_to'] = $value['date_to'];
$cart_detail_data[$key]['child_ages'] = json_decode($value['child_ages']);
$occupancy = array(
array(
'adults' => $value['adults'],
'children' => $value['children'],
'child_ages' => json_decode($value['child_ages'])
)
);
$unit_price = Product::getPriceStatic($value['id_product'], true);
$unit_price_tax_excl = Product::getPriceStatic($value['id_product'], false);
$productPriceWithoutReduction = $productObj->getPriceWithoutReduct(false);
@@ -1127,7 +1134,9 @@ class HotelCartBookingData extends ObjectModel
$id_cart,
$value['id_guest'],
$value['id_room'],
0
0,
1,
$occupancy
);
$feature_price_tax_excl = HotelRoomTypeFeaturePricing::getRoomTypeFeaturePricesPerDay(
$value['id_product'],
@@ -1138,7 +1147,9 @@ class HotelCartBookingData extends ObjectModel
$id_cart,
$value['id_guest'],
$value['id_room'],
0
0,
1,
$occupancy
);
$feature_price_diff = (float)($productPriceWithoutReduction - $feature_price);
$cart_detail_data[$key]['product_price'] = $unit_price;
@@ -1240,7 +1251,7 @@ class HotelCartBookingData extends ObjectModel
$value['id_product'],
$value['date_from'],
$value['date_to'],
0,
$occupancy,
0,
$id_cart,
$value['id_guest'],
@@ -1558,7 +1569,13 @@ class HotelCartBookingData extends ObjectModel
1
);
$totalAdditionalServicePrice = $demandPrice + $serviceProductPrice;
$occupancy = array(
array(
'adults' => $data_v['adults'],
'children' => $data_v['children'],
'child_ages' => json_decode($data_v['child_ages'])
)
);
if (isset($cartHotelData[$prodKey]['date_diff'][$dateJoin])) {
$numDays = $objBookingDetail->getNumberOfDays($data_v['date_from'], $data_v['date_to']);
$cartHotelData[$prodKey]['date_diff'][$dateJoin]['demand_price'] += $totalAdditionalServicePrice;
@@ -1574,7 +1591,7 @@ class HotelCartBookingData extends ObjectModel
$product['id_product'],
$data_v['date_from'],
$data_v['date_to'],
0,
$occupancy,
0,
$context->cart->id,
$context->cart->id_guest,
@@ -1584,7 +1601,7 @@ class HotelCartBookingData extends ObjectModel
$product['id_product'],
$data_v['date_from'],
$data_v['date_to'],
0,
$occupancy,
0,
$context->cart->id,
$context->cart->id_guest,
@@ -1595,7 +1612,7 @@ class HotelCartBookingData extends ObjectModel
$product['id_product'],
$data_v['date_from'],
$data_v['date_to'],
0,
$occupancy,
0,
$context->cart->id,
$context->cart->id_guest,
@@ -1636,7 +1653,7 @@ class HotelCartBookingData extends ObjectModel
$product['id_product'],
$data_v['date_from'],
$data_v['date_to'],
0,
$occupancy,
0,
$context->cart->id,
$context->cart->id_guest,
@@ -1646,7 +1663,7 @@ class HotelCartBookingData extends ObjectModel
$product['id_product'],
$data_v['date_from'],
$data_v['date_to'],
0,
$occupancy,
0,
$context->cart->id,
$context->cart->id_guest,
@@ -1657,7 +1674,7 @@ class HotelCartBookingData extends ObjectModel
$product['id_product'],
$data_v['date_from'],
$data_v['date_to'],
0,
$occupancy,
0,
$context->cart->id,
$context->cart->id_guest,

View File

@@ -636,7 +636,7 @@ class HotelRoomTypeFeaturePricing extends ObjectModel
$id_product,
$date_from,
$date_to,
$quantity = 0,
$occupancy = null,
$id_group = 0,
$id_cart = 0,
$id_guest = 0,
@@ -657,6 +657,12 @@ class HotelRoomTypeFeaturePricing extends ObjectModel
$taxRate = 0;
}
if (is_array($occupancy) && count($occupancy)) {
$quantity = count($occupancy);
} else {
$quantity = $occupancy;
}
// Initializations
if (!$id_group) {
$id_group = (int)Group::getCurrent()->id;
@@ -726,7 +732,8 @@ class HotelRoomTypeFeaturePricing extends ObjectModel
'id_guest' => $id_guest,
'id_group' => $id_group,
'use_reduc' => $use_reduc,
'tax_rate' => $taxRate
'tax_rate' => $taxRate,
'occupancy' => $occupancy
)
);
if ($with_auto_room_services) {
@@ -805,7 +812,8 @@ class HotelRoomTypeFeaturePricing extends ObjectModel
$id_guest = 0,
$id_room = 0,
$with_auto_room_services = 1,
$use_reduc = 1
$use_reduc = 1,
$occupancy = array()
) {
$dateFrom = date('Y-m-d H:i:s', strtotime($date_from));
$dateTo = date('Y-m-d H:i:s', strtotime($date_to));
@@ -813,7 +821,7 @@ class HotelRoomTypeFeaturePricing extends ObjectModel
$id_product,
$dateFrom,
$dateTo,
0,
$occupancy,
$id_group,
$id_cart,
$id_guest,

View File

@@ -230,7 +230,7 @@ class RoomTypeServiceProductCartDetail extends ObjectModel
$idLang = Context::getContext()->language->id;
$sql = 'SELECT rscd.`id_product`, rscd.`quantity`, cbd.`id_cart`, cbd.`id` as `htl_cart_booking_id` ,
$sql = 'SELECT rscd.`id_product`, rscd.`quantity`, cbd.`id_cart`, rscd.`id_cart` as service_id_cart, cbd.`id` as `htl_cart_booking_id` ,
cbd.`id_product` as `room_type_id_product`, cbd.`adults`, cbd.`children`, cbd.`date_from`, cbd.`date_to`';
if (!$getTotalPrice) {
$sql .= ', pl.`name`, cbd.`id_guest`, cbd.`id_customer`, p.`auto_add_to_cart`, p.`price_addition_type`,
@@ -246,7 +246,8 @@ class RoomTypeServiceProductCartDetail extends ObjectModel
$sql .= ' LEFT JOIN `'._DB_PREFIX_.'product_lang` pl
ON (pl.`id_product` = p.`id_product` AND pl.`id_lang` = '.(int)$idLang.')';
}
$sql .= ' WHERE 1';
$sql .= ' WHERE 1 AND rscd.`id_product`!=0';
if (!is_null($autoAddToCart)) {
$sql .= ' AND p.`auto_add_to_cart` = '. (int)$autoAddToCart;
@@ -347,6 +348,7 @@ class RoomTypeServiceProductCartDetail extends ObjectModel
'name' => $product['name'],
'quantity' => $product['quantity'],
'auto_add_to_cart' => $product['auto_add_to_cart'],
'id_cart' => $product['service_id_cart'],
'allow_multiple_quantity' => $product['allow_multiple_quantity'],
'price_addition_type' => $product['price_addition_type'],
'price_calculation_method' => $product['price_calculation_method'],
@@ -462,6 +464,7 @@ class RoomTypeServiceProductCartDetail extends ObjectModel
'quantity' => $product['quantity'],
'auto_add_to_cart' => $product['auto_add_to_cart'],
'allow_multiple_quantity' => $product['allow_multiple_quantity'],
'id_cart' => $product['service_id_cart'],
'price_addition_type' => $product['price_addition_type'],
'price_calculation_method' => $product['price_calculation_method'],
'unit_price_tax_excl' => ($objRoomTypeServiceProductPrice->getServicePrice(

View File

@@ -254,6 +254,7 @@ class RoomTypeServiceProductOrderDetail extends ObjectModel
'id_order_detail' => $product['id_order_detail'],
'id_product' => $product['id_product'],
'name' => $product['name'],
'id_cart' => $product['id_cart'],
'quantity' => $product['quantity'],
'allow_multiple_quantity' => $product['product_allow_multiple_quantity'],
'max_quantity' => $product['max_quantity'],
@@ -280,6 +281,7 @@ class RoomTypeServiceProductOrderDetail extends ObjectModel
'id_order_detail' => $product['id_order_detail'],
'id_product' => $product['id_product'],
'name' => $product['name'],
'id_cart' => $product['id_cart'],
'quantity' => $product['quantity'],
'allow_multiple_quantity' => $product['product_allow_multiple_quantity'],
'max_quantity' => $product['max_quantity'],
@@ -323,4 +325,4 @@ class RoomTypeServiceProductOrderDetail extends ObjectModel
// delete entry from order detail table.
return parent::delete();
}
}
}

View File

@@ -123,6 +123,10 @@ class AdminAddHotelController extends ModuleAdminController
$smartyVars['currentLang'] = Language::getLanguage((int) $currentLangId);
$smartyVars['defaultCurrency'] = Configuration::get('PS_CURRENCY_DEFAULT');
$smartyVars['PS_SHORT_DESC_LIMIT'] = Configuration::get('PS_SHORT_DESC_LIMIT');
if (!$smartyVars['PS_SHORT_DESC_LIMIT']) {
$smartyVars['PS_SHORT_DESC_LIMIT'] = Configuration::PS_SHORT_DESC_LIMIT;
}
$countries = Country::getCountries($this->context->language->id, true);
$smartyVars['country_var'] = $countries;
@@ -264,6 +268,7 @@ class AdminAddHotelController extends ModuleAdminController
$map_formated_address = Tools::getValue('locformatedAddr');
$map_input_text = Tools::getValue('googleInputField');
$hotelFeatures = Tools::getValue('id_features', array());
$shortDescriptionMaxChar = Configuration::get('PS_SHORT_DESC_LIMIT') ? Configuration::get('PS_SHORT_DESC_LIMIT') : Configuration::PS_SHORT_DESC_LIMIT;
// check if field is atleast in default language. Not available in default prestashop
$defaultLangId = Configuration::get('PS_LANG_DEFAULT');
@@ -280,45 +285,53 @@ class AdminAddHotelController extends ModuleAdminController
$this->errors[] = $this->l('Invalid Hotel name in ').$lang['name'];
}
}
if ($shortDescription = html_entity_decode(Tools::getValue('short_description_'.$lang['id_lang']))) {
if (!Validate::isCleanHtml($shortDescription)) {
$this->errors[] = sprintf($this->l('Short description is not valid in %s'), $lang['name']);
}
}
if ($description = html_entity_decode(Tools::getValue('description_'.$lang['id_lang']))) {
if (!Validate::isCleanHtml($description)) {
$this->errors[] = sprintf($this->l('Description is not valid in %s'), $lang['name']);
}
}
if ($policies = html_entity_decode(Tools::getValue('policies_'.$lang['id_lang']))) {
if (!Validate::isCleanHtml($policies)) {
$this->errors[] = sprintf($this->l('policies are not valid in %s'), $lang['name']);
}
}
}
foreach ($languages as $lang) {
if ($shortDescription = html_entity_decode(Tools::getValue('short_description_'.$lang['id_lang']))) {
if (!Validate::isCleanHtml($shortDescription)) {
$this->errors[] = sprintf($this->l('Short description is not valid in %s'), $lang['name']);
}
if ($metaTitle = trim(Tools::getValue('meta_title_'.$lang['id_lang']))) {
if (!Validate::isGenericName($metaTitle)) {
$this->errors[] = $this->l('Invalid Meta title in ').$lang['name'];
} else if (Tools::strlen($metaTitle) > 128) {
$this->errors[] = $this->l('Meta title cannot be longer than 128 in ').$lang['name'];
}
$shortDescriptionLength = Tools::strlen($shortDescription);
if ($shortDescriptionLength > $shortDescriptionMaxChar) {
$this->errors[] = sprintf($this->l('Short description cannot exceed %s characters in '), $shortDescriptionMaxChar).$lang['name'];
}
}
if ($metaDescription = trim(Tools::getValue('meta_description_'.$lang['id_lang']))) {
if (!Validate::isGenericName($metaDescription)) {
$this->errors[] = $this->l('Invalid Meta description in ').$lang['name'];
} else if (Tools::strlen($metaDescription) > 255) {
$this->errors[] = $this->l('Meta description cannot be longer than 128 in ').$lang['name'];
}
if ($description = html_entity_decode(Tools::getValue('description_'.$lang['id_lang']))) {
if (!Validate::isCleanHtml($description)) {
$this->errors[] = sprintf($this->l('Description is not valid in %s'), $lang['name']);
}
}
if ($policies = html_entity_decode(Tools::getValue('policies_'.$lang['id_lang']))) {
if (!Validate::isCleanHtml($policies)) {
$this->errors[] = sprintf($this->l('policies are not valid in %s'), $lang['name']);
}
}
if ($metaKeyWords = trim(Tools::getValue('meta_keywords_'.$lang['id_lang']))) {
if (!Validate::isGenericName($metaKeyWords)) {
$this->errors[] = $this->l('Invalid Meta keywords in ').$lang['name'];
} else if (Tools::strlen($metaKeyWords) > 255) {
$this->errors[] = $this->l('Meta keywords cannot be longer than 128 in ').$lang['name'];
}
if ($metaTitle = trim(Tools::getValue('meta_title_'.$lang['id_lang']))) {
if (!Validate::isGenericName($metaTitle)) {
$this->errors[] = $this->l('Invalid Meta title in ').$lang['name'];
} else if (Tools::strlen($metaTitle) > 128) {
$this->errors[] = $this->l('Meta title cannot exceed 128 characters in ').$lang['name'];
}
}
if ($metaDescription = trim(Tools::getValue('meta_description_'.$lang['id_lang']))) {
if (!Validate::isGenericName($metaDescription)) {
$this->errors[] = $this->l('Invalid Meta description in ').$lang['name'];
} else if (Tools::strlen($metaDescription) > 255) {
$this->errors[] = $this->l('Meta description cannot exceed 128 characters in ').$lang['name'];
}
}
if ($metaKeyWords = trim(Tools::getValue('meta_keywords_'.$lang['id_lang']))) {
if (!Validate::isGenericName($metaKeyWords)) {
$this->errors[] = $this->l('Invalid Meta keywords in ').$lang['name'];
} else if (Tools::strlen($metaKeyWords) > 255) {
$this->errors[] = $this->l('Meta keywords cannot exceed 128 characters in ').$lang['name'];
}
}
}
@@ -502,18 +515,16 @@ class AdminAddHotelController extends ModuleAdminController
);
}
$cleanShortDescription = Tools::getDescriptionClean(
Tools::getValue('short_description_'.$lang['id_lang'])
);
$cleanShortDescription = Tools::getDescriptionClean(Tools::getValue('short_description_'.$lang['id_lang']));
//Remove TinyMCE's Non-Breaking Spaces
$cleanShortDescription = str_replace(chr(0xC2).chr(0xA0), "", $cleanShortDescription);
if (!trim($cleanShortDescription)) {
$objHotelBranch->short_description[$lang['id_lang']] = Tools::getValue(
'short_description_'.$defaultLangId
$objHotelBranch->short_description[$lang['id_lang']] = Tools::getDescriptionClean(
Tools::getValue('short_description_'.$defaultLangId)
);
} else {
$objHotelBranch->short_description[$lang['id_lang']] = Tools::getValue(
'short_description_'.$lang['id_lang']
$objHotelBranch->short_description[$lang['id_lang']] = Tools::getDescriptionClean(
Tools::getValue('short_description_'.$lang['id_lang'])
);
}
$cleanDescription = Tools::getDescriptionClean(

View File

@@ -189,8 +189,7 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController
)) {
$this->errors[] = $this->l('An advanced price rule already exists in which some dates are common with this
plan. Please select a different date range.');
$this->errors[] = $this->l('An advanced price rule already exists in which some dates are common with this plan. Please select a different date range.');
return ;
}
}
@@ -202,17 +201,21 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController
public function initToolbar()
{
parent::initToolbar();
$this->page_header_toolbar_btn['new'] = array(
'href' => self::$currentIndex.'&add'.$this->table.'&token='.$this->token,
'desc' => $this->l('Add new rule'),
'imgclass' => 'new'
);
if (empty($this->display) || $this->display == 'list') {
$this->page_header_toolbar_btn['new'] = array(
'href' => self::$currentIndex.'&add'.$this->table.'&token='.$this->token,
'desc' => $this->l('Add new rule'),
'imgclass' => 'new'
);
}
$this->toolbar_btn = array();
}
public function renderList()
{
$this->addRowAction('edit');
$this->addRowAction('delete');
return parent::renderList();
}
@@ -245,17 +248,42 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController
$smartyVars['edit'] = 1;
$smartyVars['feature_price_groups'] = $objFeaturePrice->getGroups($idFeaturePrice);
} else {
$tree = new HelperTree('hotels-tree');
if ($treeData = HotelHelper::generateTreeData([
'rootNode' => HotelHelper::NODE_HOTEL,
'leafNode' => HotelHelper::NODE_ROOM_TYPE,
'selectedElements' => array(
'room_type' => Tools::getValue('room_type_box', array())
)
])) {
foreach ($treeData as $idHotel => $data) {
if (!isset($data['children']) || empty($data['children'])) {
unset($treeData[$idHotel]);
}
}
}
$tree->setData($treeData)
->setUseCheckBox(true)
->setAutoSelectChildren(true)
->setUseBulkActions(true)
->setUseSearch(true);
$smartyVars['hotel_tree'] = $tree->render();
}
$smartyVars['defaultcurrency_sign'] = $currencySign;
$smartyVars['date_from'] = $dateFrom;
$smartyVars['date_to'] = $dateTo;
$smartyVars['groups'] = Group::getGroups($this->context->language->id);
$this->context->smarty->assign($smartyVars);
$this->fields_form = array(
'submit' => array(
'title' => $this->l('Save'),
),
);
return parent::renderForm();
}
@@ -343,151 +371,196 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController
$groups = Tools::getValue('groupBox');
$jsonSpecialDays = json_encode($specialDays);
$defaultLangId = Configuration::get('PS_LANG_DEFAULT');
$createMultiple = Tools::getValue('create_multiple');
$objFeaturePricing = new HotelRoomTypeFeaturePricing();
if ($priceImpactWay == HotelRoomTypeFeaturePricing::IMPACT_WAY_FIX_PRICE) {
$priceImpactType = HotelRoomTypeFeaturePricing::IMPACT_TYPE_FIXED_PRICE;
}
$languages = Language::getLanguages(false);
$objDefaultLang = new language($defaultLangId);
$objDefaultLang = new Language($defaultLangId);
if (!($priceRuleNameDefault = Tools::getValue('feature_price_name_'.$defaultLangId))) {
$this->errors[] = sprintf($this->l('Advanced price rule name is required at least in %s'), $objDefaultLang->name);
} else {
if (preg_match('{room_type_name}', $priceRuleNameDefault)) {
$priceRuleNameDefault = str_replace('{room_type_name}', '%s', $priceRuleNameDefault);
}
}
$toUpdatePriceRuleName = false;
$validateRules = call_user_func(
array('HotelRoomTypeFeaturePricing', 'getValidationRules'),
'HotelRoomTypeFeaturePricing'
);
foreach ($languages as $lang) {
$priceRuleName = Tools::getValue('feature_price_name_'.$lang['id_lang']);
if (preg_match('{room_type_name}', $priceRuleName)) {
$priceRuleName = str_replace('{room_type_name}', '%s', $priceRuleName);
$toUpdatePriceRuleName = true;
}
if (!Validate::isCatalogName($priceRuleName)) {
$this->errors[] = $this->l('Advanced price rule name is invalid in ').$lang['name'];
} elseif (Tools::strlen($priceRuleName) > $validateRules['sizeLang']['feature_price_name']) {
$this->errors[] = sprintf(
$this->l('Advanced price rule Name field is too long (%d chars max) in ').$lang['name'],
$validateRules['sizeLang']['feature_price_name'],
);
}
}
$featurePricingName = array();
$roomTypeIds = array();
if (!$createMultiple) {
if ($roomTypeId) {
$roomTypeIds = array($roomTypeId);
} else {
$this->errors[] = $this->l('Room type is not selected. Please try again.');
}
} else if (!$roomTypeIds = Tools::getValue('room_type_box')) {
$this->errors[] = $this->l('Please select at least one room type for creating multiple price rules.');
}
if ($roomTypeIds && !$this->errors) {
foreach ($roomTypeIds as $idRoomType) {
$objProduct = new Product((int) $idRoomType);
foreach ($languages as $lang) {
$priceRuleName = Tools::getValue('feature_price_name_'.$lang['id_lang']);
if ($priceRuleName && $toUpdatePriceRuleName) {
if (preg_match('{room_type_name}', $priceRuleName)) {
$priceRuleName = str_replace('{room_type_name}', $objProduct->name[$lang['id_lang']], $priceRuleName);
}
if (Tools::strlen($priceRuleName) > $validateRules['sizeLang']['feature_price_name']) {
$this->errors[] = sprintf(
$this->l('Advanced price rule Name field is too long (%d chars max) for "%s" room type in ').$lang['name'],
$validateRules['sizeLang']['feature_price_name'],
$objProduct->name[$lang['id_lang']]
);
}
}
if ($priceRuleName) {
$featurePricingName[$idRoomType][$lang['id_lang']] = $priceRuleName;
} else {
$featurePricingName[$idRoomType][$lang['id_lang']] = $priceRuleNameDefault;
}
}
}
}
if ($dateSelectionType == HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_SPECIFIC) {
$dateFrom = $specificDate;
$dateTo = date('Y-m-d', strtotime("+1 day", strtotime($specificDate)));
} else if ($dateSelectionType == HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_RANGE) {
if ($dateFrom == '') {
$this->errors[] = $this->l('Please choose Date from for the advanced price rule.');
}
if ($dateTo == '') {
$this->errors[] = $this->l('Please choose Date to for the advanced price rule.');
}
$dateFrom = date('Y-m-d', strtotime($dateFrom));
$dateTo = date('Y-m-d', strtotime($dateTo));
if (!Validate::isDate($dateFrom)) {
$this->errors[] = $this->l('Invalid Date From.');
}
if (!Validate::isDate($dateTo)) {
$this->errors[] = $this->l('Invalid Date To.');
}
if ($dateTo < $dateFrom) {
$this->errors[] = $this->l('Date To cannot be smaller than Date From.');
}
if ($isSpecialDaysExists) {
if (!isset($specialDays) || !$specialDays) {
$this->errors[] = $this->l('Please select at least one day for week days restriction.');
}
}
} else {
if ($specificDate == '') {
$this->errors[] = $this->l('Please choose Date from for the advanced price rule.');
}
$specificDate = date('Y-m-d', strtotime($specificDate));
if (!Validate::isDate($specificDate)) {
$this->errors[] = $this->l('Invalid Date From.');
}
}
if (!$impactValue) {
$this->errors[] = $this->l('Please enter a valid impact value.');
} else if (!Validate::isPrice($impactValue)) {
$this->errors[] = $this->l('Invalid value of impact value.');
}
if (!(bool)$groups) {
$this->errors[] = $this->l('Please select at least one group for the group access');
}
$isPlanTypeExists = 0;
if ($isSpecialDaysExists && $jsonSpecialDays == 'false') {
$this->errors[] = $this->l('Please select at least one day for week days restriction.');
} else {
$isPlanTypeExists = $this->validateExistingFeaturePrice(
$dateSelectionType,
$roomTypeId,
$dateFrom,
$dateTo,
$groups,
$idFeaturePrice,
$isSpecialDaysExists,
$jsonSpecialDays
);
}
if ($isPlanTypeExists) {
$this->errors[] = $this->l('An advanced price rule already exists in which some dates are common with this
plan. Please select a different date range.');
} else {
if (!$roomTypeId) {
$this->errors[] = $this->l('Room is not selected. Please try again.');
}
if (!Tools::getValue('feature_price_name_'.$defaultLangId)) {
$this->errors[] = sprintf(
$this->l('Advanced price rule name is required at least in %s'),
$objDefaultLang->name
if (empty($this->errors)) {
foreach ($roomTypeIds as $idRoomType) {
$isPlanTypeExists = $this->validateExistingFeaturePrice(
$dateSelectionType,
$idRoomType,
$dateFrom,
$dateTo,
$groups,
$idFeaturePrice,
$isSpecialDaysExists,
$jsonSpecialDays
);
if ($isPlanTypeExists) {
$objProduct = new Product((int) $idRoomType, false, $this->context->language->id);
$this->errors[] = sprintf($this->l('An advanced price rule already exists for "%s" for the selected date range. Please select a different date range.'), $objProduct->name);
}
}
$validateRules = call_user_func(
array('HotelRoomTypeFeaturePricing', 'getValidationRules'),
'HotelRoomTypeFeaturePricing'
);
foreach ($languages as $language) {
if (!Validate::isCatalogName(Tools::getValue('feature_price_name_'.$language['id_lang']))) {
$this->errors[] = $this->l('Advanced price rule name is invalid in ').$language['name'];
} elseif (Tools::strlen(Tools::getValue('feature_price_name_'.$language['id_lang'])) > $validateRules['sizeLang']['feature_price_name']) {
sprintf(
$this->l('Advanced price rule Name field is too long (%2$d chars max).'),
$validateRules['sizeLang']['feature_price_name']
}
if (!$isPlanTypeExists && !count($this->errors)) {
if ($idFeaturePrice) {
$objFeaturePricing = new HotelRoomTypeFeaturePricing($idFeaturePrice);
}
// lang fields
$objFeaturePricing->date_selection_type = $dateSelectionType;
$objFeaturePricing->date_from = $dateFrom;
$objFeaturePricing->date_to = $dateTo;
$objFeaturePricing->impact_way = $priceImpactWay;
$objFeaturePricing->is_special_days_exists = $isSpecialDaysExists;
$objFeaturePricing->special_days = $jsonSpecialDays;
$objFeaturePricing->impact_type = $priceImpactType;
$objFeaturePricing->impact_value = $impactValue;
$objFeaturePricing->active = $enableFeaturePrice;
// set the values of the groups for this feature price
$objFeaturePricing->groupBox = $groups;
$objFeaturePricing->id_product = $roomTypeId;
if ($createMultiple) {
foreach ($roomTypeIds as $idRoomType) {
$objFeaturePricing->id_product = $idRoomType;
$objFeaturePricing->feature_price_name = $featurePricingName[$idRoomType];
$objFeaturePricing->add();
}
Tools::redirectAdmin(self::$currentIndex.'&conf=3&token='.$this->token);
} else {
$objFeaturePricing->feature_price_name = $featurePricingName[$roomTypeId];
}
if ($objFeaturePricing->save()) {
if (Tools::isSubmit('submitAdd'.$this->table.'AndStay')) {
Tools::redirectAdmin(
self::$currentIndex.'&id_feature_price='.(int) $objFeaturePricing->id.
'&update'.$this->table.'&conf=4&token='.$this->token
);
}
}
if ($dateSelectionType == HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_RANGE) {
if ($dateFrom == '') {
$this->errors[] = $this->l('Please choose Date from for the advanced price rule.');
}
if ($dateTo == '') {
$this->errors[] = $this->l('Please choose Date to for the advanced price rule.');
}
$dateFrom = date('Y-m-d', strtotime($dateFrom));
$dateTo = date('Y-m-d', strtotime($dateTo));
if (!Validate::isDate($dateFrom)) {
$this->errors[] = $this->l('Invalid Date From.');
}
if (!Validate::isDate($dateTo)) {
$this->errors[] = $this->l('Invalid Date To.');
}
if ($dateTo < $dateFrom) {
$this->errors[] = $this->l('Date To must be a date after Date From.');
}
if ($isSpecialDaysExists) {
if (!isset($specialDays) || !$specialDays) {
$this->errors[] = $this->l('Please select at least one day for week days restriction.');
}
}
} else {
if ($specificDate == '') {
$this->errors[] = $this->l('Please choose Date from for the advanced price rule.');
}
$specificDate = date('Y-m-d', strtotime($specificDate));
if (!Validate::isDate($specificDate)) {
$this->errors[] = $this->l('Invalid Date From.');
}
}
if (!$impactValue) {
$this->errors[] = $this->l('Please enter a valid impact value.');
} else {
if (!Validate::isPrice($impactValue)) {
$this->errors[] = $this->l('Invalid value of impact value.');
}
}
if (!(bool)$groups) {
$this->errors[] = $this->l('Please select at least one group for the group access');
}
if (!count($this->errors)) {
if ($idFeaturePrice) {
$objFeaturePricing = new HotelRoomTypeFeaturePricing($idFeaturePrice);
}
$objFeaturePricing->id_product = $roomTypeId;
// lang fields
foreach ($languages as $language) {
if (Tools::getValue('feature_price_name_'.$language['id_lang'])) {
$objFeaturePricing->feature_price_name[$language['id_lang']] = Tools::getValue(
'feature_price_name_'.$language['id_lang']
);
} else {
$objFeaturePricing->feature_price_name[$language['id_lang']] = Tools::getValue(
'feature_price_name_'.$defaultLangId
);
}
}
$objFeaturePricing->date_selection_type = $dateSelectionType;
$objFeaturePricing->date_from = $dateFrom;
$objFeaturePricing->date_to = $dateTo;
$objFeaturePricing->impact_way = $priceImpactWay;
$objFeaturePricing->is_special_days_exists = $isSpecialDaysExists;
$objFeaturePricing->special_days = $jsonSpecialDays;
$objFeaturePricing->impact_type = $priceImpactType;
$objFeaturePricing->impact_value = $impactValue;
$objFeaturePricing->active = $enableFeaturePrice;
// set the values of the groups for this feature price
$objFeaturePricing->groupBox = $groups;
if ($objFeaturePricing->save()) {
if (Tools::isSubmit('submitAdd'.$this->table.'AndStay')) {
Tools::redirectAdmin(
self::$currentIndex.'&id_feature_price='.(int) $objFeaturePricing->id.
'&update'.$this->table.'&conf=4&token='.$this->token
);
} else {
Tools::redirectAdmin(self::$currentIndex.'&conf=4&token='.$this->token);
}
} else {
$this->errors[] = $this->l('Some error occured while saving advanced price rule.');
Tools::redirectAdmin(self::$currentIndex.'&conf=4&token='.$this->token);
}
} else {
$this->errors[] = $this->l('Some error occured while saving advanced price rule.');
}
}
if (isset($idFeaturePrice) && $idFeaturePrice) {
@@ -499,15 +572,14 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController
public function ajaxProcessSearchProductByName()
{
$productName = Tools::getValue('room_type_name');
if ($productName) {
$productsByName = Product::searchByName($this->context->language->id, $productName);
// filter room types as per accessed hotels
$productsByName = HotelBranchInformation::filterDataByHotelAccess(
$productsByName,
$this->context->employee->id_profile
);
if ($productsByName) {
$response = array('status' => 'failed');
if ($productName = Tools::getValue('room_type_name')) {
if ($productsByName = Product::searchByName($this->context->language->id, $productName)) {
$productsByName = HotelBranchInformation::filterDataByHotelAccess(
$productsByName,
$this->context->employee->id_profile
);
// filter room types as per accessed hotels
foreach ($productsByName as &$product) {
$hotelRoomType = new HotelRoomType();
$roomInfoByIdProduct = $hotelRoomType->getRoomTypeInfoByIdProduct($product['id_product']);
@@ -517,22 +589,16 @@ class AdminHotelFeaturePricesSettingsController extends ModuleAdminController
$product['name'].= ' / '.$onjBranchInfo->hotel_name;
}
}
echo json_encode($productsByName, true);
die;
$response = $productsByName;
} else {
die(
json_encode(
array('status' => 'failed', 'msg' => $this->l('No match found for entered room type name.'))
)
);
$response['msg'] = $this->l('No match found for entered room type name.');
}
} else {
die(
json_encode(
array('status' => 'failed', 'msg' => $this->l('No match found for entered room type name.'))
)
);
$response['msg'] = $this->l('No match found for entered room type name.');
}
$this->ajaxDie(json_encode($response));
}
public function setMedia()

View File

@@ -199,7 +199,7 @@ class AdminHotelRoomsBookingController extends ModuleAdminController
$this->errors[] = $this->l('Selected room is not available for reallocation.');
} elseif (!in_array($idRoomToReallocate, array_column($availableRooms, 'id_room'))) {
$this->errors[] = $this->l('Selected room is not available for reallocation.');
} elseif (!Validate::isFloat($priceDiff)) {
} elseif (!Validate::isPrice($priceDiff)) {
$this->errors[] = $this->l('Invalid price difference of the room types.');
}
} else {
@@ -875,11 +875,18 @@ class AdminHotelRoomsBookingController extends ModuleAdminController
// if room is changing in the reallocation
if ($objHotelBooking->id_product != $idNewRoomType) {
$result['has_room_type_change'] = 1;
$occupancy = array(
array(
'adults' => $objHotelBooking->adults,
'children' => $objHotelBooking->children,
'child_ages' => json_decode($objHotelBooking->child_ages)
)
);
$newRoomTotalPrice = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice(
$idNewRoomType,
$objHotelBooking->date_from,
$objHotelBooking->date_to,
0,
$occupancy,
0,
0,
0,

View File

@@ -33,6 +33,8 @@ class AdminOrderRefundRequestsController extends ModuleAdminController
$this->_join .= ' LEFT JOIN `'._DB_PREFIX_.'customer` cust ON (cust.`id_customer` = ord.`id_customer`)';
$this->_orderWay = 'DESC';
$this->allow_export = true;
$this->_new_list_header_design = true;
if ($idOrder = Tools::getValue('id_order')) {
$this->_select .= ', orsl.`name` as `status_name`, ors.`color`, COUNT(ordrd.`id_order_return_detail`) as num_rooms';
$this->_join .= 'LEFT JOIN '._DB_PREFIX_.'order_return_state ors ON (ors.`id_order_return_state` = a.`state`)';
@@ -176,9 +178,83 @@ class AdminOrderRefundRequestsController extends ModuleAdminController
public function setCustomerLink($customerName, $row)
{
if ($this->action == 'export') {
return $customerName.' (#'.$row['id_customer'].')';
}
return '<a href="'.$this->context->link->getAdminLink('AdminCustomers').'&id_customer='.$row['id_customer'].'&viewcustomer">'.$customerName.' (#'.$row['id_customer'].')</a>';
}
public function getList(
$id_lang,
$order_by = null,
$order_way = null,
$start = 0,
$limit = null,
$id_lang_shop = false
){
if ($this->action == 'export' && empty($this->_listsql)) {
if (Tools::getValue('id_order')) {
$this->_select .= ', ordtl.*';
} else {
$this->_select .= ', GROUP_CONCAT(ordtl.`room_num`) AS `room_num`,
GROUP_CONCAT(DISTINCT ordtl.`room_type_name`) AS `room_type_name`,
ordtl.`hotel_name`, ordtl.`id_order`,
GROUP_CONCAT(ordtl.`date_from`) AS `date_from`,
GROUP_CONCAT(ordtl.`date_to`) AS `date_to`';
}
$this->_join .= ' LEFT JOIN (
SELECT GROUP_CONCAT(hbd.`room_num`) AS room_num,
GROUP_CONCAT(DISTINCT(hbd.`room_type_name`)) AS room_type_name,
ord.`id_order_return`, hbd.`hotel_name`, hbd.`id_order`,
GROUP_CONCAT(hbd.`date_from`) AS date_from,
GROUP_CONCAT(hbd.`date_to`) AS date_to
FROM `'._DB_PREFIX_.'order_return_detail` ord
LEFT JOIN `'._DB_PREFIX_.'htl_booking_detail` hbd ON ord.`id_htl_booking` = hbd.`id`
GROUP BY ord.`id_order_return`
) AS ordtl ON (ordtl.`id_order_return` = a.`id_order_return`)';
$this->fields_list = array_merge($this->fields_list, array(
'room_num' => array(
'title' => $this->l('Room num(s)')
),
'room_type_name' => array(
'title' => $this->l('Room type(s)'),
'callback' => 'getUniqueRoomTypeNames'
),
'hotel_name' => array(
'title' => $this->l('Hotel')
),
'date_from' => array(
'title' => $this->l('Date From')
),
'date_to' => array(
'title' => $this->l('Date To')
),
));
}
parent::getList(
$id_lang,
$order_by,
$order_way,
$start,
$limit,
$id_lang_shop
);
}
public function getUniqueRoomTypeNames($roomTypeNames, $tr)
{
if ($roomTypeNames) {
$roomTypeNames = explode(',', $roomTypeNames);
$roomTypeNames = array_unique($roomTypeNames);
$roomTypeNames = implode(',', $roomTypeNames);
}
return $roomTypeNames;
}
public function initToolbar()
{
parent::initToolbar();

View File

@@ -569,6 +569,28 @@ $(document).ready(function() {
/* ---- AdminHotelFeaturePricesSettingsController Admin ---- */
if ($('input[name="create_multiple"]:checked').val() == 1) {
$('.room-type-name').hide();
$('.room-type-name-tree').show();
$('[name="submitAddhtl_room_type_feature_pricingAndStay"]').hide();
} else {
$('.room-type-name').show();
$('[name="submitAddhtl_room_type_feature_pricingAndStay"]').show();
$('.room-type-name-tree').hide();
}
$(document).on('change', 'input[name="create_multiple"]', function() {
if ($('input[name="create_multiple"]:checked').val() == 1) {
$('.room-type-name').hide();
$('.room-type-name-tree').show();
$('[name="submitAddhtl_room_type_feature_pricingAndStay"]').hide();
} else {
$('.room-type-name').show();
$('[name="submitAddhtl_room_type_feature_pricingAndStay"]').show();
$('.room-type-name-tree').hide();
}
});
$('#date_selection_type').on('change', function() {
if ($('#date_selection_type').val() == date_selection_types.specific) {
$(".specific_date_type").show(200);

View File

@@ -150,8 +150,9 @@
<textarea
name="short_description_{$language.id_lang}"
id="short_description_{$language.id_lang}"
{if isset($PS_SHORT_DESC_LIMIT) && $PS_SHORT_DESC_LIMIT} maxlength="{$PS_SHORT_DESC_LIMIT|intval}"{/if}
cols="2" rows="3"
class="wk_tinymce form-control">{if isset($smarty.post.$short_desc_name)}{$smarty.post.$short_desc_name}{elseif isset($edit)}{$hotel_info.short_description[{$language.id_lang}]}{/if}</textarea>
class="form-control">{if isset($smarty.post.$short_desc_name)}{$smarty.post.$short_desc_name}{elseif isset($edit)}{$hotel_info.short_description[{$language.id_lang}]}{/if}</textarea>
</div>
{/foreach}
</div>

View File

@@ -32,7 +32,7 @@
<div class="form-group">
<label class="col-sm-3 control-label required" for="feature_price_name" >
{l s='Advanced Price Rule Name :' mod='hotelreservationsystem'}
{l s='Advanced Price Rule Name ' mod='hotelreservationsystem'}
</label>
<div class="col-lg-3">
{foreach from=$languages item=language}
@@ -55,43 +55,80 @@
</ul>
</div>
{/if}
<div class="col-lg-9 col-lg-offset-3">
<div class="help-block">
{l s='Use {room_type_name} to generate dynamic feature price names.' mod='hotelreservationsystem'}
</div>
</div>
</div>
{if !isset($objFeaturePrice) || !$objFeaturePrice->id}
<div class="form-group">
<label class="control-label col-lg-3">
<span class="label-tooltip" data-toggle="tooltip" data-html="true" title="" data-original-title="{l s='Enable this option to create advance price rules for multiple room types.' mod='hotelreservationsystem'}">
{l s='Create for multiple room types' mod='hotelreservationsystem'}
</span>
</label>
<div class="col-lg-9 ">
<span class="switch prestashop-switch fixed-width-lg">
<input type="radio" {if isset($smarty.post.create_multiple) && $smarty.post.create_multiple == 1}checked="checked" {/if} value="1" id="create_multiple_on" name="create_multiple">
<label for="create_multiple_on">{l s='Yes' mod='hotelreservationsystem'}</label>
<input {if !isset($smarty.post.create_multiple) || isset($smarty.post.create_multiple) && $smarty.post.create_multiple == 0} checked="checked" {/if} type="radio" value="0" id="create_multiple_off" name="create_multiple">
<label for="create_multiple_off">{l s='No' mod='hotelreservationsystem'}</label>
<a class="slide-button btn"></a>
</span>
</div>
</div>
{if isset($hotel_tree)}
<div class="form-group room-type-name-tree" style="display:none;">
<label class="col-sm-3 control-label required" for="feature_price_name" >
<span class="label-tooltip" data-toggle="tooltip" data-html="true" title="" data-original-title="{l s='Select the room types for which you are going to create this advanced price rule.' mod='hotelreservationsystem'}">
{l s='Room Types' mod='hotelreservationsystem'}
</span>
</label>
<div class="col-sm-7">
{$hotel_tree}
</div>
</div>
{/if}
{/if}
<div class="form-group room-type-name">
<label class="col-sm-3 control-label required" for="feature_price_name" >
{l s='Room Type :' mod='hotelreservationsystem'}
{l s='Room Type' mod='hotelreservationsystem'}
</label>
<div class="col-sm-3">
<input autocomplete="off" type="text" id="room_type_name" name="room_type_name" class="form-control" placeholder= "{l s='Enter room type name' mod='hotelreservationsystem'}" value="{if isset($productName)}{$productName}{/if}"/>
<input type="hidden" id="room_type_id" name="room_type_id" class="form-control" value="{if isset($objFeaturePrice->id_product)}{$objFeaturePrice->id_product}{else}0{/if}"/>
<div class="dropdown">
<ul class="room_type_search_results_ul"></ul>
</div>
<ul class="room_type_search_results_ul"></ul>
</div>
<p class="error-block" style="display:none; color: #CD5D5D;">{l s='No match found for this search. Please try with an existing name.' mod='hotelreservationsystem'}</p>
</div>
<div class="col-lg-9 col-lg-offset-3">
<div class="help-block">
{l s='Enter room type name and select the room for which you are going to create this advanced price rule.' mod='hotelreservationsystem'}
</div>
</div>
</div>
<div class="form-group">
<label for="date_selection_type" class="control-label col-lg-3">
{l s='Date Selection type :' mod='hotelreservationsystem'}
{l s='Date Selection type' mod='hotelreservationsystem'}
</label>
<div class="col-lg-3">
<select class="form-control" name="date_selection_type" id="date_selection_type">
<option value="{HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_RANGE}" {if isset($objFeaturePrice->date_selection_type) && $objFeaturePrice->date_selection_type == HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_RANGE}selected = "selected"{/if}>
<option value="{HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_RANGE}" {if (isset($smarty.post.date_selection_type) && $smarty.post.date_selection_type == HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_RANGE) || (isset($objFeaturePrice->date_selection_type) && $objFeaturePrice->date_selection_type == HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_RANGE)}selected = "selected"{/if}>
{l s='Date Range' mod='hotelreservationsystem'}
</option>
<option value="{HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_SPECIFIC}" {if isset($objFeaturePrice->date_selection_type) && $objFeaturePrice->date_selection_type == HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_SPECIFIC}selected = "selected"{/if}>
<option value="{HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_SPECIFIC}" {if (isset($smarty.post.date_selection_type) && $smarty.post.date_selection_type == HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_SPECIFIC) || (isset($objFeaturePrice->date_selection_type) && $objFeaturePrice->date_selection_type == HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_SPECIFIC)}selected = "selected"{/if}>
{l s='Specific Date' mod='hotelreservationsystem'}
</option>
</select>
</div>
</div>
<div class="form-group specific_date_type" {if isset($edit) && $edit}{if isset($objFeaturePrice->date_selection_type) && $objFeaturePrice->date_selection_type != HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_SPECIFIC}style="display:none;"{/if}{else}style="display:none;"{/if}>
<div class="form-group specific_date_type" {if (isset($smarty.post.date_selection_type) && $smarty.post.date_selection_type != HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_SPECIFIC) || (isset($objFeaturePrice->date_selection_type) && $objFeaturePrice->date_selection_type != HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_SPECIFIC)}style="display:none;"{else if !isset($edit) && !isset($smarty.post.date_selection_type)}style="display:none;"{/if}>
<label class="col-sm-3 control-label required" for="specific_date" >
{l s='Specific Date' mod='hotelreservationsystem'}
</label>
@@ -100,24 +137,24 @@
</div>
</div>
<div class="form-group date_range_type" {if isset($objFeaturePrice->date_selection_type) && $objFeaturePrice->date_selection_type == HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_SPECIFIC}style="display:none;"{/if}>
<div class="form-group date_range_type" {if (isset($objFeaturePrice->date_selection_type) && $objFeaturePrice->date_selection_type == HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_SPECIFIC) || (isset($smarty.post.date_selection_type) && $smarty.post.date_selection_type != HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_RANGE)}style="display:none;"{/if}>
<label class="col-sm-3 control-label required" for="date_form" >
{l s='Date From' mod='hotelreservationsystem'}
</label>
<div class="col-sm-3">
<input type="text" id="feature_plan_date_from" name="date_from" class="form-control datepicker-input" value="{if isset($objFeaturePrice->date_from)}{$objFeaturePrice->date_from|date_format:'%d-%m-%Y'}{else}{$date_from|date_format:'%d-%m-%Y'}{/if}" readonly/>
<input type="text" id="feature_plan_date_from" name="date_from" class="form-control datepicker-input" value="{if isset($smarty.post.date_from) && $smarty.post.date_from}{$smarty.post.date_from}{elseif isset($objFeaturePrice->date_from)}{$objFeaturePrice->date_from|date_format:'%d-%m-%Y'}{else}{$date_from|date_format:'%d-%m-%Y'}{/if}" readonly/>
</div>
</div>
<div class="form-group date_range_type" {if isset($objFeaturePrice->date_selection_type) && $objFeaturePrice->date_selection_type == HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_SPECIFIC}style="display:none;"{/if}>
<div class="form-group date_range_type" {if (isset($objFeaturePrice->date_selection_type) && $objFeaturePrice->date_selection_type == HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_SPECIFIC) || (isset($smarty.post.date_selection_type) && $smarty.post.date_selection_type != HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_RANGE)}style="display:none;"{/if}>
<label class="col-sm-3 control-label required" for="date_to" >
{l s='Date To' mod='hotelreservationsystem'}
</label>
<div class="col-sm-3">
<input type="text" id="feature_plan_date_to" name="date_to" class="form-control datepicker-input" value="{if isset($objFeaturePrice->date_to)}{$objFeaturePrice->date_to|date_format:'%d-%m-%Y'}{else}{$date_to|date_format:'%d-%m-%Y'}{/if}" readonly/>
<input type="text" id="feature_plan_date_to" name="date_to" class="form-control datepicker-input" value="{if isset($smarty.post.date_to) && $smarty.post.date_to}{$smarty.post.date_to}{elseif isset($objFeaturePrice->date_to)}{$objFeaturePrice->date_to|date_format:'%d-%m-%Y'}{else}{$date_to|date_format:'%d-%m-%Y'}{/if}" readonly/>
</div>
</div>
<div class="form-group special_days_content" {if isset($objFeaturePrice->date_selection_type) && $objFeaturePrice->date_selection_type == HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_SPECIFIC}style="display:none;"{/if}>
<div class="form-group special_days_content" {if (isset($objFeaturePrice->date_selection_type) && $objFeaturePrice->date_selection_type == HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_SPECIFIC) || (isset($smarty.post.date_selection_type) && $smarty.post.date_selection_type != HotelRoomTypeFeaturePricing::DATE_SELECTION_TYPE_RANGE)}style="display:none;"{/if}>
<label class="control-label col-lg-3">
<span class="label-tooltip" data-toggle="tooltip" data-html="true" title="" data-original-title="{l s='Enable this option to restrict this rule to specific week days (for example, weekends) of the selected date range. If disabled, rule will be applicable to all week days.' mod='hotelreservationsystem'}">
{l s='Restrict to Week Days' mod='hotelreservationsystem'}
@@ -127,7 +164,7 @@
<span class="switch prestashop-switch fixed-width-lg">
<input type="radio" {if isset($smarty.post.is_special_days_exists) && $smarty.post.is_special_days_exists == 1}checked="checked"{elseif isset($edit) && $objFeaturePrice->is_special_days_exists == 1}checked="checked"{/if} value="1" id="is_special_days_exists_on" name="is_special_days_exists">
<label for="is_special_days_exists_on">{l s='Yes' mod='hotelreservationsystem'}</label>
<input {if isset($edit) && $objFeaturePrice->is_special_days_exists == 0} checked="checked" {elseif !isset($smarty.post.is_special_days_exists) && !isset($edit)}checked="checked"{/if} type="radio" value="0" id="is_special_days_exists_off" name="is_special_days_exists">
<input {if isset($smarty.post.is_special_days_exists) && $smarty.post.is_special_days_exists == 0} checked="checked" {elseif (isset($edit) && $objFeaturePrice->is_special_days_exists == 0) || !isset($edit)} checked="checked"{/if} type="radio" value="0" id="is_special_days_exists_off" name="is_special_days_exists">
<label for="is_special_days_exists_off">{l s='No' mod='hotelreservationsystem'}</label>
<a class="slide-button btn"></a>
</span>
@@ -135,7 +172,7 @@
</div>
<div class="form-group week_days" {if (isset($smarty.post.is_special_days_exists) && $smarty.post.is_special_days_exists) || (isset($objFeaturePrice->is_special_days_exists) && $objFeaturePrice->is_special_days_exists)}style="display:block;"{/if}>
<label for="Price Impact Way" class="control-label col-lg-3">
<label for="special_days" class="control-label col-lg-3">
{l s='Select Week Days' mod='hotelreservationsystem'}
</label>
<div class="col-lg-3 checkboxes-wrap">
@@ -200,17 +237,17 @@
<div class="form-group">
<label for="Price Impact Way" class="control-label col-lg-3">
{l s='Impact Way :' mod='hotelreservationsystem'}
{l s='Impact Way' mod='hotelreservationsystem'}
</label>
<div class="col-lg-3">
<select class="form-control" name="price_impact_way" id="price_impact_way">
<option value="{HotelRoomTypeFeaturePricing::IMPACT_WAY_DECREASE}" {if isset($objFeaturePrice->impact_way) && $objFeaturePrice->impact_way == HotelRoomTypeFeaturePricing::IMPACT_WAY_DECREASE}selected = "selected"{/if}>
<option value="{HotelRoomTypeFeaturePricing::IMPACT_WAY_DECREASE}" {if (isset($smarty.post.price_impact_way) && $smarty.post.price_impact_way == HotelRoomTypeFeaturePricing::IMPACT_WAY_DECREASE) || (isset($objFeaturePrice->impact_way) && $objFeaturePrice->impact_way == HotelRoomTypeFeaturePricing::IMPACT_WAY_DECREASE && !isset($smarty.post.price_impact_way))}selected = "selected"{/if}>
{l s='Decrease Price' mod='hotelreservationsystem'}
</option>
<option value="{HotelRoomTypeFeaturePricing::IMPACT_WAY_INCREASE}" {if isset($objFeaturePrice->impact_way) && $objFeaturePrice->impact_way == HotelRoomTypeFeaturePricing::IMPACT_WAY_INCREASE}selected = "selected"{/if}>
<option value="{HotelRoomTypeFeaturePricing::IMPACT_WAY_INCREASE}" {if (isset($smarty.post.price_impact_way) && $smarty.post.price_impact_way == HotelRoomTypeFeaturePricing::IMPACT_WAY_INCREASE) || (isset($objFeaturePrice->impact_way) && $objFeaturePrice->impact_way == HotelRoomTypeFeaturePricing::IMPACT_WAY_INCREASE && !isset($smarty.post.price_impact_way))}selected = "selected"{/if}>
{l s='Increase Price' mod='hotelreservationsystem'}
</option>
<option value="{HotelRoomTypeFeaturePricing::IMPACT_WAY_FIX_PRICE}" {if isset($objFeaturePrice->impact_way) && $objFeaturePrice->impact_way == HotelRoomTypeFeaturePricing::IMPACT_WAY_FIX_PRICE}selected = "selected"{/if}>
<option value="{HotelRoomTypeFeaturePricing::IMPACT_WAY_FIX_PRICE}" {if (isset($smarty.post.price_impact_way) && $smarty.post.price_impact_way == HotelRoomTypeFeaturePricing::IMPACT_WAY_FIX_PRICE) || (isset($objFeaturePrice->impact_way) && $objFeaturePrice->impact_way == HotelRoomTypeFeaturePricing::IMPACT_WAY_FIX_PRICE && !isset($smarty.post.price_impact_way))}selected = "selected"{/if}>
{l s='Fixed Price' mod='hotelreservationsystem'}
</option>
</select>
@@ -219,14 +256,14 @@
<div class="form-group">
<label for="Price Impact Type" class="control-label col-lg-3">
{l s='Impact Type :' mod='hotelreservationsystem'}
{l s='Impact Type' mod='hotelreservationsystem'}
</label>
<div class="col-lg-3">
<select class="form-control" name="price_impact_type" id="price_impact_type" {if isset($objFeaturePrice->impact_way) && $objFeaturePrice->impact_way == HotelRoomTypeFeaturePricing::IMPACT_WAY_FIX_PRICE}disabled="disabled"{/if}>
<option value="{HotelRoomTypeFeaturePricing::IMPACT_TYPE_PERCENTAGE}" {if isset($objFeaturePrice->impact_type) && $objFeaturePrice->impact_type == HotelRoomTypeFeaturePricing::IMPACT_TYPE_PERCENTAGE}selected = "selected"{/if}>
<select class="form-control" name="price_impact_type" id="price_impact_type" {if (isset($smarty.post.price_impact_way) && $smarty.post.price_impact_way == HotelRoomTypeFeaturePricing::IMPACT_WAY_FIX_PRICE) || (isset($objFeaturePrice->impact_way) && $objFeaturePrice->impact_way == HotelRoomTypeFeaturePricing::IMPACT_WAY_FIX_PRICE && !isset($smarty.post.price_impact_way))}disabled="disabled"{/if}>
<option value="{HotelRoomTypeFeaturePricing::IMPACT_TYPE_PERCENTAGE}" {if (isset($smarty.post.price_impact_type) && $smarty.post.price_impact_type == HotelRoomTypeFeaturePricing::IMPACT_TYPE_PERCENTAGE) || (isset($objFeaturePrice->impact_type) && $objFeaturePrice->impact_type == HotelRoomTypeFeaturePricing::IMPACT_TYPE_PERCENTAGE && !isset($smarty.post.price_impact_type))}selected = "selected"{/if}>
{l s='Percentage' mod='hotelreservationsystem'}
</option>
<option value="{HotelRoomTypeFeaturePricing::IMPACT_TYPE_FIXED_PRICE}" {if isset($objFeaturePrice->impact_type) && $objFeaturePrice->impact_type == HotelRoomTypeFeaturePricing::IMPACT_TYPE_FIXED_PRICE}selected = "selected"{/if}>
<option value="{HotelRoomTypeFeaturePricing::IMPACT_TYPE_FIXED_PRICE}" {if (isset($smarty.post.price_impact_way) && $smarty.post.price_impact_way == HotelRoomTypeFeaturePricing::IMPACT_WAY_FIX_PRICE) || (isset($objFeaturePrice->impact_way) && $objFeaturePrice->impact_way == HotelRoomTypeFeaturePricing::IMPACT_WAY_FIX_PRICE && !isset($smarty.post.price_impact_way)) || (isset($smarty.post.price_impact_type) && $smarty.post.price_impact_type == HotelRoomTypeFeaturePricing::IMPACT_TYPE_FIXED_PRICE) || (isset($objFeaturePrice->impact_type) && $objFeaturePrice->impact_type == HotelRoomTypeFeaturePricing::IMPACT_TYPE_FIXED_PRICE && !isset($smarty.post.price_impact_type))}selected = "selected"{/if}>
{l s='Amount' mod='hotelreservationsystem'}
</option>
</select>

View File

@@ -351,10 +351,18 @@ class WkPaypalCommerceHelper
$idProduct
)) {
foreach ($roomTypeBookings as $cartRoomInfo) {
$occupancy = array(
array(
'adults' => $cartRoomInfo['adults'],
'children' => $cartRoomInfo['children'],
'child_ages' => json_decode($cartRoomInfo['child_ages'])
)
);
$roomTotalPrice = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice(
$idProduct,
$cartRoomInfo['date_from'],
$cartRoomInfo['date_to']
$cartRoomInfo['date_to'],
$occupancy
);
$roomTotalPriceTE = $roomTotalPrice['total_price_tax_excl'];
$roomTotalPriceTI = $roomTotalPrice['total_price_tax_incl'];

View File

@@ -195,16 +195,16 @@ class wkhotelfilterblock extends Module
$obj_rm_type = new HotelRoomType();
$room_types = $obj_rm_type->getIdProductByHotelId($id_hotel, 0, 1, 1);
$occupancy = Tools::getValue('occupancy');
$prod_price = array();
if ($room_types) {
foreach ($room_types as $key => $value) {
$prod_price[] = HotelRoomTypeFeaturePricing::getRoomTypeFeaturePricesPerDay($value['id_product'], $date_from, $date_to, HotelBookingDetail::useTax());
$prod_price[] = HotelRoomTypeFeaturePricing::getRoomTypeFeaturePricesPerDay($value['id_product'], $date_from, $date_to, HotelBookingDetail::useTax(), 0, 0, 0, 0, 1, 1, $occupancy);
}
}
// Create URL of category
$occupancy = Tools::getValue('occupancy');
$urlData = array (
'date_from' => $date_from,
'date_to' => $date_to,

View File

@@ -31,7 +31,12 @@
{$delivery_address}
{/if}
</td> -->
<td width="33%"></td>
<td width="33%">
<span class="bold">{l s='Hotel Detail' pdf='true'}</span><br/><br/>
{if $hotel_address}
{$hotel_address}
{/if}
</td>
<td width="33%"></td>
<td width="33%">
<span class="bold">{l s='Customer Detail' pdf='true'}</span><br/><br/>

View File

@@ -27,14 +27,13 @@
<table class="product" class="bordered-table" width="100%" cellpadding="4" cellspacing="0">
<thead>
<tr>
<th colspan="{if $display_product_images}9{else}8{/if}" class="header">{l s='Rooms Details' pdf='true'}</th>
<th colspan="{if $display_product_images}8{else}7{/if}" class="header">{l s='Rooms Details' pdf='true'}</th>
</tr>
<tr>
{if $display_product_images}
<th class="product header small">{l s='Room Image' pdf='true'}</th>
{/if}
<th class="product header small">{l s='Room Description' pdf='true'}</th>
<th class="product header small">{l s='Hotel' pdf='true'}</th>
<th class="product header small">{l s='Tax Rate(s)' pdf='true'}</th>
{* {if isset($layout.before_discount)}
<th class="product header small">{l s='Base price' pdf='true'} <br /> {l s='(Tax excl.)' pdf='true'}</th>
@@ -62,11 +61,6 @@
{$data_v['name']}
</p>
</td>
<td class="product center">
<p>
{$data_v['hotel_name']}
</p>
</td>
<td class="product center">
{$data_v['order_detail_tax_label']}
</td>