Added: new option to save room type bed type

This commit is contained in:
vishalsingh.qlo325
2025-04-21 19:03:18 +05:30
parent 9518a916fa
commit f357658f9f
49 changed files with 341 additions and 56 deletions

View File

@@ -147,6 +147,19 @@
{/if}
</div>
<div class="form-group" id="bed_types_selection">
<label class="control-label col-sm-3 required">
{l s='Bed Types'}
</label>
<div class="col-sm-5">
<select name="id_bed_types[]" id="id_bed_types" class="form-control" multiple>
{foreach from=$bed_types_info item=bed_type_info}
<option value="{$bed_type_info['id_bed_type']}" {if isset($selected_bed_types) && in_array($bed_type_info['id_bed_type'], $selected_bed_types)}selected{/if}>{$bed_type_info['name']}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group hidden">
<label class="control-label col-lg-3" for="reference">
<span class="label-tooltip" data-toggle="tooltip"

View File

@@ -86,7 +86,7 @@ class AdminLocalizationControllerCore extends AdminController
'fields' => array(
'PS_WEIGHT_UNIT' => array(
'title' => $this->l('Weight unit'),
'hint' => $this->l('The default weight unit for your shop (e.g. "kg" for kilograms, "lbs" for pound-mass, etc.).'),
'hint' => $this->l('The default weight unit for your hotel (e.g. "kg" for kilograms, "lbs" for pound-mass, etc.).'),
'validation' => 'isWeightUnit',
'required' => true,
'type' => 'text',
@@ -94,7 +94,7 @@ class AdminLocalizationControllerCore extends AdminController
),
'PS_DISTANCE_UNIT' => array(
'title' => $this->l('Distance unit'),
'hint' => $this->l('The default distance unit for your shop (e.g. "km" for kilometer, "mi" for mile, etc.).'),
'hint' => $this->l('The default distance unit for your hotel (e.g. "km" for kilometer, "mi" for mile, etc.).'),
'validation' => 'isDistanceUnit',
'required' => true,
'type' => 'text',
@@ -102,7 +102,7 @@ class AdminLocalizationControllerCore extends AdminController
),
'PS_VOLUME_UNIT' => array(
'title' => $this->l('Volume unit'),
'hint' => $this->l('The default volume unit for your shop (e.g. "L" for liter, "gal" for gallon, etc.).'),
'hint' => $this->l('The default volume unit for your hotel (e.g. "L" for liter, "gal" for gallon, etc.).'),
'validation' => 'isWeightUnit',
'required' => true,
'type' => 'text',
@@ -110,7 +110,7 @@ class AdminLocalizationControllerCore extends AdminController
),
'PS_DIMENSION_UNIT' => array(
'title' => $this->l('Dimension unit'),
'hint' => $this->l('The default dimension unit for your shop (e.g. "cm" for centimeter, "in" for inch, etc.).'),
'hint' => $this->l('The default dimension unit for your hotel (e.g. "cm" for centimeter, "in" for inch, etc.).'),
'validation' => 'isDistanceUnit',
'required' => true,
'type' => 'text',

View File

@@ -2000,6 +2000,14 @@ class AdminProductsControllerCore extends AdminController
}
if ($object->update()) {
$objRoomType = new HotelRoomType();
if ($roomTypeInfo = $objRoomType->getRoomTypeInfoByIdProduct($object->id)) {
$objRoomType = new HotelRoomType($roomTypeInfo['id']);
$idBedTypes = Tools::getValue('id_bed_types', array());
$objRoomType->id_bed_types = json_encode($idBedTypes);
$objRoomType->save();
}
// update position in category
$object->setPositionInCategory(Tools::getValue('category_position'));
@@ -2928,6 +2936,8 @@ class AdminProductsControllerCore extends AdminController
$objRoomType = new HotelRoomType();
$objRoomType->id_product = $product->id;
$objRoomType->id_hotel = $id_hotel;
$idBedTypes = Tools::getValue('id_bed_types', array());
$objRoomType->id_bed_types = json_encode($idBedTypes);
$objRoomType->save();
}
}
@@ -4385,6 +4395,20 @@ class AdminProductsControllerCore extends AdminController
$data->assign('htl_full_info', $hotelFullInfo);
}
$objRoomTypeBedType = new HotelRoomTypeBedType();
if ($bedTypes = $objRoomTypeBedType->getAllBedTypes($this->context->language->id)) {
$dimensionUnit = Configuration::get('PS_DIMENSION_UNIT');
foreach ($bedTypes as $bedTypeKey => $bedType) {
$bedTypes[$bedTypeKey]['area'] = Tools::ps_round($bedType['width'], 2).' '.$dimensionUnit.' * '.Tools::ps_round($bedType['length'], 2).' '.$dimensionUnit;
}
}
$data->assign('bed_types_info', $bedTypes);
$objRoomType = new HotelRoomType();
if ($roomTypeInfo = $objRoomType->getRoomTypeInfoByIdProduct($product->id)) {
$data->assign('selected_bed_types', json_decode($roomTypeInfo['id_bed_types'], true));
}
$this->tpl_form_vars['product'] = $product;
$this->tpl_form_vars['custom_form'] = $data->fetch();
}

View File

@@ -385,6 +385,15 @@ class ProductControllerCore extends FrontController
}
}
$objRoomTypeBedType = new HotelRoomTypeBedType();
if ($bedTypes = $objRoomTypeBedType->getAllBedTypes($this->context->language->id)) {
$dimensionUnit = Configuration::get('PS_DIMENSION_UNIT');
foreach ($bedTypes as $bedTypeKey => $bedType) {
$bedTypes[$bedTypeKey]['area'] = Tools::ps_round($bedType['width'], 2).' * '.Tools::ps_round($bedType['length'], 2);
}
$bedTypes = array_column($bedTypes, null, 'id_bed_type');
}
$this->context->smarty->assign(
array(
'id_hotel' => $hotel_id,
@@ -416,6 +425,8 @@ class ProductControllerCore extends FrontController
'ftr_img_src' => _PS_IMG_.'rf/',
'order_date_restrict' => $order_date_restrict,
'PS_SERVICE_PRODUCT_CATEGORY_FILTER' => Configuration::get('PS_SERVICE_PRODUCT_CATEGORY_FILTER'),
'bed_types_info' => $bedTypes,
'dimension_unit' => Configuration::get('PS_DIMENSION_UNIT'),
)
);

View File

@@ -336,7 +336,7 @@
<value>1</value>
</configuration>
<configuration id="PS_DIMENSION_UNIT" name="PS_DIMENSION_UNIT">
<value>cm</value>
<value>ft</value>
</configuration>
<configuration id="PS_GUEST_CHECKOUT_ENABLED" name="PS_GUEST_CHECKOUT_ENABLED">
<value>0</value>

View File

@@ -11,7 +11,7 @@
<units>
<unit type="weight" value="kg"/>
<unit type="volume" value="L"/>
<unit type="short_distance" value="cm"/>
<unit type="short_distance" value="ft"/>
<unit type="base_distance" value="m"/>
<unit type="long_distance" value="km"/>
</units>

View File

@@ -223,7 +223,7 @@
<units>
<unit type="weight" value="kg"/>
<unit type="volume" value="L"/>
<unit type="short_distance" value="cm"/>
<unit type="short_distance" value="ft"/>
<unit type="base_distance" value="m"/>
<unit type="long_distance" value="km"/>
</units>

View File

@@ -190,7 +190,7 @@
<units>
<unit type="weight" value="kg"/>
<unit type="volume" value="L"/>
<unit type="short_distance" value="cm"/>
<unit type="short_distance" value="ft"/>
<unit type="base_distance" value="m"/>
<unit type="long_distance" value="km"/>
</units>

View File

@@ -23,7 +23,7 @@
<units>
<unit type="weight" value="kg"/>
<unit type="volume" value="L"/>
<unit type="short_distance" value="cm"/>
<unit type="short_distance" value="ft"/>
<unit type="base_distance" value="m"/>
<unit type="long_distance" value="km"/>
</units>

View File

@@ -192,7 +192,7 @@
<units>
<unit type="weight" value="kg"/>
<unit type="volume" value="L"/>
<unit type="short_distance" value="cm"/>
<unit type="short_distance" value="ft"/>
<unit type="base_distance" value="m"/>
<unit type="long_distance" value="km"/>
</units>

View File

@@ -131,7 +131,7 @@
<units>
<unit type="weight" value="kg"/>
<unit type="volume" value="L"/>
<unit type="short_distance" value="cm"/>
<unit type="short_distance" value="ft"/>
<unit type="base_distance" value="m"/>
<unit type="long_distance" value="km"/>
</units>

View File

@@ -190,7 +190,7 @@
<units>
<unit type="weight" value="kg"/>
<unit type="volume" value="L"/>
<unit type="short_distance" value="cm"/>
<unit type="short_distance" value="ft"/>
<unit type="base_distance" value="m"/>
<unit type="long_distance" value="km"/>
</units>

View File

@@ -190,7 +190,7 @@
<units>
<unit type="weight" value="kg"/>
<unit type="volume" value="L"/>
<unit type="short_distance" value="cm"/>
<unit type="short_distance" value="ft"/>
<unit type="base_distance" value="m"/>
<unit type="long_distance" value="km"/>
</units>

View File

@@ -223,7 +223,7 @@
<units>
<unit type="weight" value="kg"/>
<unit type="volume" value="L"/>
<unit type="short_distance" value="cm"/>
<unit type="short_distance" value="ft"/>
<unit type="base_distance" value="m"/>
<unit type="long_distance" value="km"/>
</units>

View File

@@ -221,7 +221,7 @@
<units>
<unit type="weight" value="kg"/>
<unit type="volume" value="L"/>
<unit type="short_distance" value="cm"/>
<unit type="short_distance" value="ft"/>
<unit type="base_distance" value="m"/>
<unit type="long_distance" value="km"/>
</units>

View File

@@ -201,7 +201,7 @@
<units>
<unit type="weight" value="kg"/>
<unit type="volume" value="L"/>
<unit type="short_distance" value="cm"/>
<unit type="short_distance" value="ft"/>
<unit type="base_distance" value="m"/>
<unit type="long_distance" value="km"/>
</units>

View File

@@ -130,7 +130,7 @@
<units>
<unit type="weight" value="Kg"/>
<unit type="volume" value="L"/>
<unit type="short_distance" value="cm"/>
<unit type="short_distance" value="ft"/>
<unit type="base_distance" value="m"/>
<unit type="long_distance" value="mi"/>
</units>

View File

@@ -254,7 +254,7 @@
<units>
<unit type="weight" value="kg"/>
<unit type="volume" value="L"/>
<unit type="short_distance" value="cm"/>
<unit type="short_distance" value="ft"/>
<unit type="base_distance" value="m"/>
<unit type="long_distance" value="km"/>
</units>

View File

@@ -161,7 +161,7 @@
<units>
<unit type="weight" value="kg"/>
<unit type="volume" value="L"/>
<unit type="short_distance" value="cm"/>
<unit type="short_distance" value="ft"/>
<unit type="base_distance" value="m"/>
<unit type="long_distance" value="km"/>
</units>

View File

@@ -221,7 +221,7 @@
<units>
<unit type="weight" value="kg"/>
<unit type="volume" value="L"/>
<unit type="short_distance" value="cm"/>
<unit type="short_distance" value="ft"/>
<unit type="base_distance" value="m"/>
<unit type="long_distance" value="km"/>
</units>

View File

@@ -192,7 +192,7 @@
<units>
<unit type="weight" value="kg"/>
<unit type="volume" value="L"/>
<unit type="short_distance" value="cm"/>
<unit type="short_distance" value="ft"/>
<unit type="base_distance" value="m"/>
<unit type="long_distance" value="km"/>
</units>

View File

@@ -333,7 +333,7 @@
<units>
<unit type="weight" value="kg"/>
<unit type="volume" value="L"/>
<unit type="short_distance" value="cm"/>
<unit type="short_distance" value="ft"/>
<unit type="base_distance" value="m"/>
<unit type="long_distance" value="km"/>
</units>

View File

@@ -19,7 +19,7 @@
<units>
<unit type="weight" value="kg"/>
<unit type="volume" value="L"/>
<unit type="short_distance" value="cm"/>
<unit type="short_distance" value="ft"/>
<unit type="base_distance" value="m"/>
<unit type="long_distance" value="km"/>
</units>

View File

@@ -221,7 +221,7 @@
<units>
<unit type="weight" value="kg"/>
<unit type="volume" value="L"/>
<unit type="short_distance" value="cm"/>
<unit type="short_distance" value="ft"/>
<unit type="base_distance" value="m"/>
<unit type="long_distance" value="km"/>
</units>

View File

@@ -253,7 +253,7 @@
<units>
<unit type="weight" value="kg"/>
<unit type="volume" value="L"/>
<unit type="short_distance" value="cm"/>
<unit type="short_distance" value="ft"/>
<unit type="base_distance" value="m"/>
<unit type="long_distance" value="km"/>
</units>

View File

@@ -190,7 +190,7 @@
<units>
<unit type="weight" value="kg"/>
<unit type="volume" value="L"/>
<unit type="short_distance" value="cm"/>
<unit type="short_distance" value="ft"/>
<unit type="base_distance" value="m"/>
<unit type="long_distance" value="km"/>
</units>

View File

@@ -160,7 +160,7 @@
<units>
<unit type="weight" value="kg"/>
<unit type="volume" value="L"/>
<unit type="short_distance" value="cm"/>
<unit type="short_distance" value="ft"/>
<unit type="base_distance" value="m"/>
<unit type="long_distance" value="km"/>
</units>

View File

@@ -41,7 +41,7 @@
<units>
<unit type="weight" value="kg"/>
<unit type="volume" value="L"/>
<unit type="short_distance" value="cm"/>
<unit type="short_distance" value="ft"/>
<unit type="base_distance" value="m"/>
<unit type="long_distance" value="km"/>
</units>

View File

@@ -19,7 +19,7 @@
<units>
<unit type="weight" value="kg"/>
<unit type="volume" value="L"/>
<unit type="short_distance" value="cm"/>
<unit type="short_distance" value="ft"/>
<unit type="base_distance" value="m"/>
<unit type="long_distance" value="km"/>
</units>

View File

@@ -190,7 +190,7 @@
<units>
<unit type="weight" value="kg"/>
<unit type="volume" value="L"/>
<unit type="short_distance" value="cm"/>
<unit type="short_distance" value="ft"/>
<unit type="base_distance" value="m"/>
<unit type="long_distance" value="km"/>
</units>

View File

@@ -19,7 +19,7 @@
<units>
<unit type="weight" value="kg"/>
<unit type="volume" value="L"/>
<unit type="short_distance" value="cm"/>
<unit type="short_distance" value="ft"/>
<unit type="base_distance" value="m"/>
<unit type="long_distance" value="km"/>
</units>

View File

@@ -17,7 +17,7 @@
<units>
<unit type="weight" value="kg"/>
<unit type="volume" value="L"/>
<unit type="short_distance" value="cm"/>
<unit type="short_distance" value="ft"/>
<unit type="base_distance" value="m"/>
<unit type="long_distance" value="km"/>
</units>

View File

@@ -19,7 +19,7 @@
<units>
<unit type="weight" value="kg"/>
<unit type="volume" value="L"/>
<unit type="short_distance" value="cm"/>
<unit type="short_distance" value="ft"/>
<unit type="base_distance" value="m"/>
<unit type="long_distance" value="km"/>
</units>

View File

@@ -190,7 +190,7 @@
<units>
<unit type="weight" value="kg"/>
<unit type="volume" value="L"/>
<unit type="short_distance" value="cm"/>
<unit type="short_distance" value="ft"/>
<unit type="base_distance" value="m"/>
<unit type="long_distance" value="km"/>
</units>

View File

@@ -221,7 +221,7 @@
<units>
<unit type="weight" value="kg"/>
<unit type="volume" value="L"/>
<unit type="short_distance" value="cm"/>
<unit type="short_distance" value="ft"/>
<unit type="base_distance" value="m"/>
<unit type="long_distance" value="km"/>
</units>

View File

@@ -265,7 +265,7 @@
<units>
<unit type="weight" value="kg"/>
<unit type="volume" value="L"/>
<unit type="short_distance" value="cm"/>
<unit type="short_distance" value="ft"/>
<unit type="base_distance" value="m"/>
<unit type="long_distance" value="km"/>
</units>

View File

@@ -10,7 +10,7 @@
<units>
<unit type="weight" value="kg"/>
<unit type="volume" value="L"/>
<unit type="short_distance" value="cm"/>
<unit type="short_distance" value="ft"/>
<unit type="base_distance" value="m"/>
<unit type="long_distance" value="km"/>
</units>

View File

@@ -161,7 +161,7 @@
<units>
<unit type="weight" value="kg"/>
<unit type="volume" value="L"/>
<unit type="short_distance" value="cm"/>
<unit type="short_distance" value="ft"/>
<unit type="base_distance" value="m"/>
<unit type="long_distance" value="km"/>
</units>

View File

@@ -18,7 +18,7 @@
<units>
<unit type="weight" value="kg"/>
<unit type="volume" value="L"/>
<unit type="short_distance" value="cm"/>
<unit type="short_distance" value="ft"/>
<unit type="base_distance" value="m"/>
<unit type="long_distance" value="km"/>
</units>

View File

@@ -190,7 +190,7 @@
<units>
<unit type="weight" value="kg"/>
<unit type="volume" value="L"/>
<unit type="short_distance" value="cm"/>
<unit type="short_distance" value="ft"/>
<unit type="base_distance" value="m"/>
<unit type="long_distance" value="km"/>
</units>

View File

@@ -190,7 +190,7 @@
<units>
<unit type="weight" value="kg"/>
<unit type="volume" value="l"/>
<unit type="short_distance" value="cm"/>
<unit type="short_distance" value="ft"/>
<unit type="base_distance" value="m"/>
<unit type="long_distance" value="km"/>
</units>

View File

@@ -16,7 +16,7 @@
<units>
<unit type="weight" value="kg"/>
<unit type="volume" value="L"/>
<unit type="short_distance" value="cm"/>
<unit type="short_distance" value="ft"/>
<unit type="base_distance" value="m"/>
<unit type="long_distance" value="km"/>
</units>

View File

@@ -27,6 +27,7 @@ class HotelReservationSystemDb
`id` int(11) NOT NULL AUTO_INCREMENT,
`id_product` int(11) NOT NULL,
`id_hotel` int(11) NOT NULL,
`id_bed_types` TEXT,
`adults` smallint(6) NOT NULL DEFAULT '2',
`children` smallint(6) NOT NULL DEFAULT '0',
`max_adults` smallint(6) NOT NULL DEFAULT '2',
@@ -362,7 +363,7 @@ class HotelReservationSystemDb
PRIMARY KEY (`id_room_type_demand`)
) ENGINE="._MYSQL_ENGINE_." DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;",
"CREATE TABLE `"._DB_PREFIX_."htl_room_type_service_product` (
"CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."htl_room_type_service_product` (
`id_room_type_service_product` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`id_product` int(11) UNSIGNED NOT NULL,
`position` smallint(2) unsigned NOT NULL DEFAULT '0',
@@ -372,7 +373,7 @@ class HotelReservationSystemDb
KEY `id_product` (`id_product`)
) ENGINE="._MYSQL_ENGINE_." DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;",
"CREATE TABLE `"._DB_PREFIX_."htl_room_type_service_product_price` (
"CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."htl_room_type_service_product_price` (
`id_room_type_service_product_price` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`id_product` int(11) UNSIGNED NOT NULL,
`price` decimal(20,6) NOT NULL DEFAULT '0.000000',
@@ -383,7 +384,7 @@ class HotelReservationSystemDb
KEY `id_product` (`id_product`)
) ENGINE="._MYSQL_ENGINE_." DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;",
"CREATE TABLE `"._DB_PREFIX_."htl_hotel_service_product_cart_detail` (
"CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."htl_hotel_service_product_cart_detail` (
`id_hotel_service_product_cart_detail` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`id_cart` int(11) unsigned NOT NULL,
`id_product` int(11) UNSIGNED NOT NULL,
@@ -393,7 +394,7 @@ class HotelReservationSystemDb
KEY `id_product` (`id_product`)
) ENGINE="._MYSQL_ENGINE_." DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;",
"CREATE TABLE `"._DB_PREFIX_."htl_room_type_service_product_cart_detail` (
"CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."htl_room_type_service_product_cart_detail` (
`id_room_type_service_product_cart_detail` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`id_product` int(11) UNSIGNED NOT NULL,
`quantity` int(11) UNSIGNED NOT NULL,
@@ -465,6 +466,18 @@ class HotelReservationSystemDb
`date_upd` datetime NOT NULL,
PRIMARY KEY (`id_settings_link`)
) ENGINE="._MYSQL_ENGINE_." DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;",
"CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."htl_room_type_bed_type` (
`id_bed_type` INT(11) NOT NULL AUTO_INCREMENT,
`length` DECIMAL(20,6) NOT NULL DEFAULT '0.000000',
`width` DECIMAL(20,6) NOT NULL DEFAULT '0.000000',
PRIMARY KEY (`id_bed_type`)
) ENGINE="._MYSQL_ENGINE_." DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;",
"CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."htl_room_type_bed_type_lang`(
`id_bed_type` INT(11) NOT NULL,
`name` VARCHAR(255) DEFAULT NULL,
`id_lang` INT(11) NOT NULL,
PRIMARY KEY (`id_bed_type`, `id_lang`)
) ENGINE="._MYSQL_ENGINE_." DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;",
"INSERT INTO `"._DB_PREFIX_."htl_settings_link` (`id_settings_link`, `icon`, `link`, `new_window`, `position`, `unremovable`, `active`, `date_add`, `date_upd`) VALUES
(1, 'icon-cogs', 'index.php?controller=AdminHotelGeneralSettings', 0, 0, 1, 1, NOW(), NOW()),
@@ -559,6 +572,13 @@ class HotelReservationSystemDb
`'._DB_PREFIX_.'htl_settings_link`,
`'._DB_PREFIX_.'htl_settings_link_lang`,
`'._DB_PREFIX_.'htl_room_type_restriction_date_range`,
`'._DB_PREFIX_.'htl_room_type_service_product`,
`'._DB_PREFIX_.'htl_room_type_service_product_price`,
`'._DB_PREFIX_.'htl_hotel_service_product_cart_detail`,
`'._DB_PREFIX_.'htl_room_type_service_product_cart_detail`,
`'._DB_PREFIX_.'htl_room_type_service_product_order_detail`,
`'._DB_PREFIX_.'htl_room_type_bed_type`,
`'._DB_PREFIX_.'htl_room_type_bed_type_lang`,
`'._DB_PREFIX_.'htl_access`'
);
}

View File

@@ -28,6 +28,7 @@ class HotelRoomType extends ObjectModel
public $max_adults;
public $max_children;
public $max_guests;
public $id_bed_types;
public $min_los;
public $max_los;
public $date_add;
@@ -48,6 +49,7 @@ class HotelRoomType extends ObjectModel
'max_los' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'default' => 0),
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
'id_bed_types' => array('type' => self::TYPE_STRING),
),
);

View File

@@ -0,0 +1,52 @@
<?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 HotelRoomTypeBedType extends ObjectModel
{
public $length;
public $width;
public $name;
public static $definition =array(
'table' => 'htl_room_type_bed_type',
'primary' => 'id_bed_type',
'multilang' => true,
'fields' => array(
'length' => array('type' => self::TYPE_FLOAT, 'validate' => 'isUnsignedFloat'),
'width' => array('type' => self::TYPE_FLOAT, 'validate' => 'isUnsignedFloat'),
'name' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isCatalogName', 'required' => true, 'size' => 128),
),
);
public function getAllBedTypes($idLang)
{
if (!$idLang) {
$idLang = Context::getContext()->language->id;
}
$sql = 'SELECT hrtbt.*, hrtbtl.`name` FROM `'._DB_PREFIX_.$this->table.'` hrtbt
LEFT JOIN `'._DB_PREFIX_.$this->table.'_lang` hrtbtl ON hrtbt.`id_bed_type` = hrtbtl.`id_bed_type`
WHERE 1 AND hrtbtl.`id_lang` ='.(int) $idLang;
return Db::getInstance()->executeS($sql);
}
}

View File

@@ -0,0 +1,150 @@
<?php
/**
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License version 3.0
* that is bundled with this package in the file LICENSE.md
* It is also available through the world-wide-web at this URL:
* https://opensource.org/license/osl-3-0-php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to support@qloapps.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this module to a 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
* @copyright Since 2010 Webkul
* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0
*/
class AdminHotelBedTypesController extends ModuleAdminController
{
public function __construct()
{
$this->bootstrap = true;
$this->table = 'htl_room_type_bed_type';
$this->className = 'HotelRoomTypeBedType';
$this->identifier = 'id_bed_type';
$this->context = Context::getContext();
$this->lang = true;
parent::__construct();
$this->_new_list_header_design = true;
$this->fields_list = array(
'id_bed_type' => array(
'title' => $this->l('ID'),
'align' => 'center',
),
'name' => array(
'title' => $this->l('Name'),
'align' => 'center',
),
'width' => array(
'title' => $this->l('Width'),
'align' => 'center',
'suffix' => Configuration::get('PS_DIMENSION_UNIT')
),
'length' => array(
'title' => $this->l('Lenght'),
'align' => 'center',
'suffix' => Configuration::get('PS_DIMENSION_UNIT')
),
);
$this->addRowAction('edit');
$this->addRowAction('delete');
}
public function initPageHeaderToolbar()
{
if (!$this->display || $this->display == 'list') {
$this->page_header_toolbar_btn['new_product'] = array(
'href' => self::$currentIndex.'&add'.$this->table.'&token='.$this->token,
'desc' => $this->l('Add new', null, null, false),
'icon' => 'process-icon-new'
);
}
parent::initPageHeaderToolbar();
}
public function renderForm()
{
if (!$this->loadObject(true)) {
return;
}
$this->fields_form = array(
'legend' => array(
'title' => $this->l('Bed Type'),
'icon' => 'icon-bed'
),
'input' => array(
array(
'type' => 'text',
'label' => $this->l('Bed Type Name'),
'name' => 'name',
'required' => true,
'col' => 4,
'lang' => true,
'hint' => $this->l('Enter the name of Bed type.')
),
array(
'type' => 'text',
'label' => $this->l('Width'),
'name' => 'width',
'required' => true,
'col' => 4,
'hint' => $this->l('Enter the width of the Bed type in ').Configuration::get('PS_DIMENSION_UNIT'),
'desc' => $this->l('Enter the width of the Bed type in ').Configuration::get('PS_DIMENSION_UNIT'),
),
array(
'type' => 'text',
'label' => $this->l('Length'),
'name' => 'length',
'col' => 4,
'required' => true,
'hint' => $this->l('Enter the length of the Bed type in ').Configuration::get('PS_DIMENSION_UNIT'),
'desc' => $this->l('Enter the length of the Bed type in ').Configuration::get('PS_DIMENSION_UNIT'),
),
),
'submit' => array(
'title' => $this->l('Save')
),
'buttons' => array(
'save-and-stay' => array(
'title' => $this->l('Save and stay'),
'name' => 'submitAdd'.$this->table.'AndStay',
'type' => 'submit',
'class' => 'btn btn-default pull-right',
'icon' => 'process-icon-save',
),
),
);
return parent::renderForm();
}
public function processSave()
{
if (!$this->loadObject(true)) {
return;
}
if (!trim(Tools::getValue('width'))) {
$this->errors[] = $this->l('Field Width is required');
}
if (!trim(Tools::getValue('length'))) {
$this->errors[] = $this->l('Field Length is required');
}
return parent::processSave();
}
}

View File

@@ -44,6 +44,7 @@ require_once 'classes/HotelRoomTypeRestrictionDateRange.php';
require_once 'classes/QloWebservice.php';
require_once 'classes/QloRoomType.php';
require_once 'classes/HotelRoomDisableDates.php';
require_once 'classes/HotelRoomTypeBedType.php';
require_once 'classes/HotelBranchRefundRules.php';
// linked products

View File

@@ -561,18 +561,11 @@ class HotelReservationSystem extends Module
$this->installTab('AdminAddHotel', 'Manage Hotel', 'AdminHotelReservationSystemManagement');
$this->installTab('AdminHotelRoomsBooking', 'Book Now', 'AdminHotelReservationSystemManagement');
$this->installTab('AdminHotelFeatures', 'Manage Hotel Features', 'AdminHotelReservationSystemManagement');
$this->installTab(
'AdminOrderRefundRules',
'Manage Order Refund Rules',
'AdminHotelReservationSystemManagement'
);
$this->installTab(
'AdminOrderRefundRequests',
'Manage Order Refund Requests',
'AdminHotelReservationSystemManagement'
);
$this->installTab('AdminOrderRefundRules', 'Manage Order Refund Rules', 'AdminHotelReservationSystemManagement');
$this->installTab('AdminOrderRefundRequests', 'Manage Order Refund Requests', 'AdminHotelReservationSystemManagement');
$this->installTab('AdminHotelConfigurationSetting', 'General Settings', 'AdminHotelReservationSystemManagement');
$this->installTab('AdminHotelBedTypes', 'Manage Bed Types', 'AdminCatalog');
// Controllers without tabs
$this->installTab('AdminHotelGeneralSettings', 'Hotel General Configuration', 'AdminHotelConfigurationSetting', false);
$this->installTab('AdminHotelFeaturePricesSettings', 'Advanced Price Rules', 'AdminHotelConfigurationSetting', false);

View File

@@ -262,6 +262,25 @@
</div>
{/if}
{/block}
{block name='product_info_tab_room_bed_type'}
{if isset($room_type_info['id_bed_types']) && isset($bed_types_info) && $bed_types_info}
{assign var="bed_types" value=$room_type_info['id_bed_types']|json_decode}
{if $bed_types}
<div class="info_margin_div">
<div class="room_info_heading">
<span>{l s='Bed Types'}</span>
</div>
<div class="room_info_content">
{foreach $bed_types as $bed_type}
{if isset($bed_types_info[$bed_type])}
<p>{$bed_types_info[$bed_type]['name']} ({$bed_types_info[$bed_type]['area']} {$dimension_unit}<sup>2</sup>)</p>
{/if}
{/foreach}
</div>
</div>
{/if}
{/if}
{/block}
{block name='product_info_tab_room_features'}
{if isset($features) && $features}
<div class="info_margin_div">