diff --git a/admin/themes/default/template/controllers/normal_products/_price_calculation_method_options.tpl b/admin/themes/default/template/controllers/normal_products/_price_calculation_method_options.tpl
deleted file mode 100644
index 5f6a22d5e..000000000
--- a/admin/themes/default/template/controllers/normal_products/_price_calculation_method_options.tpl
+++ /dev/null
@@ -1,30 +0,0 @@
-{*
-* 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
-*}
-
-{capture name='tooltip_list_content'}
-
- {foreach $tooltip_items as $tooltip_item}
- - {$tooltip_item|escape:'html':'UTF-8'}
- {/foreach}
-
-{/capture}
-{include file='helpers/tooltip.tpl' tooltip_content=$smarty.capture.tooltip_list_content allow_html=true}
diff --git a/admin/themes/default/template/controllers/normal_products/prices.tpl b/admin/themes/default/template/controllers/normal_products/prices.tpl
index 375f291a4..7ec1647fb 100644
--- a/admin/themes/default/template/controllers/normal_products/prices.tpl
+++ b/admin/themes/default/template/controllers/normal_products/prices.tpl
@@ -212,10 +212,23 @@ $(document).ready(function () {
*}
+
+
{* As no use in QloApps currently so commented *}
{*
{include file="controllers/products/multishop/checkbox.tpl" field="unit_price" type="unit_price"}
diff --git a/classes/Product.php b/classes/Product.php
index f683b0a67..5a59e6045 100644
--- a/classes/Product.php
+++ b/classes/Product.php
@@ -567,11 +567,12 @@ class ProductCore extends ObjectModel
const PRICE_CALCULATION_METHOD_ON_CHECKIN_DAY = 1;
const PRICE_CALCULATION_METHOD_ON_CHECKOUT_DAY = 2;
- const PRICE_CALCULATION_METHOD_ON_DURING_STAY = 4;
const PRICE_CALCULATION_METHOD_CHECKIN_DAY_AND_CHECKOUT_DAY = 3;
+ const PRICE_CALCULATION_METHOD_ON_DURING_STAY = 4;
const PRICE_CALCULATION_METHOD_CHECKIN_AND_DURING_STAY = 5;
const PRICE_CALCULATION_METHOD_CHECKOUT_AND_DURING_STAY = 6;
const PRICE_CALCULATION_METHOD_CHECKIN_AND_CHECKOUT_AND_DURING_STAY = 7;
+ const PRICE_CALCULATION_METHOD_ONCE_FOR_BOOKING = 8;
const STANDARD_PRODUCT_ADDRESS_PREFERENCE_CUSTOMER = 1;
const STANDARD_PRODUCT_ADDRESS_PREFERENCE_HOTEL = 2;
@@ -6913,6 +6914,9 @@ class ProductCore extends ObjectModel
$stayDay = $numNights - 1;
switch ((int) $priceCalculationMethod) {
+ case self::PRICE_CALCULATION_METHOD_ONCE_FOR_BOOKING:
+ return 1;
+
case self::PRICE_CALCULATION_METHOD_ON_CHECKIN_DAY:
return $checkinDay;
@@ -6947,6 +6951,12 @@ class ProductCore extends ObjectModel
if (is_null($module)) {
$module = Module::getInstanceByName('hotelreservationsystem');
}
+ if ($priceCalculationMethod == self::PRICE_CALCULATION_METHOD_ONCE_FOR_BOOKING) {
+ $labels[] = $module->l('Once per booking');
+
+ return $labels;
+ }
+
if ($priceCalculationMethod & self::PRICE_CALCULATION_METHOD_ON_CHECKIN_DAY) {
$labels[] = $module->l('Check-in day');
}
diff --git a/controllers/admin/AdminNormalProductsController.php b/controllers/admin/AdminNormalProductsController.php
index 69010afe9..fc1494555 100644
--- a/controllers/admin/AdminNormalProductsController.php
+++ b/controllers/admin/AdminNormalProductsController.php
@@ -207,6 +207,7 @@ class AdminNormalProductsControllerCore extends AdminController
Product::PRICE_CALCULATION_METHOD_CHECKIN_AND_DURING_STAY => $this->l('Check-in day | During-stay days'),
Product::PRICE_CALCULATION_METHOD_CHECKOUT_AND_DURING_STAY => $this->l('Check-out day | During-stay days'),
Product::PRICE_CALCULATION_METHOD_CHECKIN_AND_CHECKOUT_AND_DURING_STAY => $this->l('Check-in day | During-stay days | Check-out day'),
+ Product::PRICE_CALCULATION_METHOD_ONCE_FOR_BOOKING => $this->l('Once per booking'),
);
$this->_join .= '
@@ -433,31 +434,28 @@ class AdminNormalProductsControllerCore extends AdminController
public function getBuyingOption($selling_preference_type, $row)
{
- return $this->renderMultiSelectTooltip('selling_preference_type', $selling_preference_type);
+ $list = $this->fields_list['selling_preference_type']['list'];
+
+ if (empty($list[$selling_preference_type])) {
+ return '--';
+ }
+
+ $options = array_map('trim', explode('|', $list[$selling_preference_type]));
+
+ return implode(', ', $options);
}
public function getPriceCalculationMethod($price_calculation_method, $row)
{
- return $this->renderMultiSelectTooltip('price_calculation_method', $price_calculation_method);
- }
+ $list = $this->fields_list['price_calculation_method']['list'];
- private function renderMultiSelectTooltip($fieldKey, $value)
- {
- $list = $this->fields_list[$fieldKey]['list'];
-
- if (empty($list[$value])) {
+ if (empty($list[$price_calculation_method])) {
return '--';
}
- $options = array_map('trim', explode('|', $list[$value]));
+ $options = array_map('trim', explode('|', $list[$price_calculation_method]));
- $this->context->smarty->assign(array(
- 'tooltip_items' => $options,
- ));
-
- $tooltip = $this->context->smarty->fetch('controllers/normal_products/_price_calculation_method_options.tpl');
-
- return count($options) . ' ' . $this->l('Selected') . ' ' . $tooltip;
+ return implode(', ', $options);
}
public function getHotelName($hotelName, $row)
@@ -522,7 +520,9 @@ class AdminNormalProductsControllerCore extends AdminController
*/
protected function copyFromPost(&$object, $table)
{
- if (is_array(Tools::getValue('price_calculation_method'))) {
+ if (Tools::getValue('price_calculation_type') == Product::PRICE_CALCULATION_METHOD_ONCE_FOR_BOOKING) {
+ $_POST['price_calculation_method'] = Product::PRICE_CALCULATION_METHOD_ONCE_FOR_BOOKING;
+ } elseif (is_array(Tools::getValue('price_calculation_method'))) {
$_POST['price_calculation_method'] = array_sum(array_map('intval', Tools::getValue('price_calculation_method')));
}
parent::copyFromPost($object, $table);
@@ -2254,7 +2254,9 @@ class AdminNormalProductsControllerCore extends AdminController
*/
public function checkProduct()
{
- if (is_array(Tools::getValue('price_calculation_method'))) {
+ if (Tools::getValue('price_calculation_type') == Product::PRICE_CALCULATION_METHOD_ONCE_FOR_BOOKING) {
+ $_POST['price_calculation_method'] = Product::PRICE_CALCULATION_METHOD_ONCE_FOR_BOOKING;
+ } elseif (is_array(Tools::getValue('price_calculation_method'))) {
$_POST['price_calculation_method'] = array_sum(array_map('intval', Tools::getValue('price_calculation_method')));
}
@@ -2420,7 +2422,7 @@ class AdminNormalProductsControllerCore extends AdminController
// }
if (Tools::getValue('id_product') && !Tools::getValue('price_calculation_method')) {
- $this->errors[] = $this->l('Please select at least one price calculation method.');
+ $this->errors[] = $this->l('Please select at least one day to apply the price calculation method on.');
}
// Tags