Merge branch 'Qloapps:develop' into standard-product-issues

This commit is contained in:
Sumit Panwar
2025-06-12 16:08:12 +05:30
committed by GitHub
30 changed files with 224 additions and 1223 deletions

View File

@@ -37,7 +37,7 @@
{block name=script}
var langPackOk = "<img src=\"{$smarty.const._PS_IMG_}admin/information.png\" alt=\"\" /> {l s='A language pack is available for this ISO.'}";
var langPackVersion = "{l s='The Prestashop version compatible with this language and your system is:'}";
var langPackVersion = "{l s='The QloApps version compatible with this language and your system is:'}";
var langPackInfo = "{l s='After creating the language, you can import the content of the language pack, which you can download under "Localization -- Translations."'}";
var noLangPack = "<img src=\"{$smarty.const._PS_IMG_}admin/information.png\" alt=\"\" /> {l s='No language pack is available on prestashop.com for this ISO code'}";
var download = "{l s='Download'}";

View File

@@ -635,7 +635,10 @@
'width': '90%',
'height': '90%',
'afterClose' : function () {
searchCustomers();
let customer = $('#customer').val();
if (customer != '' && customer.length > 3) {
searchCustomers();
}
}
});
/*$("#new_address").fancybox({
@@ -885,9 +888,11 @@
});
}
let customerSearchAjax = '';
function searchCustomers()
{
$.ajax({
abortRunningAjax(customerSearchAjax);
customerSearchAjax = $.ajax({
type:"POST",
url : "{$link->getAdminLink('AdminCustomers')}",
async: true,
@@ -927,6 +932,12 @@
});
}
function abortRunningAjax(ajaxVar) {
if (ajaxVar) {
ajaxVar.abort();
}
}
function setupCustomer(idCustomer)
{
//$('#carts').show();// by webkul

View File

@@ -171,19 +171,22 @@ class ImageCore extends ObjectModel
* @param int $id_product_attribute Product Attribute ID
* @return array Images
*/
public static function getImages($id_lang, $id_product, $id_product_attribute = null)
public static function getImages($id_lang, $id_product, $id_product_attribute = null, $bookingProduct = null)
{
$attribute_filter = ($id_product_attribute ? ' AND ai.`id_product_attribute` = '.(int)$id_product_attribute : '');
$sql = 'SELECT *
FROM `'._DB_PREFIX_.'image` i
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image`)';
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image`)
LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = i.`id_product`)';
if ($id_product_attribute) {
$sql .= ' LEFT JOIN `'._DB_PREFIX_.'product_attribute_image` ai ON (i.`id_image` = ai.`id_image`)';
}
$sql .= ' WHERE i.`id_product` = '.(int)$id_product.' AND il.`id_lang` = '.(int)$id_lang.$attribute_filter.'
'.(!is_null($bookingProduct) ? ' AND p.`booking_product`='.(int) $bookingProduct : '').'
ORDER BY i.`position` ASC';
return Db::getInstance()->executeS($sql);
}
@@ -215,12 +218,14 @@ class ImageCore extends ObjectModel
*
* @return array Images
*/
public static function getAllImages()
public static function getAllImages($bookingProduct = null)
{
return Db::getInstance()->executeS('
SELECT `id_image`, `id_product`
FROM `'._DB_PREFIX_.'image`
ORDER BY `id_image` ASC');
SELECT img.`id_image`, img.`id_product` FROM `'._DB_PREFIX_.'image` img
LEFT JOIN `'._DB_PREFIX_.'product` p ON p.`id_product` = img.`id_product`
WHERE 1 '.(!is_null($bookingProduct) ? ' AND p.`booking_product`='.(int) $bookingProduct : '').'
ORDER BY `id_image` ASC'
);
}
/**

View File

@@ -542,7 +542,7 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
return array(
array(
'adults' => isset($data['adult']) && $data['adult'] ? $data['adult'] : $roomTypeInfo['adults'],
'adults' => isset($data['adults']) ? $data['adults'] : $roomTypeInfo['adults'],
'children' => isset($data['child']) ? $data['child'] : $roomTypeInfo['children'],
'child_ages' => $child_ages
)
@@ -946,7 +946,9 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
$extraVars,
null,
false,
$this->bookingCustomer->secure_key
$this->bookingCustomer->secure_key,
null,
false
)) {
$this->updateServicesAndDemandsInOrder($objPaymentModule->currentOrder);
if (!empty($this->wsRequestedRooms)) {
@@ -1081,7 +1083,7 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
$objTaxManager = TaxManagerFactory::getManager($objAddress, $this->wsRequestedRooms[$dateRoomJoinKey]['id_tax_rules_group']);
$objTaxCalculator = $objTaxManager->getTaxCalculator();
$priceWithTax = $objTaxCalculator->addTaxes($objHotelBookingDetail->total_price_tax_excl);
} else if (isset($this->wsRequestedRooms[$dateRoomJoinKey]['total_tax'])) {
} else if (!empty($this->wsRequestedRooms[$dateRoomJoinKey]['total_tax'])) {
$priceWithTax = $objHotelBookingDetail->total_price_tax_excl + $this->wsRequestedRooms[$dateRoomJoinKey]['total_tax'];
}
@@ -1216,9 +1218,7 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
$objOrder->total_paid_tax_incl += $priceDiffTaxIncl;
$objOrder->total_paid += $priceDiffTaxIncl;
} else if (isset($this->wsRequestedRoomTypes[$dateRoomJoinKey]['services'][$service['id_product']]['total_tax'])
&& $this->wsRequestedRoomTypes[$dateRoomJoinKey]['services'][$service['id_product']]['total_tax']
) {
} else if (!empty($this->wsRequestedRoomTypes[$dateRoomJoinKey]['services'][$service['id_product']]['total_tax'])) {
$oldPriceTaxIncl = $objServiceProductOrderDetail->total_price_tax_incl;
$objServiceProductOrderDetail->total_price_tax_incl = $objServiceProductOrderDetail->total_price_tax_excl + $this->wsRequestedRoomTypes[$dateRoomJoinKey]['services'][$service['id_product']]['total_tax'];
@@ -1697,7 +1697,7 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
$this->wsRequestedRoomTypes[$dateRoomJoinKey]['room'] = $room;
if (isset($room['id_tax_rules_group']) && Validate::isLoadedObject(new TaxRulesGroup((int) $room['id_tax_rules_group']))) {
$this->wsRequestedRooms[$dateRoomJoinKey]['id_tax_rules_group'] = $room['id_tax_rules_group'];
} else if (isset($room['total_tax'])) {
} else if (!empty($room['total_tax'])) {
$this->wsRequestedRooms[$dateRoomJoinKey]['total_tax'] = $room['total_tax'];
}
@@ -1946,13 +1946,13 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
if (isset($room['id_tax_rules_group']) && Validate::isLoadedObject(new TaxRulesGroup((int) $room['id_tax_rules_group']))) {
$this->wsRequestedRooms[$dateRoomJoinKey]['id_tax_rules_group'] = $room['id_tax_rules_group'];
} else if (isset($room['total_tax'])) {
} else if (!empty($room['total_tax'])) {
$this->wsRequestedRooms[$dateRoomJoinKey]['total_tax'] = $room['total_tax'];
}
$numDays = HotelHelper::getNumberOfDays($dateFrom, $dateTo);
if (isset($room['unit_price_without_tax'])
&& ((float) $room['unit_price_without_tax']) != ((float) $roomsByDate['order'][$roomsKey]['total_price_tax_incl']/$numDays)
&& ((float) $room['unit_price_without_tax']) != ((float) $roomsByDate['order'][$roomsKey]['total_price_tax_excl']/$numDays)
) {
$this->updateRoomPriceInOrder($room, $roomsByDate['order'][$roomsKey]);
$this->wsRequestedRoomTypes[$dateRoomJoinKey]['room'] = $room;
@@ -2314,7 +2314,7 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
$unitPriceTaxIncl = Tools::ps_round($unitPriceTaxIncl, _PS_PRICE_COMPUTE_PRECISION_);
$totalPriceTaxIncl = Tools::ps_round(($unitPriceTaxIncl * $quantity), _PS_PRICE_COMPUTE_PRECISION_);
} else if (isset($this->wsRequestedRoomTypes[$dateRoomJoinKey]['services'][$service['id_product']]['total_tax'])) {
} else if (!empty($this->wsRequestedRoomTypes[$dateRoomJoinKey]['services'][$service['id_product']]['total_tax'])) {
$totalPriceTaxIncl = $totalPriceTaxExcl + $this->wsRequestedRoomTypes[$dateRoomJoinKey]['services'][$service['id_product']]['total_tax'];
$totalPriceTaxIncl = Tools::ps_round(($totalPriceTaxIncl), _PS_PRICE_COMPUTE_PRECISION_);
@@ -2876,7 +2876,7 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
if (isset($room['id_tax_rules_group']) && !Validate::isLoadedObject(new TaxRulesGroup((int) $room['id_tax_rules_group']))) {
$this->error_msg = Tools::displayError('Invalid id_tax_rules_group.');
return false;
} else if (isset($room['total_tax']) && !Validate::isPrice($room['total_tax'])) {
} else if (!empty($room['total_tax']) && !Validate::isPrice($room['total_tax'])) {
$this->error_msg = Tools::displayError('Invalid total tax.');
return false;
}
@@ -3243,7 +3243,7 @@ class WebserviceSpecificManagementBookingsCore Extends ObjectModel implements We
$unitPriceTaxIncl = Tools::ps_round($unitPriceTaxIncl, _PS_PRICE_COMPUTE_PRECISION_);
$totalPriceTaxIncl = Tools::ps_round(($unitPriceTaxIncl * $quantity), _PS_PRICE_COMPUTE_PRECISION_);
} else if (isset($services[$product['id_product']]['total_tax'])) {
} else if (!empty($services[$product['id_product']]['total_tax'])) {
$totalPriceTaxIncl = $totalPriceTaxExcl + $services[$product['id_product']]['total_tax'];
$totalPriceTaxIncl = Tools::ps_round(($totalPriceTaxIncl), _PS_PRICE_COMPUTE_PRECISION_);

View File

@@ -51,7 +51,7 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage
'room_types' => array(),
'hotels' => array(),
'categories' => array(),
'extra_service' => array(),
'services' => array(),
// 'manufacturers' => array(),
// 'suppliers' => array(),
// 'stores' => array(),
@@ -288,7 +288,7 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage
$this->imageType = $this->wsObject->urlSegment[1];
// if image type requested is room_types then process products images
if ($this->imageType == 'room_types'
|| $this->imageType == 'extra_services'
|| $this->imageType == 'services'
) {
$this->imageType = 'products';
}
@@ -305,7 +305,7 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage
case 'stores':
case 'features':
case 'hotels':
case 'extra_services':
case 'services':
case 'room_types':
switch ($this->wsObject->urlSegment[1]) {
case 'categories':
@@ -326,7 +326,7 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage
case 'room_types':
$directory = _PS_PROD_IMG_DIR_;
break;
case 'extra_services':
case 'services':
$directory = _PS_PROD_IMG_DIR_;
break;
case 'hotels':
@@ -511,14 +511,20 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage
if ($this->imageType == 'products') {
$ids = array();
$images = Image::getAllImages();
if ($this->wsObject->urlSegment[1] == 'services') {
$resourceType = 'services';
$images = Image::getAllImages(0);
} else {
$resourceType = 'room_types';
$images = Image::getAllImages(1);
}
foreach ($images as $image) {
$ids[] = $image['id_product'];
}
$ids = array_unique($ids, SORT_NUMERIC);
asort($ids);
foreach ($ids as $id) {
$this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('image', array(), array('id' => $id, 'xlink_resource'=>$this->wsObject->wsUrl.'images/'.'room_types'.'/'.$id), false);
$this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('image', array(), array('id' => $id, 'xlink_resource'=>$this->wsObject->wsUrl.'images/'.$resourceType.'/'.$id), false);
}
} else if ($this->imageType == 'hotels') {
$ids = array();
@@ -567,10 +573,17 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage
if ($this->imageType == 'products') {
// Get available image ids
$available_image_ids = array();
if ($this->wsObject->urlSegment[1] == 'services') {
$resourceType = 'services';
$bookingProduct = 0;
} else {
$bookingProduct = 1;
$resourceType = 'room_types';
}
// New Behavior
foreach (Language::getIDs() as $id_lang) {
foreach (Image::getImages($id_lang, $object_id) as $image) {
foreach (Image::getImages($id_lang, $object_id, null, $bookingProduct) as $image) {
$available_image_ids[] = $image['id_image'];
}
}
@@ -607,7 +620,7 @@ class WebserviceSpecificManagementImagesCore implements WebserviceSpecificManage
if ($available_image_ids) {
$this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('image', array(), array('id'=>$object_id));
foreach ($available_image_ids as $available_image_id) {
$this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('declination', array(), array('id'=>$available_image_id, 'xlink_resource'=>$this->wsObject->wsUrl.'images/'.'room_types'.'/'.$object_id.'/'.$available_image_id), false);
$this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('declination', array(), array('id'=>$available_image_id, 'xlink_resource'=>$this->wsObject->wsUrl.'images/'.$resourceType.'/'.$object_id.'/'.$available_image_id), false);
}
$this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('image', array());
} else {

View File

@@ -385,7 +385,7 @@ class AdminAddressesControllerCore extends AdminController
{
$this->fields_list = array_merge($this->fields_list, array(
'email' => array('title' => $this->l('Customer Email')),
'phone' => array('title' => $this->l('Phone')),
'phone' => array('title' => $this->l('Phone'), 'filter_key' => 'a!phone'),
'phone_mobile' => array('title' => $this->l('Mobile phone')),
'address1' => array('title' => $this->l('Address (2)')),
'dni' => array('title' => $this->l('Identification Number')),

View File

@@ -935,7 +935,8 @@ class AdminCartsControllerCore extends AdminController
'id_cart' => $id_cart,
'order_message' => $message_content,
'link_order' => $this->context->link->getPageLink(
'order', false,
'order',
null,
(int)$this->context->cart->id_lang,
'step=3&recover_cart='.$id_cart.'&token_cart='.md5(_COOKIE_KEY_.'recover_cart_'.$id_cart)
),
@@ -1541,6 +1542,10 @@ class AdminCartsControllerCore extends AdminController
// Validate selected services
foreach ($selectedServiceProducts as $idServiceProduct => $selected) {
if (Validate::isLoadedObject($objProduct = new Product($idServiceProduct, false, $objCart->id_lang))) {
if (!$objProduct->allow_multiple_quantity) {
$serviceQuantities[$idServiceProduct] = 1;
}
if ($objProduct->allow_multiple_quantity) {
if (!isset($serviceQuantities[$idServiceProduct])) {
$response['hasError'] = true;
@@ -1554,10 +1559,6 @@ class AdminCartsControllerCore extends AdminController
$response['errors'][] = Tools::displayError('Can not order multiple quanitity for service').': '.$objProduct->name;
}
if (!$objProduct->allow_multiple_quantity) {
$serviceQuantities[$idServiceProduct] = 1;
}
if (!isset($serviceUnitPrices[$idServiceProduct])
|| !ValidateCore::isPrice($serviceUnitPrices[$idServiceProduct])
) {

View File

@@ -145,6 +145,7 @@ class AdminImportControllerCore extends AdminController
'id_state' => array('label' => $this->l('State ID')),
'city' => array('label' => $this->l('City *')),
'postcode' => array('label' => $this->l('Zip Code *')),
'fax' => array('label' => $this->l('Fax')),
'policies' => array('label' => $this->l('Hotel Policies')),
'active_refund' => array('label' => $this->l('Allow Refund (0 = No, 1 = Yes)')),
'refund_ids' => array('label' => $this->l('Refund IDs (x,y,z...)')),
@@ -1200,6 +1201,11 @@ class AdminImportControllerCore extends AdminController
$this->l('Zip code is invalid for (ID: %1$s)'),
(isset($info['id']) && !empty($info['id']))? $info['id'] : 'null'
);
} else if (isset($info['fax']) && !Validate::isGenericName($info['fax'])) {
$this->errors[] = sprintf(
$this->l('Fax is invalid for (ID: %1$s)'),
(isset($info['id']) && !empty($info['id']))? $info['id'] : 'null'
);
} else if ($objCountry->active) {
if ($objCountry->contains_states) {
if (!isset($info['id_state'])
@@ -1254,6 +1260,7 @@ class AdminImportControllerCore extends AdminController
$objAddress->id_state = $info['id_state'];
$objAddress->city = $info['city'];
$objAddress->postcode = $info['postcode'];
$objHotelBranch->fax = $info['fax'];
$hotelName = $objHotelBranch->hotel_name[$idLangDefault];
$objAddress->alias = $hotelName;
$hotelName = trim(preg_replace('/[0-9!<>,;?=+()@#"°{}_$%:]*$/u', '', $hotelName));
@@ -1438,16 +1445,18 @@ class AdminImportControllerCore extends AdminController
$objHotelOrderRestrictDate->use_global_min_booking_offset = true;
if (isset($info['max_checkout_offset'])
&& (Configuration::get('PS_MIN_BOOKING_OFFSET') < $info['max_checkout_offset']
|| isset($info['min_booking_offset']) && $info['min_booking_offset'] < $info['max_checkout_offset'])
&& ((Configuration::get('PS_MIN_BOOKING_OFFSET') < $info['max_checkout_offset'])
|| (isset($info['min_booking_offset']) && ($info['min_booking_offset'] < $info['max_checkout_offset']))
)
) {
$objHotelOrderRestrictDate->use_global_max_checkout_offset = false;
$objHotelOrderRestrictDate->max_checkout_offset = $info['max_checkout_offset'];
}
if (isset($info['min_booking_offset'])
&& (Configuration::get('PS_MAX_CHECKOUT_OFFSET') > $info['min_booking_offset']
|| isset($info['max_checkout_offset']) && $info['max_checkout_offset'] > $info['min_booking_offset'])
&& ((Configuration::get('PS_MAX_CHECKOUT_OFFSET') > $info['min_booking_offset'])
|| (isset($info['max_checkout_offset']) && ($info['max_checkout_offset'] > $info['min_booking_offset']))
)
) {
$objHotelOrderRestrictDate->use_global_min_booking_offset = false;
$objHotelOrderRestrictDate->min_booking_offset = $info['min_booking_offset'];
@@ -2449,39 +2458,41 @@ class AdminImportControllerCore extends AdminController
$idHotel = 0;
$objCustomer = new Customer($info['id_customer']);
$objProduct = new Product($info['id_product']);
if (Validate::isLoadedObject($objCustomer)
&& Validate::isLoadedObject($objProduct)
) {
if (!isset($hotelRoomTypeInfo[$info['id_product']])) {
if ($roomInfo = $objHotelRoomType->getRoomTypeInfoByIdProduct($singleRow->id_product)) {
if (Validate::isLoadedObject($objCustomer)) {
if (Validate::isLoadedObject($objProduct) || $objProduct->booking_product) {
if (!isset($hotelRoomTypeInfo[$info['id_product']])) {
if ($roomInfo = $objHotelRoomType->getRoomTypeInfoByIdProduct($singleRow->id_product)) {
$singleRow->id_hotel = $roomInfo['id_hotel'];
$idHotel = $roomInfo['id_hotel'];
$singleRow->adults = $roomInfo['adults'];
$singleRow->children = $roomInfo['children'];
$hotelRoomTypeInfo[$info['id_product']] = $roomInfo;
}
} else {
$roomInfo = $hotelRoomTypeInfo[$info['id_product']];
$singleRow->id_hotel = $roomInfo['id_hotel'];
$idHotel = $roomInfo['id_hotel'];
$singleRow->adults = $roomInfo['adults'];
$singleRow->children = $roomInfo['children'];
$hotelRoomTypeInfo[$info['id_product']] = $roomInfo;
}
$ordersRow[$info['id_order']][$singleRow->id_hotel][] = (array) $singleRow;
if (!isset($orderInfo[$info['id_order']])) {
$orderInfo[$info['id_order']]['id_customer'] = $singleRow->id_customer;
if (isset($singleRow->id_order_status)) {
$orderInfo[$info['id_order']]['id_order_status'] = $singleRow->id_order_status;
} else {
$orderInfo[$info['id_order']]['id_order_status'] = Configuration::get('PS_OS_AWAITING_REMOTE_PAYMENT');
}
if (isset($singleRow->id_currency)) {
$orderInfo[$info['id_order']]['id_currency'] = $singleRow->id_currency ;
} else {
$orderInfo[$info['id_order']]['id_currency'] = Configuration::get('PS_CURRENCY_DEFAULT');
}
}
} else {
$roomInfo = $hotelRoomTypeInfo[$info['id_product']];
$singleRow->id_hotel = $roomInfo['id_hotel'];
$idHotel = $roomInfo['id_hotel'];
$singleRow->adults = $roomInfo['adults'];
$singleRow->children = $roomInfo['children'];
}
$ordersRow[$info['id_order']][$singleRow->id_hotel][] = (array) $singleRow;
if (!isset($orderInfo[$info['id_order']])) {
$orderInfo[$info['id_order']]['id_customer'] = $singleRow->id_customer;
if (isset($singleRow->id_order_status)) {
$orderInfo[$info['id_order']]['id_order_status'] = $singleRow->id_order_status;
} else {
$orderInfo[$info['id_order']]['id_order_status'] = Configuration::get('PS_OS_AWAITING_REMOTE_PAYMENT');
}
if (isset($singleRow->id_currency)) {
$orderInfo[$info['id_order']]['id_currency'] = $singleRow->id_currency ;
} else {
$orderInfo[$info['id_order']]['id_currency'] = Configuration::get('PS_CURRENCY_DEFAULT');
}
$this->warnings[] = $this->l('Invalid room type Id: ').$info['id_product'];
}
}
}
@@ -2667,7 +2678,7 @@ class AdminImportControllerCore extends AdminController
null,
false
)) {
$this->errors[] = $this->l('Failed to create order for order reference '.$orderRefKey);
$this->errors[] = $this->l('Failed to create booking for reference').' '.$orderRefKey;
}
foreach ($featurePrices as $idPrice) {

View File

@@ -189,7 +189,7 @@ class AdminOrderPreferencesControllerCore extends AdminController
'PS_ROOM_PRICE_AUTO_ADD_BREAKDOWN' => array(
'title' => $this->l('Show room price breakdown'),
'hint' => $this->l('Show price breakdown for rooms with auto added services on checkout page.'),
'desc' => $this->l('This room price breakdown will be shown if cart rule for specific room type is applied on that room.'),
'desc' => $this->l('Displays a price breakdown for rooms that have auto-added services during checkout.'),
'cast' => 'intval',
'type' => 'bool'
),

View File

@@ -1386,13 +1386,12 @@ class AdminOrdersControllerCore extends AdminController
$id_lang_shop = false
){
if ($this->action == 'export' && empty($this->_listsql)) {
$this->_select .= ', c.`email`, cgd.`phone`, a.`total_paid_real`,
$this->_select .= ', c.`email`, c.`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
$this->_join .= ' 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 (

View File

@@ -285,7 +285,8 @@ class AdminStatusesControllerCore extends AdminController
//init and render the second list
$this->list_skip_actions = array();
$this->_filter = false;
$this->addRowActionSkipList('delete', array(1, 2, 3, 4, 5));
$unremovableOrs = Configuration::getMultiple(array('PS_ORS_PENDING', 'PS_ORS_DENIED', 'PS_ORS_REFUNDED'));
$this->addRowActionSkipList('delete', $unremovableOrs);
$this->initOrdersReturnsList();
$this->checkFilterForOrdersReturnsList();

View File

@@ -1,3 +1,3 @@
Hotel ID;Active(0/1);Hotel Name;Short Description;Description;Mobile Phone;Email;Address;Rating;Check-In;Check-Out;Country ID;State ID;City;Zip Code;Hotel Policies;Allow Refund(0/1);Refund IDs (x,y,z...);Max booking offset;Min booking offset;Image URLs (x,y,z...);Delete Existing Images (0 = No, 1 = Yes)
2;1;The Kings Hotel;The Kings Hotel with king size rooms. visit for a wonderful experience.;The Kings Hotel with king-size rooms. visit for a wonderful experience.;0900000009;kingshotel@demo.com;Greene St, New York, NY 10003, USA;3;12:00;11:00;21;32;New York;10003;1. intelligentsia tattooed pop-up salvia asymmetrical mixtape meggings tousled ramps VHS cred.2. intelligentsia tattooed pop-up salvia asymmetrical mixtape meggings tousled ramps VHS cred.;1;1;2024-01-01;0;http://localhost/hotelcommerce/modules/hotelreservationsystem/views/img/hotel_img/1/1.jpg;0
3;1;The Sunshine Palace Inn;The Sunshine Palace Inn is a beautiful hotel in japan.;The Sunshine Palace Inn is a beautiful hotel in japan.;0900000009;sunshine@demo.com;Shingashi, Itabashi, Tokyo;4;09:00;08:00;11;306;Tokyo;611-0043;1.loremipsertmkjbg ag mixtape meggings tousled ramps VHS cred.;0;0;;3;http://localhost/hotelcommerce/modules/hotelreservationsystem/views/img/hotel_img/1/2.jpg,http://localhost/hotelcommerce/modules/hotelreservationsystem/views/img/hotel_img/1/3.jpg;0
Hotel ID;Active(0/1);Hotel Name;Short Description;Description;Mobile Phone;Email;Address;Rating;Check-In;Check-Out;Country ID;State ID;City;Zip Code;Fax;Hotel Policies;Allow Refund(0/1);Refund IDs (x,y,z...);Maximum checkout offset;Min booking offset;Image URLs (x,y,z...);Delete Existing Images (0 = No, 1 = Yes)
2;1;The Kings Hotel;The Kings Hotel with king size rooms. visit for a wonderful experience.;The Kings Hotel with king-size rooms. visit for a wonderful experience.;0900000009;kingshotel@demo.com;Greene St, New York, NY 10003, USA;3;12:00;11:00;21;32;New York;10003;;1. intelligentsia tattooed pop-up salvia asymmetrical mixtape meggings tousled ramps VHS cred.2. intelligentsia tattooed pop-up salvia asymmetrical mixtape meggings tousled ramps VHS cred.;1;1;4;0;http://localhost/hotelcommerce/modules/hotelreservationsystem/views/img/hotel_img/1/1.jpg;0
3;1;The Sunshine Palace Inn;The Sunshine Palace Inn is a beautiful hotel in japan.;The Sunshine Palace Inn is a beautiful hotel in japan.;0900000009;sunshine@demo.com;Shingashi, Itabashi, Tokyo;4;09:00;08:00;11;306;Tokyo;611-0043;;1.loremipsertmkjbg ag mixtape meggings tousled ramps VHS cred.;0;0;;3;http://localhost/hotelcommerce/modules/hotelreservationsystem/views/img/hotel_img/1/2.jpg,http://localhost/hotelcommerce/modules/hotelreservationsystem/views/img/hotel_img/1/3.jpg;0
1 Hotel ID Active(0/1) Hotel Name Short Description Description Mobile Phone Email Address Rating Check-In Check-Out Country ID State ID City Zip Code Fax Hotel Policies Allow Refund(0/1) Max booking offset Refund IDs (x,y,z...) Maximum checkout offset Min booking offset Image URLs (x,y,z...) Delete Existing Images (0 = No, 1 = Yes)
2 2 1 The Kings Hotel The Kings Hotel with king size rooms. visit for a wonderful experience. The Kings Hotel with king-size rooms. visit for a wonderful experience. 0900000009 kingshotel@demo.com Greene St, New York, NY 10003, USA 3 12:00 11:00 21 32 New York 10003 1. intelligentsia tattooed pop-up salvia asymmetrical mixtape meggings tousled ramps VHS cred.2. intelligentsia tattooed pop-up salvia asymmetrical mixtape meggings tousled ramps VHS cred. 1 2024-01-01 1 4 0 http://localhost/hotelcommerce/modules/hotelreservationsystem/views/img/hotel_img/1/1.jpg 0
3 3 1 The Sunshine Palace Inn The Sunshine Palace Inn is a beautiful hotel in japan. The Sunshine Palace Inn is a beautiful hotel in japan. 0900000009 sunshine@demo.com Shingashi, Itabashi, Tokyo 4 09:00 08:00 11 306 Tokyo 611-0043 1.loremipsertmkjbg ag mixtape meggings tousled ramps VHS cred. 0 0 3 http://localhost/hotelcommerce/modules/hotelreservationsystem/views/img/hotel_img/1/2.jpg,http://localhost/hotelcommerce/modules/hotelreservationsystem/views/img/hotel_img/1/3.jpg 0

View File

@@ -211,6 +211,9 @@ class InstallModelInstall extends InstallAbstractModel
Configuration::updateGlobalValue('PS_LANG_DEFAULT', $id_lang);
Configuration::updateGlobalValue('PS_VERSION_DB', _PS_INSTALL_VERSION_);
Configuration::updateGlobalValue('PS_INSTALL_VERSION', _PS_INSTALL_VERSION_);
Configuration::updateGlobalValue('QLO_VERSION_DB', _QLO_INSTALL_VERSION_);
Configuration::updateGlobalValue('QLO_INSTALL_VERSION', _QLO_INSTALL_VERSION_);
return true;
}
@@ -475,6 +478,7 @@ class InstallModelInstall extends InstallAbstractModel
Configuration::updateGlobalValue('PS_SHOP_DOMAIN', Tools::getHttpHost());
Configuration::updateGlobalValue('PS_SHOP_DOMAIN_SSL', Tools::getHttpHost());
Configuration::updateGlobalValue('PS_INSTALL_VERSION', _PS_INSTALL_VERSION_);
Configuration::updateGlobalValue('QLO_INSTALL_VERSION', _QLO_INSTALL_VERSION_);
Configuration::updateGlobalValue('PS_LOCALE_LANGUAGE', $this->language->getLanguageIso());
Configuration::updateGlobalValue('PS_SHOP_NAME', $data['shop_name']);
Configuration::updateGlobalValue('PS_SHOP_ACTIVITY', $data['shop_activity']);

View File

@@ -434,6 +434,7 @@ if (empty($fail_result)) {
Configuration::updateValue('PS_HIDE_OPTIMIZATION_TIPS', 0);
Configuration::updateValue('PS_NEED_REBUILD_INDEX', 1);
Configuration::updateValue('PS_VERSION_DB', _PS_INSTALL_VERSION_);
Configuration::updateGlobalValue('QLO_VERSION_DB', _QLO_INSTALL_VERSION_);
$result .= $warningExist ? '<action result="fail" error="34">'."\n" : '<action result="ok" error="">'."\n";
$result .= $requests;
$result .= '</action>'."\n";

View File

@@ -38,6 +38,7 @@
{$rm_v['num_rm']}
</td>
<td>
{if !isset($show_full_date)}{assign var="show_full_date" value=0}{/if}
{assign var="is_full_date" value=($show_full_date && ($rm_v['data_form']|date_format:'%D' == $rm_v['data_to']|date_format:'%D'))}
{$rm_v['data_form']|date_format:"%d-%b-%G"}{if $is_full_date} {$rm_v['data_form']|date_format:"%I:%M %p"}{/if}
</td>

View File

@@ -257,361 +257,6 @@ class HotelRoomTypeFeaturePricing extends ObjectModel
return $specialDaysCount;
}
/**
* [getHotelRoomTypesRatesByDate returns hotel room types rates accrding to feature price plans]
* @param [int] $id_hotel [id of th hotel]
* @param integer $id_product [id of the product if supplied only rates of this room type will be returned]
* @param [date] $date_from [start date of the date range]
* @param [date] $date_to [end date of the date range]
* @return [array|false] [returns array containing rates of room type of a hotel if found else returns false]
*/
public function getHotelRoomTypesRatesAndInventoryByDate($id_hotel, $id_product, $date_from, $date_to)
{
$hotelRoomType = new HotelRoomType();
$context = Context::getContext();
$roomTypeRatesAndInventory = array();
$objBookingDetail = new HotelBookingDetail();
$incr = 0;
$date_from = date('Y-m-d', strtotime($date_from));
$date_to = date('Y-m-d', strtotime($date_to));
for($date = $date_from; $date < $date_to; $date = date('Y-m-d', strtotime('+1 day', strtotime($date)))) {
$currentDate = date('Y-m-d', strtotime($date));
$nextDayDate = date('Y-m-d', strtotime('+1 day', strtotime($currentDate)));
if ($id_product) {
$bookingParams = array(
'date_from' => $currentDate,
'date_to' => $nextDayDate,
'hotel_id' => $id_hotel,
'id_room_type' => $id_product,
'only_search_data' => 1,
);
$roomTypeAvailabilityInfo = $objBookingDetail->dataForFrontSearch($bookingParams);
if (isset($roomTypeAvailabilityInfo['stats']['num_avail'])) {
$totalAvailableRooms = $roomTypeAvailabilityInfo['stats']['num_avail'];
} else {
$totalAvailableRooms = 0;
}
$roomTypePrice = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice($id_product, $currentDate, $nextDayDate);
$roomTypeRatesAndInventory[$incr]['date'] = $currentDate;
$roomTypeRatesAndInventory[$incr]['room_types'][0]['id'] = $id_product;
$roomTypeRatesAndInventory[$incr]['room_types'][0]['rates'] = $roomTypePrice;
$roomTypeRatesAndInventory[$incr]['room_types'][0]['available_rooms'] = $totalAvailableRooms;
} else {
$hotelRoomTypes = $hotelRoomType->getRoomTypeByHotelId($id_hotel, $context->language->id);
if ($hotelRoomTypes) {
$roomTypeRatesAndInventory[$incr]['date'] = $currentDate;
foreach ($hotelRoomTypes as $key => $product) {
$roomTypePrice = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice(
$product['id_product'],
$currentDate,
$nextDayDate
);
$bookingParams = array(
'date_from' => $currentDate,
'date_to' => $nextDayDate,
'hotel_id' => $id_hotel,
'id_room_type' => $product['id_product'],
'only_search_data' => 1,
);
$roomTypeAvailabilityInfo = $objBookingDetail->dataForFrontSearch($bookingParams);
if (isset($roomTypeAvailabilityInfo['stats']['num_avail'])) {
$totalAvailableRooms = $roomTypeAvailabilityInfo['stats']['num_avail'];
} else {
$totalAvailableRooms = 0;
}
$roomTypeRatesAndInventory[$incr]['room_types'][$key]['id'] = $product['id_product'];
$roomTypeRatesAndInventory[$incr]['room_types'][$key]['rates'] = $roomTypePrice;
$roomTypeRatesAndInventory[$incr]['room_types'][$key]['available_rooms'] = $totalAvailableRooms;
}
} else {
return false;
}
}
$incr++;
}
return $roomTypeRatesAndInventory;
}
/**
* [updateRoomTypesFeaturePrices update and creates feature price plans by supplied information]
* @param [array] $featurePricePlans [feature price plans sent from channel manager]
* @return [array] [success if process is finished successfully else fasiled with errors]
* @information [if any feature price plan for the same date_from and date_to(supplied in the $featurePricePlans array) it will be updated otherwise it is added. While adding date range type rate plans if any plan already exist then feature price for all specific dates in the date range will be created (or updated if specific date feature price plan exists)]
*/
public function updateRoomTypesFeaturePricesAvailability($featurePricePlans)
{
$errors = [];
if ($featurePricePlans) {
if (isset($featurePricePlans['data']) && $featurePricePlans['data']) {
foreach ($featurePricePlans['data'] as $roomTypeRatesData) {
$dateFrom = date('Y-m-d', strtotime($roomTypeRatesData['dateFrom']));
$dateTo = date('Y-m-d', strtotime('+1 day', strtotime($roomTypeRatesData['dateTo'])));
if ($roomTypeRatesData['roomType']) {
foreach ($roomTypeRatesData['roomType'] as $key => $roomTypeRates) {
$id_product = $key;
// feature price rates create and updates
if (isset($roomTypeRates['rate'])) {
$productPriceTE = Product::getPriceStatic((int) $id_product, false);
if ($productPriceTE != $roomTypeRates['rate']) {
if ($productPriceTE > $roomTypeRates['rate']) {
$priceImpactWay = 1;
$impactValue = $productPriceTE - $roomTypeRates['rate'];
} else {
$priceImpactWay = 2;
$impactValue = $roomTypeRates['rate'] - $productPriceTE;
}
$params = array();
$params['roomTypeId'] = $id_product;
$params['featurePriceName'] = 'Webservice Feature Price';
$params['dateFrom'] = $dateFrom;
$featurePriceDateTo = date('Y-m-d', (strtotime($dateTo) - _TIME_1_DAY_));
$params['dateTo'] = $featurePriceDateTo;
$params['priceImpactWay'] = $priceImpactWay;
$params['isSpecialDaysExists'] = 0;
$params['jsonSpecialDays'] = null;
$params['priceImpactType'] = 2;
$params['impactValue'] = $impactValue;
$params['enableFeaturePrice'] = 1;
$nextDate = date('Y-m-d', strtotime('+1 day', strtotime($dateFrom)));
if ($nextDate == $dateTo) {
$params['dateSelectionType'] = self::DATE_SELECTION_TYPE_SPECIFIC;
$featurePriceExists = $this->checkRoomTypeFeaturePriceExistance(
$id_product,
$dateFrom,
$featurePriceDateTo,
'specific_date'
);
if ($featurePriceExists) {
if (!$this->saveFeaturePricePlan(2, $params, $featurePriceExists['id'])) {
$errors[] = $this->moduleInstance->l('Some error occured while saving Feature Price Plan Info:: Date From : ', 'HotelRoomTypeFeaturePricing').$params['dateFrom'].$this->moduleInstance->l(' Date To : ', 'HotelRoomTypeFeaturePricing').$params['dateFrom'].$this->moduleInstance->l(' Room Type Id : ', 'HotelRoomTypeFeaturePricing').$params['roomTypeId'];
}
} else {
if (!$this->saveFeaturePricePlan(2, $params, 0)) {
$errors[] = $this->moduleInstance->l('Some error occured while saving Feature Price Plan Info:: Date From : ', 'HotelRoomTypeFeaturePricing').$params['dateFrom'].$this->moduleInstance->l(' Date To : ', 'HotelRoomTypeFeaturePricing').$params['dateFrom'].$this->moduleInstance->l(' Room Type Id : ', 'HotelRoomTypeFeaturePricing').$params['roomTypeId'];
}
}
} else {
$params['dateSelectionType'] = self::DATE_SELECTION_TYPE_RANGE;
if ($featurePriceExists = $this->checkRoomTypeFeaturePriceExistance(
$id_product,
$dateFrom,
$featurePriceDateTo,
'date_range'
)) {
if ($featurePriceExists['date_from'] == $dateFrom
&& $featurePriceExists['date_to'] == $featurePriceDateTo
) {
if (!$this->saveFeaturePricePlan(
1,
$params,
$featurePriceExists['id']
)) {
$errors[] = $this->moduleInstance->l('Some error occured while saving Feature Price Plan Info:: Date From : ', 'HotelRoomTypeFeaturePricing').$params['dateFrom'].$this->moduleInstance->l(' Date To : ', 'HotelRoomTypeFeaturePricing').$params['dateFrom'].$this->moduleInstance->l(' Room Type Id : ', 'HotelRoomTypeFeaturePricing').$params['roomTypeId'];
}
} else {
for($date = $dateFrom; $date < $dateTo; $date = date('Y-m-d', strtotime('+1 day', strtotime($date)))) {
// Creating feature prices day wise, for single days.
$nextDayDate = $currentDate = date('Y-m-d', $date);
$params['dateFrom'] = $currentDate;
$params['dateTo'] = $nextDayDate;
$params['dateSelectionType'] = self::DATE_SELECTION_TYPE_SPECIFIC;
$featurePriceExists = $this->checkRoomTypeFeaturePriceExistance(
$id_product,
$currentDate,
$nextDayDate,
'specific_date'
);
if ($featurePriceExists) {
if (!$this->saveFeaturePricePlan(
2,
$params,
$featurePriceExists['id']
)) {
$errors[] = $this->moduleInstance->l('Some error occured while saving Feature Price Plan Info:: Date From : ', 'HotelRoomTypeFeaturePricing').$params['dateFrom'].$this->moduleInstance->l(' Date To : ', 'HotelRoomTypeFeaturePricing').$params['dateFrom'].$this->moduleInstance->l(' Room Type Id : ', 'HotelRoomTypeFeaturePricing').$params['roomTypeId'];
}
} else {
if (!$this->saveFeaturePricePlan(2, $params, 0)) {
$errors[] = $this->moduleInstance->l('Some error occured while saving Feature Price Plan Info:: Date From : ', 'HotelRoomTypeFeaturePricing').$params['dateFrom'].$this->moduleInstance->l(' Date To : ', 'HotelRoomTypeFeaturePricing').$params['dateFrom'].$this->moduleInstance->l(' Room Type Id : ', 'HotelRoomTypeFeaturePricing').$params['roomTypeId'];
}
}
}
}
} else {
if (!$this->saveFeaturePricePlan(1, $params, 0)) {
$errors[] = $this->moduleInstance->l('Some error occured while saving Feature Price Plan Info:: Date From : ', 'HotelRoomTypeFeaturePricing').$params['dateFrom'].$this->moduleInstance->l(' Date To : ', 'HotelRoomTypeFeaturePricing').$params['dateFrom'].$this->moduleInstance->l(' Room Type Id : ', 'HotelRoomTypeFeaturePricing').$params['roomTypeId'];
}
}
}
}
}
if (isset($roomTypeRates['inventory'])) {
$totalAvailableNotBooked = 0;
$totalAvailableRooms = 0;
$hotelRoomType = new HotelRoomType();
$hotelBookingDetail = new HotelBookingDetail();
$hotelRoomInformation = new HotelRoomInformation();
$roomTypeInfo = $hotelRoomType->getRoomTypeInfoByIdProduct($id_product);
$id_hotel = $roomTypeInfo['id_hotel'];
if ($id_hotel) {
$bookingParams = array(
'date_from' => $dateFrom,
'date_to' => $dateTo,
'hotel_id' => $id_hotel,
'id_room_type' => $id_product,
'only_search_data' => 1,
);
$roomTypeAvailabilityInfo = $hotelBookingDetail->dataForFrontSearch($bookingParams);
$bookedRoomsInfo = $hotelRoomInformation->getRoomTypeBookedRoomsForDateRange(
$id_hotel,
$id_product,
$dateFrom,
$dateTo
);
$countBookedRooms = count($bookedRoomsInfo);
if (isset($roomTypeAvailabilityInfo['stats']['total_rooms'])) {
$totalAvailableNotBooked = $roomTypeAvailabilityInfo['stats']['total_rooms'] - $countBookedRooms;
$totalAvailableRooms = $roomTypeAvailabilityInfo['stats']['num_avail'];
}
if ($roomTypeRates['inventory'] <= $totalAvailableNotBooked) {
if ($roomTypeRates['inventory'] < $totalAvailableRooms) {
$numDisabledRooms = $totalAvailableRooms - $roomTypeRates['inventory'];
$availableRooms = $hotelRoomInformation->getRoomTypeAvailableRoomsForDateRange(
$id_hotel,
$id_product,
$dateFrom,
$dateTo
);
if ($availableRooms) {
foreach ($availableRooms as $room) {
$objRoomDisableDates = new HotelRoomDisableDates();
$params['id_room'] = $room['id'];
$params['date_from'] = $dateFrom;
$params['date_to'] = $dateTo;
if (!($objRoomDisableDates->checkIfRoomAlreadyDisabled($params))) {
if ($numDisabledRooms > 0) {
$hotelRoomInformation = new HotelRoomInformation($room['id']);
if ($hotelRoomInformation->id_status == 3) {
$params['reason'] = $this->moduleInstance->l('Disabled from channel manager.', 'HotelRoomTypeFeaturePricing');
if (!$objRoomDisableDates->updateDisableDateRanges(
$params
)) {
$errors[] = $this->moduleInstance->l('Some error occurred while saving disable dates for '.$dateFrom.' To '.$dateTo.' for room id-'.$room['id'], 'HotelRoomTypeFeaturePricing');
}
} else {
$hotelRoomInformation->id_status = 3;
if ($hotelRoomInformation->save()) {
$objRoomDisableDates = new HotelRoomDisableDates();
$objRoomDisableDates->id_room = $room['id'];
$objRoomDisableDates->date_from = $dateFrom;
$objRoomDisableDates->date_to = $dateTo;
$objRoomDisableDates->reason = $this->moduleInstance->l('Disabled from channel manager.', 'HotelRoomTypeFeaturePricing');
$objRoomDisableDates->save();
}
}
$numDisabledRooms--;
}
}
}
}
} elseif ($roomTypeRates['inventory'] > $totalAvailableRooms) {
$roomsToEnable = $roomTypeRates['inventory'] - $totalAvailableRooms;
$disabledRooms = $hotelRoomInformation->getRoomTypeDisabledRoomsForDateRange(
$id_hotel,
$id_product,
$dateFrom,
$dateTo
);
if ($disabledRooms) {
foreach ($disabledRooms as $disableRoom) {
if ($roomsToEnable > 0) {
$hotelRoomInformation = new HotelRoomInformation($disableRoom['id']);
$objRoomDisableDates = new HotelRoomDisableDates();
$params['id_room'] = $disableRoom['id'];
$params['date_from'] = $dateFrom;
$params['date_to'] = $dateTo;
if (!$objRoomDisableDates->deleteDisabledDatesForDateRange(
$params
)) {
$errors[] = $this->moduleInstance->l('Some error occurred while saving deleting dates for '.$dateFrom.' To '.$dateTo.' for room id-'.$disableRoom['id'], 'HotelRoomTypeFeaturePricing');
}
$disabledDates = $objRoomDisableDates->getRoomDisableDates(
$disableRoom['id']
);
if (!count($disabledDates)) {
$hotelRoomInformation->id_status = 1;
$hotelRoomInformation->disabled_dates = null;
}
$hotelRoomInformation->save();
}
$roomsToEnable--;
}
}
}
}
}
} else {
$errors[] = $this->moduleInstance->l('Requested rooms inventory is not available.', 'HotelRoomTypeFeaturePricing');
}
}
} else {
$errors[] = $this->moduleInstance->l('Room Types for which Feature prices to be updated are not found.', 'HotelRoomTypeFeaturePricing');
}
}
} else {
$errors[] = $this->moduleInstance->l('Update Information not found.', 'HotelRoomTypeFeaturePricing');
}
} else {
$errors[] = $this->moduleInstance->l('Update Information not found.', 'HotelRoomTypeFeaturePricing');
}
$result = array();
if (count($errors)) {
$result['status'] = 'failed';
$result['errors'] = $errors;
} else {
$result['status'] = 'success';
}
return $result;
}
/**
* [saveFeaturePricePlan add or update feature price plan]
* @param [int] $dateSelectionType [date selection type 1 or 2 (date range or specific date)]
* @param [array] $params [Room type rate plan info]
* @param integer $id [id of the feature price plan if 0 means to add else to update the feature price plan]
* @return [bool] [returns true is successfuly added or updated else returns false]
*/
public function saveFeaturePricePlan($dateSelectionType, $params, $id = 0)
{
if ($id) {
$roomTypeFeaturePricing = new HotelRoomTypeFeaturePricing($id);
} else {
$roomTypeFeaturePricing = new HotelRoomTypeFeaturePricing();
}
$roomTypeFeaturePricing->id_product = $params['roomTypeId'];
// lang fields
$languages = Language::getLanguages(false);
foreach ($languages as $language) {
$roomTypeFeaturePricing->feature_price_name[$language['id_lang']] = $params['featurePriceName'];
}
$roomTypeFeaturePricing->date_selection_type = $params['dateSelectionType'];
$roomTypeFeaturePricing->date_from = $params['dateFrom'];
$roomTypeFeaturePricing->date_to = $params['dateTo'];
$roomTypeFeaturePricing->impact_way = $params['priceImpactWay'];
$roomTypeFeaturePricing->is_special_days_exists = $params['isSpecialDaysExists'];
$roomTypeFeaturePricing->special_days = $params['jsonSpecialDays'];
$roomTypeFeaturePricing->impact_type = $params['priceImpactType'];
$roomTypeFeaturePricing->impact_value = $params['impactValue'];
$roomTypeFeaturePricing->active = $params['enableFeaturePrice'];
return $roomTypeFeaturePricing->save();
}
/**
* [getRoomTypeTotalPrice Returns Total price of the room type according to supplied dates].
*

View File

@@ -1,304 +0,0 @@
<?php
/**
* 2010-2020 Webkul.
*
* NOTICE OF LICENSE
*
* All right is reserved,
* Please go through this link for complete license : https://store.webkul.com/license.html
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this module to newer
* versions in the future. If you wish to customize this module for your
* needs please refer to https://store.webkul.com/customisation-guidelines/ for more information.
*
* @author Webkul IN <support@webkul.com>
* @copyright 2010-2020 Webkul IN
* @license https://store.webkul.com/license.html
*/
class QloRoomType extends QloWebservice
{
public function getRoomType($idHotel)
{
$objHotelRoomType = new HotelRoomType();
$idLang = $this->context->language->id;
$roomTypes = $objHotelRoomType->getRoomTypeByHotelId((int)$idHotel, $idLang);
$required = ['id', 'name', 'status'];
$this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('room_types', array());
foreach ($roomTypes as $roomType) {
$this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('room_type', array());
$roomType['name'] = $roomType['room_type'];
$roomType['id'] = $roomType['id_product'];
$roomType['status'] = $roomType['active'];
foreach ($roomType as $key => $value) {
if (in_array($key, $required)) {
$this->output .= $this->renderField($key, $value);
}
}
$this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('room_type', array());
}
$this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('room_types', array());
return $this->output;
}
public function getRoomRates(array $params)
{
$objRoomTypeFeaturePrice = new HotelRoomTypeFeaturePricing();
$idProd = 0;
if (isset($params['idRoomType'])) {
$idProd = $params['idRoomType'];
}
$rates = $objRoomTypeFeaturePrice->getHotelRoomTypesRatesAndInventoryByDate($params['idHotel'], $idProd, $params['dateFrom'], $params['dateTo']);
$this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('getRoomRatesApi', array());
foreach ($rates as $datewiseRate) {
$this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('rate_list', array());
foreach ($datewiseRate as $attr => $value) {
// how to put line written in else before if and no need to use else condition
if ($attr == 'room_types') {
$this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('room_types', array());
foreach ($value as $roomType) {
$this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('room_type', array());
foreach ($roomType as $roomTypeAttr => $roomTypeData) {
if ($roomTypeAttr == 'rates') {
$roomTypeData['tax_inc'] = $roomTypeData['total_price_tax_incl'];
$roomTypeData['tax_exc'] = $roomTypeData['total_price_tax_excl'];
unset($roomTypeData['total_price_tax_incl']);
unset($roomTypeData['total_price_tax_excl']);
$this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('rate', array());
foreach ($roomTypeData as $rateAttr => $rate) {
$this->output .= $this->renderField($rateAttr, $rate);
}
$this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('rate', array());
} else {
$this->output .= $this->renderField($roomTypeAttr, $roomTypeData);
}
}
$this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('room_type', array());
}
$this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('room_types', array());
} else {
$this->output .= $this->renderField($attr, $value);
}
}
$this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('rate_list', array());
}
$this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('getRoomRatesApi', array());
return $this->output;
}
public function updRoomRateAvail($availRateData)
{
$hotelId = $availRateData['Hotel']['id'];
$formatedData = [
'propertyId' => $hotelId,
'data' => [],
];
$rateData = $availRateData['Hotel']['rate_lists']['rate_list'];
foreach ($rateData as $dateWise) {
$formateSubData = array();
$formateSubData['dateFrom'] = $dateWise['date_range']['date_from'];
$formateSubData['dateTo'] = $dateWise['date_range']['date_to'];
if (isset($dateWise['date_range']['RoomTypeLists']['RoomType']['id'])) {
$roomTypeDetail = $dateWise['date_range']['RoomTypeLists']['RoomType'];
$formateSubData['roomType'][$roomTypeDetail['id']]['status'] = $roomTypeDetail['status'];
if (isset($roomTypeDetail['rate'])) {
$formateSubData['roomType'][$roomTypeDetail['id']]['rate'] = $roomTypeDetail['rate'];
}
if (isset($roomTypeDetail['Inventory'])) {
$formateSubData['roomType'][$roomTypeDetail['id']]['inventory'] = $roomTypeDetail['Inventory'];
}
} else {
foreach ($dateWise['date_range']['RoomTypeLists']['RoomType'] as $roomTypeDetail) {
$formateSubData['roomType'][$roomTypeDetail['id']]['status'] = $roomTypeDetail['status'];
if (isset($roomTypeDetail['rate'])) {
$formateSubData['roomType'][$roomTypeDetail['id']]['rate'] = $roomTypeDetail['rate'];
}
if (isset($roomTypeDetail['Inventory'])) {
$formateSubData['roomType'][$roomTypeDetail['id']]['inventory'] = $roomTypeDetail['Inventory'];
}
}
}
$formatedData['data'][] = $formateSubData;
}
$objRoomTypeFeaturePrice = new HotelRoomTypeFeaturePricing();
$objRoomTypeFeaturePrice->updateRoomTypesFeaturePricesAvailability($formatedData);
$this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('success', array());
$this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('success', array());
return $this->output;
}
// /**
// * Get address details by id_address
// *
// * @api /getaddress
// * @param int $idAddress
// * @return xml output
// */
// public function getaddress($idAddress)
// {
// $address = new Address($idAddress);
// if (!Validate::isLoadedObject($address)) {
// return false;
// }
// // convert object to array
// $address = json_decode(json_encode($address), true);
// $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('address', array());
// $address['country'] = Country::getNameById($this->id_lang, $address['id_country']);
// $address['state'] = State::getNameById($address['id_state']);
// foreach ($address as $key => $addr) {
// $this->output .= $this->renderField($key, $addr);
// }
// $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('address', array());
// return $this->output;
// }
// /**
// * [getCustomerAddress description]
// *
// * @api /getcustomeraddress
// * @param int $idCustomer
// * @return xml output
// */
// public function getCustomerAddress($idCustomer)
// {
// $customer = new Customer($idCustomer);
// if (!Validate::isLoadedObject($customer)) {
// return false;
// }
// $required = ['id', 'country', 'state', 'alias', 'company', 'lastname', 'firstname',
// 'address1', 'address2', 'postcode', 'city', 'other', 'other', 'phone_mobile', 'phone', 'deleted'];
// $addresses = $customer->getAddresses($this->id_lang);
// $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('addresses', array());
// foreach ($addresses as $address) {
// $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('address', array());
// $address['id'] = $address['id_address'];
// $address['country'] = Country::getNameById($this->id_lang, $address['id_country']);
// $address['state'] = State::getNameById($address['id_state']);
// foreach ($address as $key => $value) {
// if (in_array($key, $required)) {
// $this->output .= $this->renderField($key, $value);
// }
// }
// $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('address', array());
// }
// $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('addresses', array());
// return $this->output;
// }
// /**
// * Check is customer have his first address or not
// *
// * @api /checkfirstaddress
// * @param int $idCustomer
// * @return xml message
// */
// public function checkFirstAddressProcess($idCustomer)
// {
// if (Address::getFirstCustomerAddressId($idCustomer)) {
// return $this->getResult($this->mkmodule->l('Address exist for this customer.', 'mkaddress'), '1');
// }
// return $this->getResult($this->mkmodule->l('No address added by this customer yet.', 'mkaddress'), '0');
// }
// /**
// * Get required field in address from configuration
// *
// * @return xml node
// */
// public function addressConfiguration()
// {
// $requiredFields = AddressFormat::getFieldsRequired();
// $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('required_fields', array());
// $this->output .= $this->renderField('phone_config', Configuration::get('PS_ONE_PHONE_AT_LEAST'));
// foreach ($requiredFields as $field) {
// if ($field !== 'Country:name') {
// $this->output .= $this->renderField($field, 1);
// }
// }
// $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('required_fields', array());
// }
// /**
// * Get country and state list
// *
// * @api /getcountrieswithstates
// * @return [type] [description]
// */
// public function getCountriesWithStatesProcess()
// {
// $countries = Country::getCountries($this->id_lang, true);
// $this->output .= $this->addressConfiguration();
// $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('countries', array());
// if ($countries) {
// foreach ($countries as $country) {
// // set if default country
// if ($country['id_country'] == Configuration::get('PS_COUNTRY_DEFAULT')) {
// $country['is_default'] = 1;
// } else {
// $country['is_default'] = 0;
// }
// // check if company field exist
// if ($this->isCompanyFieldAvailable($country['id_country'])) {
// $country['is_company'] = 1;
// } else {
// $country['is_company'] = 0;
// }
// $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('country', array());
// $country['country_name'] = $country['country'];
// unset($country['country']);
// foreach ($country as $k => $c) {
// if ($k == 'states') {
// $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader($k, array());
// foreach ($c as $s) {
// $this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('state', array());
// foreach ($s as $kkk => $ss) {
// $this->output .= $this->renderField($kkk, $ss);
// }
// $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('state', array());
// }
// $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter($k, array());
// } else {
// $this->output .= $this->renderField($k, $c);
// }
// }
// $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('country', array());
// }
// }
// $this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('countries', array());
// return $this->output;
// }
// /**
// * Is 'company' field available while adding address
// *
// * @param int $idCountry
// * @return boolean
// */
// public function isCompanyFieldAvailable($idCountry)
// {
// if (in_array('company', AddressFormat::getOrderedAddressFields($idCountry, true, true))) {
// return true;
// }
// return false;
// }
}

View File

@@ -1,145 +0,0 @@
<?php
/**
* 2010-2020 Webkul.
*
* NOTICE OF LICENSE
*
* All right is reserved,
* Please go through this link for complete license : https://store.webkul.com/license.html
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this module to newer
* versions in the future. If you wish to customize this module for your
* needs please refer to https://store.webkul.com/customisation-guidelines/ for more information.
*
* @author Webkul IN <support@webkul.com>
* @copyright 2010-2020 Webkul IN
* @license https://store.webkul.com/license.html
*/
class QloWebservice
{
protected $objOutput;
protected $output;
protected $wsObject;
protected $mobikulGlobal; // Remove this
protected $mkGlobal;
protected $mkmodule;
protected $http;
protected $width;
public function __construct($objOutput = null, $wsObject = null, $output = null)
{
$this->objOutput = $objOutput;
$this->wsObject = $wsObject;
$this->output = $output;
// Need to remove these three settings, this should be handled by context
// $this->id_lang = (int)Configuration::get('PS_LANG_DEFAULT');
// $this->id_currency = (int)Configuration::get('PS_CURRENCY_DEFAULT');
// $this->currency = Currency::getCurrencyInstance((int) Configuration::get('PS_CURRENCY_DEFAULT'));
$this->setContext();
// $this->mkmodule = Module::getInstanceByName('mobikul');
// $this->mobikulGlobal = new MobikulGlobal($this->id_lang, $objOutput, $wsObject, $output); // Remove this
// $this->mkGlobal = new MobikulGlobal($this->id_lang, $objOutput, $wsObject, $output);
}
public function setContext()
{
$this->context = Context::getContext();
// // Set Customer
// if (isset($this->wsObject->urlFragments['id_customer'])) {
// $this->context->customer = new Customer($this->wsObject->urlFragments['id_customer']);
// }
// // Set language
// if (isset($this->wsObject->urlFragments['id_lang'])) {
// $language = new Language($this->wsObject->urlFragments['id_lang']);
// if (!Validate::isLoadedObject($language)) {
// $language = new Language((int)Configuration::get('PS_LANG_DEFAULT'));
// }
// } else {
// $language = new Language((int)Configuration::get('PS_LANG_DEFAULT'));
// }
$language = new Language((int)Configuration::get('PS_LANG_DEFAULT'));
$this->context->language = $language;
// // Set Currency
// if (isset($this->wsObject->urlFragments['id_currency'])) {
// $currency = new Currency($this->wsObject->urlFragments['id_currency']);
// if (!Validate::isLoadedObject($currency)) {
// $language = new Language((int)Configuration::get('PS_CURRENCY_DEFAULT'));
// }
// } else {
// $currency = new Currency((int)Configuration::get('PS_CURRENCY_DEFAULT'));
// }
$currency = new Currency((int)Configuration::get('PS_CURRENCY_DEFAULT'));
$this->context->currency = $currency;
}
public function getResult($message, $status = null, $args = array(), $xml = false)
{
$this->output .= $this->objOutput->getObjectRender()->renderNodeHeader('response', array());
if ($status !== null) {
$this->output .= $this->renderField('status', $status);
}
$this->output .= $this->renderField('message', $message);
if (is_array($args) && !empty($args)) {
foreach ($args as $key => $value) {
$this->output .= $this->renderField($key, $value);
}
}
if ($xml) {
$this->output .= $xml;
}
$this->output .= $this->objOutput->getObjectRender()->renderNodeFooter('response', array());
return $this->output;
}
/**
* Create just like PS renderField function in WebServiceOutputXML class
* @todo :: to be mode functional with attributes and others
* @param [type] $nodeName
* @param [type] $value
* @return [type] xml node
*/
public function renderField($nodeName, $value = null)
{
$node_content = '<![CDATA['.$value.']]>';
return '<'.$nodeName.'>'.$node_content.'</'.$nodeName.'>'."\n";
}
// public function displayPrice($price, $idCurrency = false)
// {
// if ($idCurrency) {
// $this->currency = Currency::getCurrencyInstance($idCurrency);
// } elseif (isset($this->wsObject->urlFragments['id_currency'])) {
// $this->currency = Currency::getCurrencyInstance($this->wsObject->urlFragments['id_currency']);
// } else {
// $this->currency = Currency::getCurrencyInstance((int) Configuration::get('PS_CURRENCY_DEFAULT'));
// }
// $defaultCurrencyInstance = Currency::getCurrencyInstance((int) Configuration::get('PS_CURRENCY_DEFAULT'));
// if (Validate::isLoadedObject($this->currency)) {
// $price = Tools::ps_round((float) $price, (int) $this->currency->decimals * _PS_PRICE_DISPLAY_PRECISION_);
// $convertedPrice = Tools::convertPrice($price, $this->currency, $defaultCurrencyInstance);
// return Tools::displayPrice($convertedPrice, $this->currency);
// } else {
// return $price;
// }
// }
// public function getProductPrice($id_product, $tax = true, $id_product_attribute = null, $decimals = 6,
// $divisor = null, $only_reduc = false, $usereduc = true, $quantity = 1, $force_associated_tax = false, $id_customer = null)
// {
// return Product::getPriceStatic((int)$id_product, $tax, $id_product_attribute, $decimals, $divisor, $only_reduc, $usereduc, $quantity, $force_associated_tax, $id_customer);
// }
}

View File

@@ -429,7 +429,13 @@ class ServiceProductCartDetail extends ObjectModel
$objServiceProductCartDetail->id_product_option = $idProductOption;
}
$objServiceProductCartDetail->quantity += $quantity;
$objProduct = new Product((int) $idProduct);
if ($objProduct->allow_multiple_quantity) {
$objServiceProductCartDetail->quantity += $quantity;
} else {
$objServiceProductCartDetail->quantity = 1;
}
if ($objServiceProductCartDetail->save()) {
$objCart = new Cart($idCart);
return $objCart->updateQty($quantity, $idProduct);
@@ -471,7 +477,7 @@ class ServiceProductCartDetail extends ObjectModel
if ($quantity) {
$removedQuantity = $quantity;
$objServiceProductCartDetail->quantity -= $quantity;
if ($objServiceProductCartDetail->quantity) {
if ($objServiceProductCartDetail->quantity > 1) {
$updateQunatity = $objServiceProductCartDetail->save();
} else {
$updateQunatity = $objServiceProductCartDetail->delete();

View File

@@ -1,185 +0,0 @@
<?php
/**
* 2010-2020 Webkul.
*
* NOTICE OF LICENSE
*
* All right is reserved,
* Please go through this link for complete license : https://store.webkul.com/license.html
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this module to newer
* versions in the future. If you wish to customize this module for your
* needs please refer to https://store.webkul.com/customisation-guidelines/ for more information.
*
* @author Webkul IN <support@webkul.com>
* @copyright 2010-2020 Webkul IN
* @license https://store.webkul.com/license.html
*/
class WebserviceSpecificManagementQlo implements WebserviceSpecificManagementInterface
{
protected $objOutput;
protected $output;
protected $wsObject;
public $id_lang;
public $id_customer;
public $id_currency;
public $mobikulGlobal;
public function __construct()
{
ini_set('memory_limit', '256M');
$psCurrencyDefault = (int) Configuration::get('PS_CURRENCY_DEFAULT');
$this->context = Context::getContext();
$this->id_lang = Configuration::get('PS_LANG_DEFAULT');
$this->id_currency = $psCurrencyDefault;
$this->currency = Currency::getCurrencyInstance($psCurrencyDefault);
}
public function setObjectOutput(WebserviceOutputBuilderCore $obj)
{
$this->objOutput = $obj;
return $this;
}
public function getObjectOutput()
{
return $this->objOutput;
}
public function setWsObject(WebserviceRequestCore $obj)
{
$this->wsObject = $obj;
return $this;
}
public function getWsObject()
{
return $this->wsObject;
}
// written in alphabatical order
public function manage()
{
$this->wsQloCRUD();
return $this->wsObject->getOutputEnabled();
}
protected $allowedMethods = array(
'getRoomTypes' => array(),
'getRoomRates' => array(),
'updRoomRateAvail' => array(),
);
public function getContent()
{
if ($this->output != '') {
$outputXML = $this->objOutput->getObjectRender()->overrideContent($this->output);
if (isset($this->wsObject->urlFragments['outputformat']) && $this->wsObject->urlFragments['outputformat'] == 'json') {
$outputXML = simplexml_load_string($outputXML, null, LIBXML_NOCDATA);
$json = json_encode($outputXML);
$content = preg_replace_callback("/\\\\u([a-f0-9]{4})/", function ($matches) {
return iconv('UCS-4LE', 'UTF-8', pack('V', hexdec($matches[1])));
}, $json);
header('Content-Type: application/json');
die($content);
} else {
return $outputXML;
}
}
}
protected function wsQloCRUD()
{
$objQloRoomType = new QloRoomType($this->objOutput, $this->wsObject, $this->output);
switch ($this->wsObject->method) {
case 'GET':
switch ($this->wsObject->urlSegment[1]) {
case 'getRoomTypes':
if (!isset($this->wsObject->urlFragments['id_hotel'])) {
throw new WebserviceException('You have to set \'id_hotel\' parameter to get a result', array(100, 400));
}
$this->output .= $objQloRoomType->getRoomType($this->wsObject->urlFragments['id_hotel']);
break;
case 'getRoomRates':
if (!isset($this->wsObject->urlFragments['id_hotel']) ) {
throw new WebserviceException('You have to set \'id_hotel\', \'date_from\' and \'date_to\'parameters to get a result', array(100, 400));
}
$dateFrom = isset($this->wsObject->urlFragments['date_from']) ? $this->wsObject->urlFragments['date_from'] : date('Y-m-d');
$dateTo = isset($this->wsObject->urlFragments['date_to']) ? $this->wsObject->urlFragments['date_to'] : date('Y-m-d', strtotime($dateFrom.' + 1 day'));
$kwargs = array(
'idHotel' => $this->wsObject->urlFragments['id_hotel'],
'dateFrom' => $dateFrom,
'dateTo' => $dateTo,
'idRoomType' => isset($this->wsObject->urlFragments['id_room_type']) ? $this->wsObject->urlFragments['id_room_type'] : 0,
);
$this->output .= $objQloRoomType->getRoomRates($kwargs);
break;
default:
$exception = new WebserviceException(sprintf('Method with name "%s" does not exist in Qlo Library,', $this->wsObject->urlSegment[1]), array(48, 400));
throw $exception->setDidYouMean($this->wsObject->urlSegment[1], array_keys($this->allowedMethods));
}
break;
case 'POST':
switch ($this->wsObject->urlSegment[1]) {
case 'updRoomRateAvail':
$fields = $this->getXMLFields('updRoomRateAvail');
if (!isset($fields)) {
throw new WebserviceException('Send XML formated data', array(100, 400));
}
$this->output .= $objQloRoomType->updRoomRateAvail($fields);
break;
}
break;
default :
throw new WebserviceException('This HTTP method is not allowed', array(67, 405));
}
}
public function getXMLFields($head = false)
{
$putresource = fopen('php://input', 'r');
$inputXML = '';
while ($putData = fread($putresource, 1024)) {
$inputXML .= $putData;
}
fclose($putresource);
// If xml
if (simplexml_load_string($inputXML)) {
if (isset($inputXML) && strncmp($inputXML, 'xml=', 4) == 0) {
$inputXML = Tools::substr($inputXML, 4);
}
} else {
// If input type is json
$array = json_decode($inputXML, true);
if (isset($array['json']) && $array['json'] && isset($array[$head])) {
return ($head ? $array[$head] : $array);
} else {
WebserviceRequest::getInstance()->setError(500, 'Invalid json.', 127);
return;
}
}
try {
$xml = new SimpleXMLElement($inputXML);
} catch (Exception $error) {
WebserviceRequest::getInstance()->setError(500, 'XML error : '.$error->getMessage()."\n".'XML length : '.Tools::strlen($inputXML)."\n".'Original XML : '.$inputXML, 127);
return;
}
$xmlEntities = $xml->children();
// Convert multi-dimention xml into an array
$array = json_decode(json_encode($xmlEntities), true);
return ($head ? $array[$head] : $array);
}
}

View File

@@ -41,8 +41,6 @@ require_once 'classes/HotelRoomTypeDemandPrice.php';
require_once 'classes/HotelRoomTypeDemand.php';
require_once 'classes/HotelRoomTypeRestrictionDateRange.php';
require_once 'classes/QloWebservice.php';
require_once 'classes/QloRoomType.php';
require_once 'classes/HotelRoomDisableDates.php';
require_once 'classes/HotelBranchRefundRules.php';
require_once 'classes/HotelBedType.php';
@@ -60,5 +58,4 @@ require_once 'classes/HotelSettingsLink.php';
require_once 'classes/HotelBookingDocument.php';
// Web services classes
require_once 'classes/WebserviceSpecificManagementQlo.php';
require_once 'classes/WebserviceSpecificManagementHotelAri.php';

View File

@@ -54,10 +54,8 @@ class HotelReservationSystem extends Module
'room_bookings' => array('description' => 'Room bookings', 'class' => 'HotelBookingDetail'),
'booking_extra_demands' => array('description' => 'Booking extra demands', 'class' => 'HotelBookingDemands'),
'extra_demands' => array('description' => 'Extra demands', 'class' => 'HotelRoomTypeGlobalDemand'),
'extra_services' => array('description' => 'Extra services', 'class' => 'Product', 'parameters_attribute' => 'webserviceRoomTypeServicesParameters'),
'demand_advance_options' => array('description' => 'Extra demand advance options', 'class' => 'HotelRoomTypeGlobalDemandAdvanceOption'),
'hotel_ari' => array('description' => 'Search availability, rates and inventory', 'specific_management' => true),
'qlo' => array('description' => 'qlo API', 'specific_management' => true),
);
return $resources;

View File

@@ -41,8 +41,8 @@ $(document).ready(function()
$("#filter_price_silder").slider("values", [min_price, max_price]);
var slider_price_cont = filter_wrapper.find("div.price_filter_subcont");
slider_price_cont.find("span#filter_price_from").html(min_price);
slider_price_cont.find("span#filter_price_to").html(max_price);
slider_price_cont.find("span#filter_price_from").html(formatCurrency(min_price, currencyFormat, currencySign, currencyBlank));
slider_price_cont.find("span#filter_price_to").html(formatCurrency(max_price, currencyFormat, currencySign, currencyBlank));
/* -------NOTICE------- */
//triggerFilter();

View File

@@ -192,7 +192,7 @@ class wkhotelfilterblock extends Module
if (!($date_to = Tools::getValue('date_to'))) {
$date_to = date('Y-m-d H:i:s', strtotime($date_from) + 86400);
} else {
$urlData['date_from'] = $date_to;
$urlData['date_to'] = $date_to;
}
if ($occupancy = Tools::getValue('occupancy')) {

View File

@@ -192,8 +192,6 @@ class WkRoomSearchHelper
$searchedData['order_date_restrict'] = true;
}
}
$smartyVars['search_data'] = $searchedData;
}
if ($occupancyEnabled) {

View File

@@ -388,10 +388,11 @@ $(document).ready(function() {
start_date.setHours(0, 0, 0, 0);
}
let selectedDateFrom = new Date(Date.parse(dateFrom));
let selectedDateTo = new Date(Date.parse(dateTo));
// Using the Date object will also add extra hours according to the timezone.
let selectedDateFrom = $.datepicker.parseDate('yy-mm-dd', dateFrom);
let selectedDateTo = $.datepicker.parseDate('yy-mm-dd', dateTo);
if (max_order_date) {
max_order_date = $.datepicker.parseDate('yy-mm-dd', max_order_date );
max_order_date = $.datepicker.parseDate('yy-mm-dd', max_order_date);
} else {
max_order_date = false;
}

View File

@@ -20,9 +20,9 @@
{block name='displayRoomTypeListBefore'}
{hook h='displayRoomTypeListBefore'}
{/block}
{if isset($booking_data['stats']) && $booking_data['stats']['num_avail'] || isset($display_all_room_types) && $display_all_room_types && isset($booking_data['rm_data'])}
{if !empty($booking_data['rm_data']) && (isset($booking_data['stats']) && $booking_data['stats']['num_avail'] || !empty($display_all_room_types))}
{foreach from=$booking_data['rm_data'] key=room_k item=room_v}
{if $room_v['data']['available']|count || isset($display_all_room_types) && $display_all_room_types }
{if $room_v['data']['available']|count || !empty($display_all_room_types) }
<div class="col-sm-12 room_cont" data-id-product="{$room_v['id_product']|escape:'htmlall':'UTF-8'}">
<div class="row">
{block name='room_type_list_room_image'}
@@ -41,7 +41,7 @@
<div class="row">
<p class="rm_heading col-sm-12 col-md-7">{$room_v['name']|escape:'htmlall':'UTF-8'}</p>
{if !isset($restricted_country_mode) && !$PS_CATALOG_MODE && !$order_date_restrict}
<p class="rm_left col-sm-12 col-md-5" {if isset($display_all_room_types) && $display_all_room_types || $room_v['room_left'] > $warning_num} style="display:none"{/if}>
<p class="rm_left col-sm-12 col-md-5" {if !empty($display_all_room_types) || $room_v['room_left'] > $warning_num} style="display:none"{/if}>
{l s='Hurry!'} <span class="remain_rm_qty">{$room_v['room_left']|escape:'htmlall':'UTF-8'}</span> {l s='rooms left'}
</p>
{/if}

View File

@@ -118,14 +118,12 @@ $(document).ready(function()
validateCustomerGuestDetailForm();
}
$(document).on('click', '.submit-guest-details', function(e) {
e.preventDefault();
if ($('#customer_guest_detail').prop('checked')) {
validateCustomerGuestDetailForm();
e.preventDefault();
if ($('#customer_guest_detail_form').find('.form-error').length == 0) {
$('#customer_guest_detail_form').get(0).submit();
}
} else {
$('#customer_guest_detail_form').get(0).submit();
}
});

View File

@@ -422,46 +422,32 @@
<table class="table table-sm table-responsive table-summary">
<tbody>
{if isset($cart_htl_data)}
{if $priceDisplay && $use_tax}
<tr class="item">
<td>
<strong>{l s='Total Rooms Cost (tax excl.)'}</strong>
</td>
<td class="text-right">
<tr class="item">
<td>
<strong>{l s='Total Rooms Cost'} {if $use_taxes && $display_tax_label == 1}{if $priceDisplay == 1}{l s='(tax excl.)'}{elseif $priceDisplay == 0}{l s='(tax incl.)'}{/if} {/if}</strong>
</td>
<td class="text-right">
{if $priceDisplay && $use_tax}
<span>{displayWtPriceWithCurrency price=($orderTotalInfo['total_rooms_te'] + $orderTotalInfo['total_services_te'] + $orderTotalInfo['total_auto_add_services_te'] + $orderTotalInfo['total_demands_price_te']) currency=$objOrderCurrency}</span>
</td>
</tr>
{else}
<tr class="item">
<td>
<strong>{l s='Total Rooms Cost'} {if $use_tax}{l s='(tax incl.)'}{/if} </strong>
</td>
<td class="text-right">
{else}
<span>{displayWtPriceWithCurrency price=($orderTotalInfo['total_rooms_ti'] + $orderTotalInfo['total_services_ti'] + $orderTotalInfo['total_auto_add_services_ti'] + $orderTotalInfo['total_demands_price_ti']) currency=$objOrderCurrency}</span>
</td>
</tr>
{/if}
{/if}
</td>
</tr>
{/if}
{if (isset($cart_standalone_service_products) && $cart_standalone_service_products) || (isset($cart_hotel_service_products) && $cart_hotel_service_products)}
{if $priceDisplay && $use_tax}
<tr class="item">
<td>
<strong>{l s='Total products cost (tax excl.)'}</strong>
</td>
<td class="text-right">
<tr class="item">
<td>
<strong>{l s='Total products cost'} {if $use_taxes && $display_tax_label == 1}{if $priceDisplay == 1}{l s='(tax excl.)'}{elseif $priceDisplay == 0}{l s='(tax incl.)'}{/if} {/if}</strong>
</td>
<td class="text-right">
{if $priceDisplay && $use_tax}
<span>{displayWtPriceWithCurrency price=$orderTotalInfo['total_standalone_products_te'] currency=$objOrderCurrency}</span>
</td>
</tr>
{else}
<tr class="item">
<td>
<strong>{l s='Total products cost'} {if $use_tax}{l s='(tax incl.)'}{/if} </strong>
</td>
<td class="text-right">
{else}
<span>{displayWtPriceWithCurrency price=$orderTotalInfo['total_standalone_products_ti'] currency=$objOrderCurrency}</span>
</td>
</tr>
{/if}
{/if}
</td>
</tr>
{/if}
{if $order->total_wrapping > 0}
<tr class="item">
@@ -473,22 +459,17 @@
</td>
</tr>
{/if}
{if $priceDisplay && $use_tax && $orderTotalInfo['total_convenience_fee_te']}
{if $orderTotalInfo['total_convenience_fee_te'] || $orderTotalInfo['total_convenience_fee_ti']}
<tr class="item">
<td>
<strong>{l s='Total Convenience Fees (tax excl.)'}</strong>
<strong>{l s='Total Convenience Fees'} {if $use_taxes && $display_tax_label == 1}{if $priceDisplay == 1}{l s='(tax excl.)'}{elseif $priceDisplay == 0}{l s='(tax incl.)'}{/if} {/if}</strong>
</td>
<td class="text-right">
<span>{displayWtPriceWithCurrency price=($orderTotalInfo['total_convenience_fee_te']) currency=$objOrderCurrency}</span>
</td>
</tr>
{else if $orderTotalInfo['total_convenience_fee_ti']}
<tr class="item">
<td>
<strong>{l s='Total Convenience Fees'} {if $use_tax}{l s='(tax incl.)'}{/if} </strong>
</td>
<td class="text-right">
<span>{displayWtPriceWithCurrency price=($orderTotalInfo['total_convenience_fee_ti']) currency=$objOrderCurrency}</span>
{if $priceDisplay && $use_tax}
<span>{displayWtPriceWithCurrency price=($orderTotalInfo['total_convenience_fee_te']) currency=$objOrderCurrency}</span>
{else}
<span>{displayWtPriceWithCurrency price=($orderTotalInfo['total_convenience_fee_ti']) currency=$objOrderCurrency}</span>
{/if}
</td>
</tr>
{/if}

View File

@@ -326,57 +326,39 @@
{assign var=total_standard_products_tax_incl value=($order->getTotalProductsWithTaxes(false, false, Product::SELLING_PREFERENCE_STANDALONE) + $order->getTotalProductsWithTaxes(false, false, Product::SELLING_PREFERENCE_HOTEL_STANDALONE))}
{assign var=total_standard_products_tax_excl value=($order->getTotalProductsWithoutTaxes(false, false, Product::SELLING_PREFERENCE_STANDALONE) + $order->getTotalProductsWithoutTaxes(false, false, Product::SELLING_PREFERENCE_HOTEL_STANDALONE))}
{if isset($cart_htl_data) && $cart_htl_data}
{if $priceDisplay && $use_tax && $room_price_tax_excl}
<tr>
<td>{l s='Total rooms cost (tax excl.)'}</td>
<td class="text-right">
<span class="price">{displayWtPriceWithCurrency price=($room_price_tax_excl + $room_services_price_tax_excl - $total_convenience_fee_te) currency=$currency}</span>
</td>
</tr>
{else}
<tr>
<td>{l s='Total Rooms Cost'} {if $use_tax}{l s='(tax incl.)'}{/if} </td>
<td class="text-right">
<span class="price">{displayWtPriceWithCurrency price=($room_price_tax_incl + $room_services_price_tax_incl - $total_convenience_fee_ti) currency=$currency}</span>
</td>
</tr>
{/if}
{/if}
{if (isset($hotel_service_products) && $hotel_service_products) || (isset($standalone_service_products) && $standalone_service_products)}
{if $priceDisplay && $use_tax}
<tr class="item">
<td>
<strong>{l s='Total products cost (tax excl.)'}</strong>
</td>
<td class="text-right">
<span>{displayWtPriceWithCurrency price=$total_standard_products_tax_excl currency=$currency}</span>
</td>
</tr>
{else}
<tr class="item">
<td>
<strong>{l s='Total products cost'} {if $use_tax}{l s='(tax incl.)'}{/if} </strong>
</td>
<td class="text-right">
<span>{displayWtPriceWithCurrency price=$total_standard_products_tax_incl currency=$currency}</span>
</td>
</tr>
{/if}
{/if}
{if $priceDisplay && $use_tax && $total_convenience_fee_te}
<tr>
<td>{l s='Total Convenience Fees (tax excl.)'}</td>
<td>{l s='Total rooms cost'} {if $use_taxes && $display_tax_label == 1}{if $priceDisplay == 1}{l s='(tax excl.)'}{elseif $priceDisplay == 0}{l s='(tax incl.)'}{/if} {/if}</td>
<td class="text-right">
<span class="price">{displayWtPriceWithCurrency price=$total_convenience_fee_te currency=$currency}</span>
{if $priceDisplay && $use_tax}
<span class="price">{displayWtPriceWithCurrency price=($room_price_tax_excl + $room_services_price_tax_excl - $total_convenience_fee_te) currency=$currency}</span>
{else}
<span class="price">{displayWtPriceWithCurrency price=($room_price_tax_incl + $room_services_price_tax_incl - $total_convenience_fee_ti) currency=$currency}</span>
{/if}
</td>
</tr>
{else if $total_convenience_fee_ti}
<tr>
<td>{l s='Total Convenience Fees (tax incl.)'}</td>
{/if}
{if (isset($hotel_service_products) && $hotel_service_products) || (isset($standalone_service_products) && $standalone_service_products)}
<tr class="item">
<td>{l s='Total products cost'} {if $use_taxes && $display_tax_label == 1}{if $priceDisplay == 1}{l s='(tax excl.)'}{elseif $priceDisplay == 0}{l s='(tax incl.)'}{/if}{/if}</td>
<td class="text-right">
<span class="price">{displayWtPriceWithCurrency price=$total_convenience_fee_ti currency=$currency}</span>
{if $priceDisplay && $use_tax}
<span>{displayWtPriceWithCurrency price=$total_standard_products_tax_excl currency=$currency}</span>
{else}
<span>{displayWtPriceWithCurrency price=$total_standard_products_tax_incl currency=$currency}</span>
{/if}
</td>
</tr>
{/if}
{if $total_convenience_fee_te || $total_convenience_fee_te}
<tr class="item">
<td>{l s='Total Convenience Fees'} {if $use_taxes && $display_tax_label == 1}{if $priceDisplay == 1}{l s='(tax excl.)'}{elseif $priceDisplay == 0}{l s='(tax incl.)'}{/if}{/if}</td>
<td class="text-right">
{if $priceDisplay && $use_tax}
<span class="price">{displayWtPriceWithCurrency price=$total_convenience_fee_te currency=$currency}</span>
{else}
<span class="price">{displayWtPriceWithCurrency price=$total_convenience_fee_ti currency=$currency}</span>
{/if}
</td>
</tr>
{/if}
@@ -753,57 +735,39 @@
{assign var=total_tax_without_discount value=(($room_price_tax_incl - $room_price_tax_excl) + ($room_services_price_tax_incl - $room_services_price_tax_excl) + ($total_standard_products_tax_incl - $total_standard_products_tax_excl))}
{if isset($cart_htl_data) && $cart_htl_data}
{if $priceDisplay && $use_tax && $room_price_tax_excl}
<tr>
<td>{l s='Total rooms cost (tax excl.)'}</td>
<td class="text-right">
<span class="price">{displayWtPriceWithCurrency price=($room_price_tax_excl + $room_services_price_tax_excl - $total_convenience_fee_te) currency=$currency}</span>
</td>
</tr>
{else}
<tr>
<td>{l s='Total Rooms Cost'} {if $use_tax}{l s='(tax incl.)'}{/if} </td>
<td class="text-right">
<span class="price">{displayWtPriceWithCurrency price=($room_price_tax_incl + $room_services_price_tax_incl - $total_convenience_fee_ti) currency=$currency}</span>
</td>
</tr>
{/if}
{/if}
{if (isset($hotel_service_products) && $hotel_service_products) || (isset($standalone_service_products) && $standalone_service_products)}
{if $priceDisplay && $use_tax}
<tr class="item">
<td>
<strong>{l s='Total products cost (tax excl.)'}</strong>
</td>
<td class="text-right">
<span>{displayWtPriceWithCurrency price=$total_standard_products_tax_excl currency=$currency}</span>
</td>
</tr>
{else}
<tr class="item">
<td>
<strong>{l s='Total products cost'} {if $use_tax}{l s='(tax incl.)'}{/if} </strong>
</td>
<td class="text-right">
<span>{displayWtPriceWithCurrency price=$total_standard_products_tax_incl currency=$currency}</span>
</td>
</tr>
{/if}
{/if}
{if $priceDisplay && $use_tax && $total_convenience_fee_te}
<tr>
<td>{l s='Total Convenience Fees (tax excl.)'}</td>
<td>{l s='Total rooms cost'} {if $use_taxes && $display_tax_label == 1}{if $priceDisplay == 1}{l s='(tax excl.)'}{elseif $priceDisplay == 0}{l s='(tax incl.)'}{/if} {/if}</td>
<td class="text-right">
<span class="price">{displayWtPriceWithCurrency price=$total_convenience_fee_te currency=$currency}</span>
{if $priceDisplay && $use_tax}
<span class="price">{displayWtPriceWithCurrency price=($room_price_tax_excl + $room_services_price_tax_excl - $total_convenience_fee_te) currency=$currency}</span>
{else}
<span class="price">{displayWtPriceWithCurrency price=($room_price_tax_incl + $room_services_price_tax_incl - $total_convenience_fee_ti) currency=$currency}</span>
{/if}
</td>
</tr>
{else if $total_convenience_fee_ti}
<tr>
<td>{l s='Total Convenience Fees (tax incl.)'}</td>
{/if}
{if (isset($hotel_service_products) && $hotel_service_products) || (isset($standalone_service_products) && $standalone_service_products)}
<tr class="item">
<td>{l s='Total products cost'} {if $use_taxes && $display_tax_label == 1}{if $priceDisplay == 1}{l s='(tax excl.)'}{elseif $priceDisplay == 0}{l s='(tax incl.)'}{/if}{/if}</td>
<td class="text-right">
<span class="price">{displayWtPriceWithCurrency price=$total_convenience_fee_ti currency=$currency}</span>
{if $priceDisplay && $use_tax}
<span>{displayWtPriceWithCurrency price=$total_standard_products_tax_excl currency=$currency}</span>
{else}
<span>{displayWtPriceWithCurrency price=$total_standard_products_tax_incl currency=$currency}</span>
{/if}
</td>
</tr>
{/if}
{if $total_convenience_fee_te || $total_convenience_fee_te}
<tr class="item">
<td>{l s='Total Convenience Fees'} {if $use_taxes && $display_tax_label == 1}{if $priceDisplay == 1}{l s='(tax excl.)'}{elseif $priceDisplay == 0}{l s='(tax incl.)'}{/if}{/if}</td>
<td class="text-right">
{if $priceDisplay && $use_tax}
<span class="price">{displayWtPriceWithCurrency price=$total_convenience_fee_te currency=$currency}</span>
{else}
<span class="price">{displayWtPriceWithCurrency price=$total_convenience_fee_ti currency=$currency}</span>
{/if}
</td>
</tr>
{/if}