diff --git a/mails/en/order_canceled.txt b/mails/en/order_canceled.txt
index e4cdf1bf2..f55f183fb 100644
--- a/mails/en/order_canceled.txt
+++ b/mails/en/order_canceled.txt
@@ -1,19 +1,21 @@
-[/{shop_url}]
+[/{shop_url}]
-Hi {firstname} {lastname},
+Hi {firstname} {lastname},
Your order with the reference {order_name} from {shop_name} has
-been canceled.
+been canceled.
+
+{payment_module_detail_text}
You can review your order and download your invoice from the
"Order history" [/{history_url}] section of your customer account by
-clicking "My account" [/{my_account_url}] on our shop.
+clicking "My account" [/{my_account_url}] on our shop.
If you have a guest account, you can follow your order via the
"Guest Tracking" [/{guest_tracking_url}?id_order={order_name}] section
-on our shop.
+on our shop.
{shop_name} [/{shop_url}] powered by Webkul(tm)
-[https://webkul.com]
+[https://webkul.com]
diff --git a/mails/en/order_return_state.html b/mails/en/order_return_state.html
index f5bcb1f43..dc79ab0b5 100644
--- a/mails/en/order_return_state.html
+++ b/mails/en/order_return_state.html
@@ -4,51 +4,51 @@
Message from {shop_name}
-
-
-
@@ -99,6 +99,7 @@
+{payment_module_detail_html}
diff --git a/mails/en/order_return_state.txt b/mails/en/order_return_state.txt
index 1264fff3f..a316e8533 100644
--- a/mails/en/order_return_state.txt
+++ b/mails/en/order_return_state.txt
@@ -1,15 +1,17 @@
-[/{shop_url}]
+[/{shop_url}]
-Hi {firstname} {lastname},
+Hi {firstname} {lastname},
We have updated the progress on your return #{id_order_return}, the
new status is: "{state_order_return}"
+{payment_module_detail_text}
+
You can review your order and download your invoice from the
"Order history" [/{history_url}] section of your customer account by
-clicking "My account" [/{my_account_url}] on our shop.
+clicking "My account" [/{my_account_url}] on our shop.
{shop_name} [/{shop_url}] powered by Webkul(tm)
-[https://webkul.com]
+[https://webkul.com]
diff --git a/mails/en/outofstock.html b/mails/en/outofstock.html
index 0548ffee4..2d91504a6 100644
--- a/mails/en/outofstock.html
+++ b/mails/en/outofstock.html
@@ -4,51 +4,51 @@
Message from {shop_name}
-
-
-
@@ -99,6 +99,7 @@
+{payment_module_detail_html}
diff --git a/mails/en/outofstock.txt b/mails/en/outofstock.txt
index d58bfc6b4..2e0a4901c 100644
--- a/mails/en/outofstock.txt
+++ b/mails/en/outofstock.txt
@@ -1,23 +1,25 @@
-[/{shop_url}]
+[/{shop_url}]
Hi {firstname} {lastname},
Thanks for your order with the reference {order_name} from
-{shop_name}.
+{shop_name}.
Unfortunately, one or more items are currently out of stock. This
may cause a slight delay in your delivery. Please accept our apologies
-and rest assured that we are working hard to rectify this.
+and rest assured that we are working hard to rectify this.
+
+{payment_module_detail_text}
You can review your order and download your invoice from the
"Order history" [/{history_url}] section of your customer account by
-clicking "My account" [/{my_account_url}] on our shop.
+clicking "My account" [/{my_account_url}] on our shop.
If you have a guest account, you can follow your order via the
"Guest Tracking" [/{guest_tracking_url}?id_order={order_name}] section
-on our shop.
+on our shop.
{shop_name} [/{shop_url}] powered by Webkul(tm)
-[https://webkul.com]
+[https://webkul.com]
diff --git a/mails/en/payment.html b/mails/en/payment.html
index 7399da068..350a14174 100644
--- a/mails/en/payment.html
+++ b/mails/en/payment.html
@@ -4,51 +4,51 @@
Message from {shop_name}
-
-
-
@@ -99,6 +99,7 @@
+{payment_module_detail_html}
diff --git a/mails/en/payment.txt b/mails/en/payment.txt
index 6323378c5..052ea3bb3 100644
--- a/mails/en/payment.txt
+++ b/mails/en/payment.txt
@@ -1,21 +1,23 @@
-[/{shop_url}]
+[/{shop_url}]
Hi {firstname} {lastname},
-Thank you for shopping with {shop_name}!
+Thank you for shopping with {shop_name}!
Your payment for order with the reference {order_name} was
-successfully processed.
+successfully processed.
+
+{payment_module_detail_text}
You can review your order and download your invoice from the
"Order history" [/{history_url}] section of your customer account by
-clicking "My account" [/{my_account_url}] on our shop.
+clicking "My account" [/{my_account_url}] on our shop.
If you have a guest account, you can follow your order via the
"Guest Tracking" [/{guest_tracking_url}?id_order={order_name}] section
-on our shop.
+on our shop.
{shop_name} [/{shop_url}] powered by Webkul(tm)
-[https://webkul.com]
+[https://webkul.com]
diff --git a/mails/en/payment_error.html b/mails/en/payment_error.html
index 318bb0662..b68020cf4 100644
--- a/mails/en/payment_error.html
+++ b/mails/en/payment_error.html
@@ -4,51 +4,51 @@
Message from {shop_name}
-
-
-
@@ -100,6 +100,7 @@
+{payment_module_detail_html}
diff --git a/mails/en/payment_error.txt b/mails/en/payment_error.txt
index 3acfd2e01..554c3a739 100644
--- a/mails/en/payment_error.txt
+++ b/mails/en/payment_error.txt
@@ -1,22 +1,24 @@
-[/{shop_url}]
+[/{shop_url}]
-Hi {firstname} {lastname},
+Hi {firstname} {lastname},
There is a problem with your payment for {shop_name} order with the
reference {order_name}. Please contact us at your earliest
convenience.
-WE CANNOT SHIP YOUR ORDER UNTIL WE RECEIVE YOUR PAYMENT.
+WE CANNOT SHIP YOUR ORDER UNTIL WE RECEIVE YOUR PAYMENT.
+
+{payment_module_detail_text}
You can review your order and download your invoice from the
"Order history" [/{history_url}] section of your customer account by
-clicking "My account" [/{my_account_url}] on our shop.
+clicking "My account" [/{my_account_url}] on our shop.
If you have a guest account, you can follow your order via the
"Guest Tracking" [/{guest_tracking_url}?id_order={order_name}] section
-on our shop.
+on our shop.
{shop_name} [/{shop_url}] powered by Webkul(tm)
-[https://webkul.com]
+[https://webkul.com]
diff --git a/mails/en/preparation.html b/mails/en/preparation.html
index 74c521419..89c5474c5 100644
--- a/mails/en/preparation.html
+++ b/mails/en/preparation.html
@@ -4,51 +4,51 @@
Message from {shop_name}
-
-
-
@@ -98,6 +98,7 @@
+{payment_module_detail_html}
diff --git a/mails/en/preparation.txt b/mails/en/preparation.txt
index 9afbc8754..c179d78a5 100644
--- a/mails/en/preparation.txt
+++ b/mails/en/preparation.txt
@@ -1,19 +1,21 @@
-[/{shop_url}]
+[/{shop_url}]
-Hi {firstname} {lastname},
+Hi {firstname} {lastname},
We are currently processing your {shop_name} order with the
-reference {order_name}.
+reference {order_name}.
+
+{payment_module_detail_text}
You can review your order and download your invoice from the
"Order history" [/{history_url}] section of your customer account by
-clicking "My account" [/{my_account_url}] on our shop.
+clicking "My account" [/{my_account_url}] on our shop.
If you have a guest account, you can follow your order via the
"Guest Tracking" [/{guest_tracking_url}?id_order={order_name}] section
-on our shop.
+on our shop.
{shop_name} [/{shop_url}] powered by Webkul(tm)
-[https://webkul.com]
+[https://webkul.com]
diff --git a/mails/en/refund.html b/mails/en/refund.html
index d6c3f9c0f..5c35597e2 100644
--- a/mails/en/refund.html
+++ b/mails/en/refund.html
@@ -4,51 +4,51 @@
Message from {shop_name}
-
-
-
@@ -98,6 +98,7 @@
+{payment_module_detail_html}
diff --git a/mails/en/refund.txt b/mails/en/refund.txt
index ea70e1a01..8b372810b 100644
--- a/mails/en/refund.txt
+++ b/mails/en/refund.txt
@@ -1,19 +1,21 @@
-[/{shop_url}]
+[/{shop_url}]
-Hi {firstname} {lastname},
+Hi {firstname} {lastname},
We have processed your {shop_name} refund for order with the
-reference {order_name}.
+reference {order_name}.
+
+{payment_module_detail_text}
You can review your order and download your invoice from the
"Order history" [/{history_url}] section of your customer account by
-clicking "My account" [/{my_account_url}] on our shop.
+clicking "My account" [/{my_account_url}] on our shop.
If you have a guest account, you can follow your order via the
"Guest Tracking" [/{guest_tracking_url}?id_order={order_name}] section
-on our shop.
+on our shop.
{shop_name} [/{shop_url}] powered by Webkul(tm)
-[https://webkul.com]
+[https://webkul.com]
diff --git a/modules/bankwire/bankwire.php b/modules/bankwire/bankwire.php
index 17b995091..a7df7fbe2 100644
--- a/modules/bankwire/bankwire.php
+++ b/modules/bankwire/bankwire.php
@@ -74,11 +74,26 @@ class bankwire extends PaymentModule
$this->warning = $this->l('No currency has been set for this module.');
}
- $this->extra_mail_vars = array(
- '{bankwire_owner}' => Configuration::get('BANK_WIRE_OWNER'),
- '{bankwire_details}' => nl2br(Configuration::get('BANK_WIRE_DETAILS')),
- '{bankwire_address}' => nl2br(Configuration::get('BANK_WIRE_ADDRESS'))
- );
+ $this->payment_type = PaymentModule::PAYMENT_TYPE_REMOTE_PAYMENT;
+ }
+
+ public function getMailContent($id_order_state, $id_lang)
+ {
+ if (Configuration::get('PS_OS_AWATING') == $id_order_state) {
+ $this->context->smarty->assign(array(
+ 'bankwire_owner' => Configuration::get('BANK_WIRE_OWNER'),
+ 'bankwire_details' => nl2br(Configuration::get('BANK_WIRE_DETAILS')),
+ 'bankwire_address' => nl2br(Configuration::get('BANK_WIRE_ADDRESS'))
+ ));
+ return array(
+ '{payment_module_detail_html}' => $this->context->smarty->fetch(
+ $this->local_path.'mails/'.Language::getIsoById($id_lang).'/mail_template_html.tpl'
+ ),
+ '{payment_module_detail_text}' => $this->context->smarty->fetch(
+ $this->local_path.'mails/'.Language::getIsoById($id_lang).'/mail_template_text.tpl'
+ )
+ );
+ }
}
public function install()
@@ -195,9 +210,7 @@ class bankwire extends PaymentModule
if (in_array(
$orderState,
array(
- Configuration::get('PS_OS_BANKWIRE'),
- Configuration::get('PS_OS_OUTOFSTOCK'),
- Configuration::get('PS_OS_OUTOFSTOCK_UNPAID')
+ Configuration::get('PS_OS_AWATING'),
)
)) {
$objCart = new Cart($objOrder->id_cart);
diff --git a/modules/bankwire/controllers/front/validation.php b/modules/bankwire/controllers/front/validation.php
index f20681e1d..5045f4827 100644
--- a/modules/bankwire/controllers/front/validation.php
+++ b/modules/bankwire/controllers/front/validation.php
@@ -77,7 +77,7 @@ class BankwireValidationModuleFrontController extends ModuleFrontController
'{bankwire_address}' => nl2br(Configuration::get('BANK_WIRE_ADDRESS'))
);
- $this->module->validateOrder($cart->id, Configuration::get('PS_OS_BANKWIRE'), $total, $this->module->displayName, NULL, $mailVars, (int)$currency->id, false, $customer->secure_key);
+ $this->module->validateOrder($cart->id, Configuration::get('PS_OS_AWATING'), $total, $this->module->displayName, NULL, $mailVars, (int)$currency->id, false, $customer->secure_key);
Tools::redirect('index.php?controller=order-confirmation&id_cart='.$cart->id.'&id_module='.$this->module->id.'&id_order='.$this->module->currentOrder.'&key='.$customer->secure_key);
}
}
diff --git a/modules/bankwire/mails/en/index.php b/modules/bankwire/mails/en/index.php
new file mode 100644
index 000000000..8d2cf16fe
--- /dev/null
+++ b/modules/bankwire/mails/en/index.php
@@ -0,0 +1,29 @@
+
+* @copyright 2010-2022 Webkul IN
+* @license https://store.webkul.com/license.html
+*/
+
+header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
+header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
+
+header('Cache-Control: no-store, no-cache, must-revalidate');
+header('Cache-Control: post-check=0, pre-check=0', false);
+header('Pragma: no-cache');
+
+header('Location: ../../../');
+exit;
diff --git a/modules/bankwire/mails/en/mail_template_html.tpl b/modules/bankwire/mails/en/mail_template_html.tpl
new file mode 100644
index 000000000..68756bdf3
--- /dev/null
+++ b/modules/bankwire/mails/en/mail_template_html.tpl
@@ -0,0 +1,26 @@
+
+
+
+
+ | |
+
+
+
+ {l s='Here are the bank details for your transfer:' mod='bankwire'}
+
+
+ {l s='Amount:' mod='bankwire'} {literal}{total_paid}{/literal}
+ {l s='Account owner:' mod='bankwire'} {$bankwire_owner}
+ {l s='Account details:' mod='bankwire'} {$bankwire_details}
+ {l s='Bank address:' mod='bankwire'} {$bankwire_address}
+
+
+ |
+ |
+
+
+ |
+
+
+
+
\ No newline at end of file
diff --git a/modules/bankwire/mails/en/mail_template_text.tpl b/modules/bankwire/mails/en/mail_template_text.tpl
new file mode 100644
index 000000000..6b2de81ca
--- /dev/null
+++ b/modules/bankwire/mails/en/mail_template_text.tpl
@@ -0,0 +1,6 @@
+{l s='Here are the bank details for your transfer:' mod='bankwire'}
+
+{l s='Amount:' mod='bankwire'} {literal}{total_paid}{/literal}
+{l s='Account owner:' mod='bankwire'} {$bankwire_owner}
+{l s='Account details:' mod='bankwire'} {$bankwire_details}
+{l s='Bank address:' mod='bankwire'} {$bankwire_address}
diff --git a/modules/bankwire/mails/index.php b/modules/bankwire/mails/index.php
new file mode 100644
index 000000000..8d2cf16fe
--- /dev/null
+++ b/modules/bankwire/mails/index.php
@@ -0,0 +1,29 @@
+
+* @copyright 2010-2022 Webkul IN
+* @license https://store.webkul.com/license.html
+*/
+
+header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
+header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
+
+header('Cache-Control: no-store, no-cache, must-revalidate');
+header('Cache-Control: post-check=0, pre-check=0', false);
+header('Pragma: no-cache');
+
+header('Location: ../../../');
+exit;
diff --git a/modules/cheque/cheque.php b/modules/cheque/cheque.php
index e85bc146e..133f9219c 100644
--- a/modules/cheque/cheque.php
+++ b/modules/cheque/cheque.php
@@ -69,11 +69,27 @@ class Cheque extends PaymentModule
$this->warning = $this->l('No currency has been set for this module.');
}
- $this->extra_mail_vars = array(
- '{cheque_name}' => Configuration::get('CHEQUE_NAME'),
- '{cheque_address}' => Configuration::get('CHEQUE_ADDRESS'),
- '{cheque_address_html}' => str_replace("\n", ' ', Configuration::get('CHEQUE_ADDRESS'))
- );
+ $this->payment_type = PaymentModule::PAYMENT_TYPE_REMOTE_PAYMENT;
+ }
+
+ public function getMailContent($id_order_state, $id_lang)
+ {
+ if (Configuration::get('PS_OS_AWATING') == $id_order_state) {
+ $this->context->smarty->assign(array(
+ 'cheque_name' => Configuration::get('CHEQUE_NAME'),
+ 'cheque_address' => Configuration::get('CHEQUE_ADDRESS'),
+ 'cheque_address_html' => str_replace("\n", ' ', Configuration::get('CHEQUE_ADDRESS'))
+ ));
+ return array(
+ '{payment_module_detail_html}' => $this->context->smarty->fetch(
+ $this->local_path.'mails/'.Language::getIsoById($id_lang).'/mail_template_html.tpl'
+ ),
+ '{payment_module_detail_text}' => $this->context->smarty->fetch(
+ $this->local_path.'mails/'.Language::getIsoById($id_lang).'/mail_template_text.tpl'
+ )
+ );
+ }
+ return false;
}
public function install()
@@ -177,9 +193,7 @@ class Cheque extends PaymentModule
if (in_array(
$orderState,
array(
- Configuration::get('PS_OS_CHEQUE'),
- Configuration::get('PS_OS_OUTOFSTOCK'),
- Configuration::get('PS_OS_OUTOFSTOCK_UNPAID')
+ Configuration::get('PS_OS_AWATING')
)
)) {
$objCart = new Cart($objOrder->id_cart);
diff --git a/modules/cheque/controllers/front/validation.php b/modules/cheque/controllers/front/validation.php
index 8fb8401f1..008e2f063 100644
--- a/modules/cheque/controllers/front/validation.php
+++ b/modules/cheque/controllers/front/validation.php
@@ -77,7 +77,7 @@ class ChequeValidationModuleFrontController extends ModuleFrontController
'{cheque_address}' => Configuration::get('CHEQUE_ADDRESS'),
'{cheque_address_html}' => str_replace("\n", ' ', Configuration::get('CHEQUE_ADDRESS')));
- $this->module->validateOrder((int)$cart->id, Configuration::get('PS_OS_CHEQUE'), $total, $this->module->displayName, NULL, $mailVars, (int)$currency->id, false, $customer->secure_key);
+ $this->module->validateOrder((int)$cart->id, Configuration::get('PS_OS_PAYMENT'), $total, $this->module->displayName, NULL, $mailVars, (int)$currency->id, false, $customer->secure_key);
Tools::redirect('index.php?controller=order-confirmation&id_cart='.(int)$cart->id.'&id_module='.(int)$this->module->id.'&id_order='.$this->module->currentOrder.'&key='.$customer->secure_key);
}
}
diff --git a/modules/cheque/mails/en/index.php b/modules/cheque/mails/en/index.php
new file mode 100644
index 000000000..8d2cf16fe
--- /dev/null
+++ b/modules/cheque/mails/en/index.php
@@ -0,0 +1,29 @@
+
+* @copyright 2010-2022 Webkul IN
+* @license https://store.webkul.com/license.html
+*/
+
+header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
+header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
+
+header('Cache-Control: no-store, no-cache, must-revalidate');
+header('Cache-Control: post-check=0, pre-check=0', false);
+header('Pragma: no-cache');
+
+header('Location: ../../../');
+exit;
diff --git a/modules/cheque/mails/en/mail_template_html.tpl b/modules/cheque/mails/en/mail_template_html.tpl
new file mode 100644
index 000000000..f2b778ba0
--- /dev/null
+++ b/modules/cheque/mails/en/mail_template_html.tpl
@@ -0,0 +1,25 @@
+
+
+
+
+ | |
+
+
+
+ {l s='Here are the bank details for your check:' mod='cheque'}
+
+
+ {l s='Amount:' mod='cheque'} {literal}{total_paid}{/literal}
+ {l s='Payable to the order of:' mod='cheque'} {$cheque_name}
+ {l s='Please mail your check to:' mod='cheque'} {$cheque_address_html}
+
+
+ |
+ |
+
+
+ |
+
+
+
+
\ No newline at end of file
diff --git a/modules/cheque/mails/en/mail_template_text.tpl b/modules/cheque/mails/en/mail_template_text.tpl
new file mode 100644
index 000000000..38f153c11
--- /dev/null
+++ b/modules/cheque/mails/en/mail_template_text.tpl
@@ -0,0 +1,5 @@
+{l s='Here are the bank details for your check:' mod='cheque'}
+
+{l s='Amount:' mod='cheque'} {literal}{total_paid}{/literal}
+{l s='Payable to the order of:' mod='cheque'} {$cheque_name}
+{l s='Please mail your check to:' mod='cheque'} {$cheque_address}
diff --git a/modules/cheque/mails/index.php b/modules/cheque/mails/index.php
new file mode 100644
index 000000000..8d2cf16fe
--- /dev/null
+++ b/modules/cheque/mails/index.php
@@ -0,0 +1,29 @@
+
+* @copyright 2010-2022 Webkul IN
+* @license https://store.webkul.com/license.html
+*/
+
+header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
+header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
+
+header('Cache-Control: no-store, no-cache, must-revalidate');
+header('Cache-Control: post-check=0, pre-check=0', false);
+header('Pragma: no-cache');
+
+header('Location: ../../../');
+exit;
diff --git a/modules/qlopaypalcommerce/classes/WkPaypalCommerceDb.php b/modules/qlopaypalcommerce/classes/WkPaypalCommerceDb.php
index 60b54c0bb..8c19bfe1a 100644
--- a/modules/qlopaypalcommerce/classes/WkPaypalCommerceDb.php
+++ b/modules/qlopaypalcommerce/classes/WkPaypalCommerceDb.php
@@ -130,61 +130,4 @@ class WkPaypalCommerceDb
),
);
}
-
- public function createPaypalAwaitingOrderState()
- {
- $orderStatus = new OrderState();
- $orderStatus->invoice = 0;
- $orderStatus->send_email = 0;
- $orderStatus->module_name = 'qlopaypalcommerce';
- $orderStatus->color = '#ff8942';
- $orderStatus->unremovable = 1;
-
- foreach (Language::getLanguages(false) as $lang) {
- $orderStatus->name[$lang['id_lang']] = 'PayPal Payment Awaiting';
- $orderStatus->template[$lang['id_lang']] = '';
- }
-
- if ($orderStatus->save()) {
- $source = _PS_MODULE_DIR_.'qlopaypalcommerce/views/img/1.gif';
- $destination = _PS_ORDER_STATE_IMG_DIR_.$orderStatus->id.'.gif';
- Tools::copy($source, $destination);
-
- Configuration::updateValue('PS_OS_PAYPAL_COMMERCE_AWAITING', $orderStatus->id);
-
- return true;
- }
-
- return false;
- }
-
- public function createPartialPaymentOrderState()
- {
- if (!Configuration::get('PS_OS_PARTIAL_PAYMENT')) {
- $objOrderState = new OrderState();
- $objOrderState->name = array();
-
- foreach (Language::getLanguages() as $language) {
- $objOrderState->name[$language['id_lang']] = 'Partial Payment Accepted';
- }
- $objOrderState->module_name = 'qlopaypalcommerce';
- $objOrderState->send_email = false;
- $objOrderState->unremovable = false;
- $objOrderState->color = '#AAFFA4';
- $objOrderState->hidden = false;
- $objOrderState->delivery = false;
- $objOrderState->logable = true;
- $objOrderState->invoice = true;
-
- if ($objOrderState->save()) {
- $source = _PS_MODULE_DIR_.'qlopaypalcommerce/logo.gif';
- $destination = _PS_ORDER_STATE_IMG_DIR_.$objOrderState->id.'.gif';
- Tools::copy($source, $destination);
-
- Configuration::updateValue('PS_OS_PARTIAL_PAYMENT', (int) $objOrderState->id);
- }
- }
-
- return true;
- }
}
diff --git a/modules/qlopaypalcommerce/controllers/front/payment.php b/modules/qlopaypalcommerce/controllers/front/payment.php
index 9412e26f1..4fa88eeb2 100644
--- a/modules/qlopaypalcommerce/controllers/front/payment.php
+++ b/modules/qlopaypalcommerce/controllers/front/payment.php
@@ -138,7 +138,7 @@ class QloPaypalCommercePaymentModuleFrontController extends ModuleFrontControlle
$orderStatus = Configuration::get('PS_OS_PAYMENT');
}
} else {
- $orderStatus = Configuration::get('PS_OS_PAYPAL_COMMERCE_AWAITING');
+ $orderStatus = Configuration::get('PS_OS_AWATING');
}
// create order for the payment
diff --git a/modules/qlopaypalcommerce/qlopaypalcommerce.php b/modules/qlopaypalcommerce/qlopaypalcommerce.php
index ef46d73ef..bdb5b8517 100644
--- a/modules/qlopaypalcommerce/qlopaypalcommerce.php
+++ b/modules/qlopaypalcommerce/qlopaypalcommerce.php
@@ -91,6 +91,8 @@ class QloPaypalCommerce extends PaymentModule
}
parent::__construct();
+
+ $this->payment_type = PaymentModule::PAYMENT_TYPE_ONLINE;
}
public function getContent()
@@ -534,8 +536,6 @@ class QloPaypalCommerce extends PaymentModule
{
$objModuleDb = new WkPaypalCommerceDb();
if (!parent::install()
- || !$objModuleDb->createPartialPaymentOrderState()
- || !$objModuleDb->createPaypalAwaitingOrderState()
|| !$objModuleDb->createTables()
|| !$this->callInstallTab()
|| !$this->registerModuleHooks()
From 02b81c50cb20b9dbe007196596a9b6a58b234c91 Mon Sep 17 00:00:00 2001
From: Shreesh Arora
Date: Tue, 27 Sep 2022 11:55:31 +0530
Subject: [PATCH 02/60] updated order status cheque module | added missing
licence
---
.../bankwire/mails/en/mail_template_html.tpl | 18 ++++++++++++++++++
.../bankwire/mails/en/mail_template_text.tpl | 18 ++++++++++++++++++
.../cheque/controllers/front/validation.php | 2 +-
modules/cheque/mails/en/mail_template_html.tpl | 18 ++++++++++++++++++
modules/cheque/mails/en/mail_template_text.tpl | 18 ++++++++++++++++++
5 files changed, 73 insertions(+), 1 deletion(-)
diff --git a/modules/bankwire/mails/en/mail_template_html.tpl b/modules/bankwire/mails/en/mail_template_html.tpl
index 68756bdf3..f0df3ea06 100644
--- a/modules/bankwire/mails/en/mail_template_html.tpl
+++ b/modules/bankwire/mails/en/mail_template_html.tpl
@@ -1,3 +1,21 @@
+{*
+* 2010-2022 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
+* @copyright 2010-2022 Webkul IN
+* @license https://store.webkul.com/license.html
+*}
diff --git a/modules/bankwire/mails/en/mail_template_text.tpl b/modules/bankwire/mails/en/mail_template_text.tpl
index 6b2de81ca..c15a111f6 100644
--- a/modules/bankwire/mails/en/mail_template_text.tpl
+++ b/modules/bankwire/mails/en/mail_template_text.tpl
@@ -1,3 +1,21 @@
+{*
+* 2010-2022 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
+* @copyright 2010-2022 Webkul IN
+* @license https://store.webkul.com/license.html
+*}
{l s='Here are the bank details for your transfer:' mod='bankwire'}
{l s='Amount:' mod='bankwire'} {literal}{total_paid}{/literal}
diff --git a/modules/cheque/controllers/front/validation.php b/modules/cheque/controllers/front/validation.php
index 008e2f063..b31e3451f 100644
--- a/modules/cheque/controllers/front/validation.php
+++ b/modules/cheque/controllers/front/validation.php
@@ -77,7 +77,7 @@ class ChequeValidationModuleFrontController extends ModuleFrontController
'{cheque_address}' => Configuration::get('CHEQUE_ADDRESS'),
'{cheque_address_html}' => str_replace("\n", ' ', Configuration::get('CHEQUE_ADDRESS')));
- $this->module->validateOrder((int)$cart->id, Configuration::get('PS_OS_PAYMENT'), $total, $this->module->displayName, NULL, $mailVars, (int)$currency->id, false, $customer->secure_key);
+ $this->module->validateOrder((int)$cart->id, Configuration::get('PS_OS_AWATING'), $total, $this->module->displayName, NULL, $mailVars, (int)$currency->id, false, $customer->secure_key);
Tools::redirect('index.php?controller=order-confirmation&id_cart='.(int)$cart->id.'&id_module='.(int)$this->module->id.'&id_order='.$this->module->currentOrder.'&key='.$customer->secure_key);
}
}
diff --git a/modules/cheque/mails/en/mail_template_html.tpl b/modules/cheque/mails/en/mail_template_html.tpl
index f2b778ba0..8fb0d1891 100644
--- a/modules/cheque/mails/en/mail_template_html.tpl
+++ b/modules/cheque/mails/en/mail_template_html.tpl
@@ -1,3 +1,21 @@
+{*
+* 2010-2022 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
+* @copyright 2010-2022 Webkul IN
+* @license https://store.webkul.com/license.html
+*}
diff --git a/modules/cheque/mails/en/mail_template_text.tpl b/modules/cheque/mails/en/mail_template_text.tpl
index 38f153c11..ece2eaffa 100644
--- a/modules/cheque/mails/en/mail_template_text.tpl
+++ b/modules/cheque/mails/en/mail_template_text.tpl
@@ -1,3 +1,21 @@
+{*
+* 2010-2022 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
+* @copyright 2010-2022 Webkul IN
+* @license https://store.webkul.com/license.html
+*}
{l s='Here are the bank details for your check:' mod='cheque'}
{l s='Amount:' mod='cheque'} {literal}{total_paid}{/literal}
From 373bc1138e0da688b6a61a81f1cbb86333c6f28b Mon Sep 17 00:00:00 2001
From: Shreesh Arora
Date: Wed, 9 Nov 2022 15:41:58 +0530
Subject: [PATCH 03/60] apply dicount coupon on due amount in advance payment
---
classes/Cart.php | 18 +++++++++++++++++-
classes/CartRule.php | 25 ++++++++++++++++++++-----
2 files changed, 37 insertions(+), 6 deletions(-)
diff --git a/classes/Cart.php b/classes/Cart.php
index 9d08d6834..2d7da1a43 100644
--- a/classes/Cart.php
+++ b/classes/Cart.php
@@ -1717,6 +1717,7 @@ class CartCore extends ObjectModel
$order_total_discount = 0;
$order_shipping_discount = 0;
+ $order_total_discount_advance_product = 0;
if (!in_array($type, array(Cart::ONLY_SHIPPING, Cart::ONLY_PRODUCTS, Cart::ADVANCE_PAYMENT_ONLY_PRODUCTS)) && CartRule::isFeatureActive()) {
// First, retrieve the cart rules associated to this "getOrderTotal"
if ($with_shipping || $type == Cart::ONLY_DISCOUNTS) {
@@ -1773,10 +1774,25 @@ class CartCore extends ObjectModel
// If the cart rule offers a reduction, the amount is prorated (with the products in the package)
if ($cart_rule['obj']->reduction_percent > 0 || $cart_rule['obj']->reduction_amount > 0) {
$order_total_discount += Tools::ps_round($cart_rule['obj']->getContextualValue($with_taxes, $virtual_context, CartRule::FILTER_ACTION_REDUCTION, $package, $use_cache), $compute_precision);
+
+ if ($type == Cart::ADVANCE_PAYMENT) {
+ $order_total_discount_advance_product += Tools::ps_round($cart_rule['obj']->getContextualValue($with_taxes, $virtual_context, CartRule::FILTER_ACTION_REDUCTION, $package, $use_cache, true), $compute_precision);
+ }
}
}
$order_total_discount = min(Tools::ps_round($order_total_discount, 2), (float)$order_total_products) + (float)$order_shipping_discount;
- $order_total -= $order_total_discount;
+ if ($type == Cart::ADVANCE_PAYMENT) {
+ // if discount is greater than due amount then only decrease the price of advance payment amount
+ // otherwise discount will be applied on due amount not advance payment amount
+ $total_without_discount = self::getOrderTotal() + $order_total_discount;
+ $due_amount = $total_without_discount - $order_total;
+ if ($order_total_discount_advance_product > $due_amount) {
+ $order_total -= ($order_total_discount_advance_product - $due_amount);
+ }
+ $order_total -= $order_total_discount - $order_total_discount_advance_product;
+ } else {
+ $order_total -= $order_total_discount;
+ }
}
if ($type == Cart::BOTH || $type == Cart::ADVANCE_PAYMENT) {
diff --git a/classes/CartRule.php b/classes/CartRule.php
index 88670b0de..b4059af27 100644
--- a/classes/CartRule.php
+++ b/classes/CartRule.php
@@ -877,7 +877,7 @@ class CartRuleCore extends ObjectModel
* @param bool $use_cache Allow using cache to avoid multiple free gift using multishipping
* @return float|int|string
*/
- public function getContextualValue($use_tax, Context $context = null, $filter = null, $package = null, $use_cache = true)
+ public function getContextualValue($use_tax, Context $context = null, $filter = null, $package = null, $use_cache = true, $forAdvancePayment = false)
{
if (!CartRule::isFeatureActive()) {
return 0;
@@ -890,15 +890,30 @@ class CartRuleCore extends ObjectModel
}
$all_products = $context->cart->getProducts();
- $package_products = (is_null($package) ? $all_products : $package['products']);
+ if (is_null($package)) {
+ $package = array(
+ 'products' => $all_products,
+ 'id_carrier' => null,
+ 'id_address' => 0
+ );
+ }
$reduction_value = 0;
-
- $cache_id = 'getContextualValue_'.(int)$this->id.'_'.(int)$use_tax.'_'.(int)$context->cart->id.'_'.(int)$filter;
- foreach ($package_products as $product) {
+ $objHotelAdvancePayment = new HotelAdvancedPayment();
+ $cache_id = 'getContextualValue_'.(int)$this->id.'_'.(int)$use_tax.'_'.(int)$context->cart->id.'_'.(int)$filter.'_'.(int)$forAdvancePayment;
+ foreach ($package['products'] as $key => $product) {
+ if ($forAdvancePayment) {
+ $paymentInfo = $objHotelAdvancePayment->getIdAdvPaymentByIdProduct($product['id_product']);
+ if (!$paymentInfo['active']) {
+ unset($package['products'][$key]);
+ continue;
+ }
+ }
$cache_id .= '_'.(int)$product['id_product'].'_'.(int)$product['id_product_attribute'].(isset($product['in_stock']) ? '_'.(int)$product['in_stock'] : '');
}
+ $package_products = $package['products'];
+
if (Cache::isStored($cache_id)) {
return Cache::retrieve($cache_id);
}
From ed13e9c076b72233fd0b6999db507ba6138f2e57 Mon Sep 17 00:00:00 2001
From: Sumit Panwar
Date: Wed, 23 Nov 2022 13:03:38 +0530
Subject: [PATCH 04/60] Resolved : count(): Parameter must be an array or an
object that implements Countable In
classes/webservice/WebserviceOutputJSON.php
---
classes/webservice/WebserviceOutputJSON.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/classes/webservice/WebserviceOutputJSON.php b/classes/webservice/WebserviceOutputJSON.php
index f1e8cf7c5..0e2da03c4 100644
--- a/classes/webservice/WebserviceOutputJSON.php
+++ b/classes/webservice/WebserviceOutputJSON.php
@@ -40,7 +40,7 @@ class WebserviceOutputJSON implements WebserviceOutputInterface
/**
* Current association
*/
- protected $currentAssociatedEntity;
+ protected $currentAssociatedEntity = array();
/**
* Json content
From da494b89d9f6fa877fa8031462fc5115c9cc0b4e Mon Sep 17 00:00:00 2001
From: Shreesh Arora
Date: Wed, 23 Nov 2022 15:52:26 +0530
Subject: [PATCH 05/60] update configuration key for statuses
---
install/data/xml/configuration.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/install/data/xml/configuration.xml b/install/data/xml/configuration.xml
index b549e3245..eba6f6a01 100644
--- a/install/data/xml/configuration.xml
+++ b/install/data/xml/configuration.xml
@@ -407,10 +407,10 @@
11
-
+
9
-
+
10
+
+ 9
+
10
-
- 7
+
+ 10
11
-
- 9
-
-
- 10
+
+ 11
-
- 7
-
-
- 11
-
-
- 8
-
0
@@ -611,9 +614,6 @@
gridhtml
-
- 10
-
100
@@ -650,9 +650,6 @@
http://www.qloapps.com
-
- store.jpg
-
jpg
@@ -668,26 +665,6 @@
-
- Your company
-
-
- Address line 1
-City
-Country
-
-
- 0123-456-789
-
-
- pub@qloapps.com
-
-
- 0123-456-789
-
-
- pub@qloapps.com
-
1
@@ -709,18 +686,6 @@ Country
5
-
- 535
-
-
- 1300
-
-
- 7700
-
-
- 1
-
m
From 4da84bfbd42a46aa70df0eb7692aa3e742930436 Mon Sep 17 00:00:00 2001
From: Abhishek Kumar
Date: Tue, 6 Dec 2022 12:20:46 +0530
Subject: [PATCH 09/60] Remove usage of $_COOKIE when creating a booking at
back office
---
classes/PaymentModule.php | 8 --------
controllers/admin/AdminOrdersController.php | 7 +++++++
.../classes/HotelBookingDetail.php | 5 +++--
.../admin/AdminHotelRoomsBookingController.php | 18 +++++++-----------
4 files changed, 17 insertions(+), 21 deletions(-)
diff --git a/classes/PaymentModule.php b/classes/PaymentModule.php
index d40602bde..56d60a748 100644
--- a/classes/PaymentModule.php
+++ b/classes/PaymentModule.php
@@ -849,14 +849,6 @@ abstract class PaymentModuleCore extends Module
// delete cart feature prices after booking creation success
HotelRoomTypeFeaturePricing::deleteByIdCart($id_cart);
- if (isset($_COOKIE['wk_id_cart'])) {
- setcookie('wk_id_cart', ' ', time() - 86400, $this->context->shop->physical_uri);
- setcookie('wk_id_guest', ' ', time() - 86400, $this->context->shop->physical_uri);
-
- unset($_COOKIE['wk_id_cart']);
- unset($_COOKIE['wk_id_guest']);
- }
-
if (self::DEBUG_MODE) {
PrestaShopLogger::addLog('PaymentModule::validateOrder - Hook validateOrder is about to be called', 1, null, 'Cart', (int)$id_cart, true);
}
diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php
index 1fc055c12..bf5d787c0 100644
--- a/controllers/admin/AdminOrdersController.php
+++ b/controllers/admin/AdminOrdersController.php
@@ -865,6 +865,13 @@ class AdminOrdersControllerCore extends AdminController
$cart->secure_key
);
+ if (isset($this->context->cookie->wk_id_cart)) {
+ unset($this->context->cookie->wk_id_cart);
+ }
+ if (isset($this->context->cookie->wk_id_guest)) {
+ unset($this->context->cookie->wk_id_guest);
+ }
+
if ($payment_module->currentOrder) {
Tools::redirectAdmin(self::$currentIndex.'&id_order='.$payment_module->currentOrder.'&vieworder'.'&token='.$this->token.'&conf=3');
}
diff --git a/modules/hotelreservationsystem/classes/HotelBookingDetail.php b/modules/hotelreservationsystem/classes/HotelBookingDetail.php
index 3f020f1ff..6e8f3c505 100644
--- a/modules/hotelreservationsystem/classes/HotelBookingDetail.php
+++ b/modules/hotelreservationsystem/classes/HotelBookingDetail.php
@@ -979,8 +979,9 @@ class HotelBookingDetail extends ObjectModel
*/
public function getAvailableRoomsForReallocation($date_from, $date_to, $room_type, $hotel_id)
{
- if (isset($_COOKIE['wk_id_cart'])) {
- $current_admin_cart_id = $_COOKIE['wk_id_cart'];
+ $context = Context::getContext();
+ if (isset($context->cookie->wk_id_cart)) {
+ $current_admin_cart_id = $context->cookie->wk_id_cart;
}
$exclude_ids = 'SELECT `id_room` FROM `'._DB_PREFIX_.'htl_booking_detail`
WHERE `date_from` < \''.pSQL($date_to).'\' AND `date_to` > \''.pSQL($date_from).'\'
diff --git a/modules/hotelreservationsystem/controllers/admin/AdminHotelRoomsBookingController.php b/modules/hotelreservationsystem/controllers/admin/AdminHotelRoomsBookingController.php
index 61800e722..9a3a79eca 100644
--- a/modules/hotelreservationsystem/controllers/admin/AdminHotelRoomsBookingController.php
+++ b/modules/hotelreservationsystem/controllers/admin/AdminHotelRoomsBookingController.php
@@ -30,26 +30,22 @@ class AdminHotelRoomsBookingController extends ModuleAdminController
parent::__construct();
- //unset($_COOKIE['wk_id_guest']);
- //unset($_COOKIE['wk_id_cart']);
$this->setPhpCookieData();
}
public function setPhpCookieData()
{
- if (!isset($_COOKIE['wk_id_guest']) || !$_COOKIE['wk_id_guest']) {
+ if (!isset($this->context->cookie->wk_id_guest) || !$this->context->cookie->wk_id_guest) {
if (!isset($this->context->cookie->id_guest)) {
Guest::setNewGuest($this->context->cookie);
}
- setcookie('wk_id_guest', $this->context->cookie->id_guest, time() + 86400, $this->context->shop->physical_uri);
+ $this->context->cookie->wk_id_guest = $this->context->cookie->id_guest;
} else {
- $this->context->cookie->id_guest = $_COOKIE['wk_id_guest'];
- setcookie('wk_id_guest', $this->context->cookie->id_guest, time() + 86400, $this->context->shop->physical_uri);
+ $this->context->cookie->id_guest = $this->context->cookie->wk_id_guest;
}
- $guest = new Guest($this->context->cookie->id_guest);
- if (!isset($_COOKIE['wk_id_cart']) && !isset($this->context->cart->id)) {
+ if (!isset($this->context->cookie->wk_id_cart) && !isset($this->context->cart->id)) {
$cart = new Cart();
$cart->recyclable = 0;
@@ -67,13 +63,13 @@ class AdminHotelRoomsBookingController extends ModuleAdminController
$this->context->cart = $cart;
$this->context->cookie->id_cart = $cart->id;
- setcookie('wk_id_cart', $cart->id, time() + 86400, $this->context->shop->physical_uri);
+ $this->context->cookie->wk_id_cart = $cart->id;
} else {
- $cart = new Cart((int)$_COOKIE['wk_id_cart']);
+ $cart = new Cart((int) $this->context->cookie->wk_id_cart);
$this->context->cart = $cart;
$this->context->cookie->id_cart = $cart->id;
- setcookie('wk_id_cart', $cart->id, time() + 86400, $this->context->shop->physical_uri);
+ $this->context->cookie->wk_id_cart = $cart->id;
}
$customer = new Customer();
From 50491e7f128f6f44cfcdd1029f08fbb407a7fa61 Mon Sep 17 00:00:00 2001
From: Abhishek Kumar
Date: Tue, 31 May 2022 18:18:49 +0530
Subject: [PATCH 10/60] Fix applied voucher amount exceeds restricted room type
price
---
classes/CartRule.php | 28 ++++++++++++++++++++++++++--
classes/PaymentModule.php | 24 +++++++++++++++++++-----
2 files changed, 45 insertions(+), 7 deletions(-)
diff --git a/classes/CartRule.php b/classes/CartRule.php
index b4059af27..22726708e 100644
--- a/classes/CartRule.php
+++ b/classes/CartRule.php
@@ -1016,7 +1016,7 @@ class CartRuleCore extends ObjectModel
$reduction_value += $selected_products_reduction * $this->reduction_percent / 100;
}
- // Discount (¤)
+ // Discount (by amount)
if ((float)$this->reduction_amount > 0) {
$prorata = 1;
if (!is_null($package) && count($all_products)) {
@@ -1026,7 +1026,31 @@ class CartRuleCore extends ObjectModel
}
}
+ $restricted_product = null;
+ // If the cart rule is restricted to one room type it can't exceed this room type price
+ if ($this->reduction_product > 0) {
+ foreach ($package_products as $product) {
+ if ($product['id_product'] == $this->reduction_product) {
+ $restricted_product = $product;
+ }
+ }
+ }
+
$reduction_amount = $this->reduction_amount;
+ if ($this->reduction_product) {
+ if ($restricted_product) {
+ $prorata = 1; // do not split this cart rule
+ if ($this->reduction_tax) {
+ $max_reduction_amount = (int)$restricted_product['cart_quantity'] * (float)$restricted_product['price_wt'];
+ } else {
+ $max_reduction_amount = (int)$restricted_product['cart_quantity'] * (float)$restricted_product['price'];
+ }
+ $reduction_amount = min($reduction_amount, $max_reduction_amount);
+ } else {
+ $reduction_amount = 0;
+ }
+ }
+
// If we need to convert the voucher value to the cart currency
if (isset($context->currency) && $this->reduction_currency != $context->currency->id) {
$voucherCurrency = new Currency($this->reduction_currency);
@@ -1073,7 +1097,7 @@ class CartRuleCore extends ObjectModel
}
}
}
- // Discount (¤) on the whole order
+ // Discount (by amount) on the whole order
elseif ($this->reduction_product == 0) {
$cart_amount_te = null;
$cart_amount_ti = null;
diff --git a/classes/PaymentModule.php b/classes/PaymentModule.php
index c73fbc854..24c15fcb8 100644
--- a/classes/PaymentModule.php
+++ b/classes/PaymentModule.php
@@ -547,6 +547,10 @@ abstract class PaymentModuleCore extends Module
$total_reduction_value_ti = 0;
$total_reduction_value_tex = 0;
foreach ($cart_rules as $cart_rule) {
+ if ($cart_rule['obj']->reduction_product > 0 && !$order->orderContainProduct($cart_rule['obj']->reduction_product)) {
+ continue;
+ }
+
$package = array('id_carrier' => $order->id_carrier, 'id_address' => $order->id_address_delivery, 'products' => $order->product_list);
$values = array(
'tax_incl' => $cart_rule['obj']->getContextualValue(true, $this->context, CartRule::FILTER_ACTION_ALL_NOCAP, $package),
@@ -565,7 +569,20 @@ abstract class PaymentModuleCore extends Module
// This is an "amount" reduction, not a reduction in % or a gift
// THEN
// The voucher is cloned with a new value corresponding to the remainder
- if (count($order_list) == 1 && $values['tax_incl'] > ($order->total_products_wt - $total_reduction_value_ti) && $cart_rule['obj']->partial_use == 1 && $cart_rule['obj']->reduction_amount > 0) {
+ $reduction_amount_converted = $cart_rule['obj']->reduction_amount;
+ if ((int) $cart_rule['obj']->reduction_currency !== (int) $cart->id_currency) {
+ $reduction_amount_converted = Tools::convertPriceFull(
+ $cart_rule['obj']->reduction_amount,
+ new Currency($cart_rule['obj']->reduction_currency),
+ new Currency($cart->id_currency)
+ );
+ }
+ if ($cart_rule['obj']->reduction_tax) {
+ $remaining_amount = $reduction_amount_converted - $values['tax_incl'];
+ } else {
+ $remaining_amount = $reduction_amount_converted - $values['tax_excl'];
+ }
+ if (count($order_list) == 1 && $remaining_amount > 0 && $cart_rule['obj']->partial_use == 1 && $reduction_amount_converted > 0) {
// Create a new voucher from the original
$voucher = new CartRule((int)$cart_rule['obj']->id); // We need to instantiate the CartRule without lang parameter to allow saving it
unset($voucher->id);
@@ -577,16 +594,13 @@ abstract class PaymentModuleCore extends Module
}
// Set the new voucher value
+ $voucher->reduction_amount = $remaining_amount;
if ($voucher->reduction_tax) {
- $voucher->reduction_amount = ($total_reduction_value_ti + $values['tax_incl']) - $order->total_products_wt;
-
// Add total shipping amout only if reduction amount > total shipping
if ($voucher->free_shipping == 1 && $voucher->reduction_amount >= $order->total_shipping_tax_incl) {
$voucher->reduction_amount -= $order->total_shipping_tax_incl;
}
} else {
- $voucher->reduction_amount = ($total_reduction_value_tex + $values['tax_excl']) - $order->total_products;
-
// Add total shipping amout only if reduction amount > total shipping
if ($voucher->free_shipping == 1 && $voucher->reduction_amount >= $order->total_shipping_tax_excl) {
$voucher->reduction_amount -= $order->total_shipping_tax_excl;
From fdd1974d632ad3ab16bc080bdda7c14d57df228f Mon Sep 17 00:00:00 2001
From: Shreesh Arora
Date: Wed, 7 Dec 2022 11:47:23 +0530
Subject: [PATCH 11/60] update partial payment addition in payement table
---
classes/order/OrderHistory.php | 2 ++
1 file changed, 2 insertions(+)
diff --git a/classes/order/OrderHistory.php b/classes/order/OrderHistory.php
index d9f47288c..0f5716ade 100644
--- a/classes/order/OrderHistory.php
+++ b/classes/order/OrderHistory.php
@@ -326,6 +326,8 @@ class OrderHistoryCore extends ObjectModel
&& $order->total_paid_real < $order->advance_paid_amount
) {
$rest_paid = $order->advance_paid_amount - $order->total_paid_real;
+ } else {
+ break;
}
$payment = new OrderPayment();
$payment->order_reference = Tools::substr($order->reference, 0, 9);
From 879be11fbd41f5b16a54073276068fdbcbc69f66 Mon Sep 17 00:00:00 2001
From: Shreesh Arora
Date: Wed, 7 Dec 2022 15:36:20 +0530
Subject: [PATCH 12/60] update code
---
classes/PaymentModule.php | 17 ++++++-----------
classes/order/Order.php | 2 +-
classes/order/OrderHistory.php | 12 ++++++------
config/config.inc.php | 2 +-
controllers/admin/AdminOrdersController.php | 2 +-
controllers/front/ParentOrderController.php | 2 +-
install/data/xml/configuration.xml | 4 ++--
install/langs/bg/data/order_state.xml | 2 +-
install/langs/bn/data/order_state.xml | 2 +-
install/langs/br/data/order_state.xml | 2 +-
install/langs/cs/data/order_state.xml | 2 +-
install/langs/de/data/order_state.xml | 2 +-
install/langs/en/data/order_state.xml | 2 +-
install/langs/es/data/order_state.xml | 2 +-
install/langs/fa/data/order_state.xml | 2 +-
install/langs/fr/data/order_state.xml | 2 +-
install/langs/he/data/order_state.xml | 2 +-
install/langs/hr/data/order_state.xml | 2 +-
install/langs/hu/data/order_state.xml | 2 +-
install/langs/id/data/order_state.xml | 2 +-
install/langs/it/data/order_state.xml | 2 +-
install/langs/lt/data/order_state.xml | 2 +-
install/langs/mk/data/order_state.xml | 2 +-
install/langs/nl/data/order_state.xml | 2 +-
install/langs/no/data/order_state.xml | 2 +-
install/langs/pl/data/order_state.xml | 2 +-
install/langs/pt/data/order_state.xml | 2 +-
install/langs/qc/data/order_state.xml | 2 +-
install/langs/ro/data/order_state.xml | 2 +-
install/langs/ru/data/order_state.xml | 2 +-
install/langs/si/data/order_state.xml | 2 +-
install/langs/sr/data/order_state.xml | 2 +-
install/langs/sv/data/order_state.xml | 2 +-
install/langs/tw/data/order_state.xml | 2 +-
install/langs/vn/data/order_state.xml | 2 +-
install/langs/zh/data/order_state.xml | 2 +-
modules/bankwire/bankwire.php | 4 ++--
.../bankwire/controllers/front/validation.php | 2 +-
modules/cheque/cheque.php | 4 ++--
modules/cheque/controllers/front/validation.php | 2 +-
.../controllers/front/payment.php | 2 +-
41 files changed, 54 insertions(+), 59 deletions(-)
diff --git a/classes/PaymentModule.php b/classes/PaymentModule.php
index 75fbe8c84..d1433cf41 100644
--- a/classes/PaymentModule.php
+++ b/classes/PaymentModule.php
@@ -26,22 +26,17 @@
abstract class PaymentModuleCore extends Module
{
- /** @var int Current order's id */
- public $currentOrder;
- public $currencies = true;
- public $currencies_mode = 'checkbox';
-
const DEBUG_MODE = false;
const PAYMENT_TYPE_ONLINE = 1;
const PAYMENT_TYPE_PAY_AT_HOTEL = 2;
const PAYMENT_TYPE_REMOTE_PAYMENT = 3;
- public function __construct()
- {
- parent::__construct();
- $this->payment_type = PaymentModule::PAYMENT_TYPE_REMOTE_PAYMENT;
- }
+ /** @var int Current order's id */
+ public $currentOrder;
+ public $currencies = true;
+ public $currencies_mode = 'checkbox';
+ public $payment_type = PaymentModule::PAYMENT_TYPE_REMOTE_PAYMENT;
public function install()
{
@@ -443,7 +438,7 @@ abstract class PaymentModuleCore extends Module
$transaction_id = null;
}
- if (!isset($order) || !Validate::isLoadedObject($order) || !$order->addOrderPayment($amount_paid, null, PaymentModule::PAYMENT_TYPE_ONLINE , $transaction_id)) {
+ if (!isset($order) || !Validate::isLoadedObject($order) || !$order->addOrderPayment($amount_paid, null, $this->payment_type, $transaction_id)) {
PrestaShopLogger::addLog('PaymentModule::validateOrder - Cannot save Order Payment', 3, null, 'Cart', (int)$id_cart, true);
throw new PrestaShopException('Can\'t save Order Payment');
}
diff --git a/classes/order/Order.php b/classes/order/Order.php
index e8fabab7a..4ff1c33d1 100644
--- a/classes/order/Order.php
+++ b/classes/order/Order.php
@@ -1612,7 +1612,7 @@ class OrderCore extends ObjectModel
$payment_module = Module::getInstanceByName($this->module);
$payment_module->orderSource = $this->source;
$customer = new Customer($this->id_customer);
- $payment_module->validateOrder($this->id_cart, Configuration::get('PS_OS_AWATING_REMOTE_PAYMENT'), $this->total_paid, $this->payment, null, array(), null, false, $customer->secure_key);
+ $payment_module->validateOrder($this->id_cart, Configuration::get('PS_OS_AWAITING_REMOTE_PAYMENT'), $this->total_paid, $this->payment, null, array(), null, false, $customer->secure_key);
$this->id = $payment_module->currentOrder;
return true;
}
diff --git a/classes/order/OrderHistory.php b/classes/order/OrderHistory.php
index 0f5716ade..9d121f109 100644
--- a/classes/order/OrderHistory.php
+++ b/classes/order/OrderHistory.php
@@ -322,12 +322,12 @@ class OrderHistoryCore extends ObjectModel
/** @var OrderInvoice $invoice */
$rest_paid = $invoice->getRestPaid();
if ($rest_paid > 0) {
- if (Configuration::get('PS_OS_PARTIAL_PAYMENT') == $new_os->id
- && $order->total_paid_real < $order->advance_paid_amount
- ) {
- $rest_paid = $order->advance_paid_amount - $order->total_paid_real;
- } else {
- break;
+ if (Configuration::get('PS_OS_PARTIAL_PAYMENT') == $new_os->id) {
+ if ($order->total_paid_real < $order->advance_paid_amount) {
+ $rest_paid = $order->advance_paid_amount - $order->total_paid_real;
+ } else {
+ break;
+ }
}
$payment = new OrderPayment();
$payment->order_reference = Tools::substr($order->reference, 0, 9);
diff --git a/config/config.inc.php b/config/config.inc.php
index 674ddc01e..01fd793b7 100644
--- a/config/config.inc.php
+++ b/config/config.inc.php
@@ -238,7 +238,7 @@ $context->link = new Link($https_link, $https_link);
* USE : Configuration::get() method in order to getting the id of order status
*/
-define('_PS_OS_AWATING_', Configuration::get('PS_OS_AWATING'));
+define('_PS_OS_AWAITING_', Configuration::get('PS_OS_AWAITING'));
define('_PS_OS_PAYMENT_', Configuration::get('PS_OS_PAYMENT'));
define('_PS_OS_PROCESSING_', Configuration::get('PS_OS_PROCESSING'));
define('_PS_OS_CANCELED_', Configuration::get('PS_OS_CANCELED'));
diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php
index 36f4505b6..908c3bcc7 100644
--- a/controllers/admin/AdminOrdersController.php
+++ b/controllers/admin/AdminOrdersController.php
@@ -232,7 +232,7 @@ class AdminOrdersControllerCore extends AdminController
$this->addJqueryPlugin(array('autocomplete', 'fancybox', 'typewatch'));
$defaults_order_state = array(
- 'awating' => (int)Configuration::get('PS_OS_AWATING'),
+ 'awaiting' => (int)Configuration::get('PS_OS_AWAITING'),
'other' => (int)Configuration::get('PS_OS_PAYMENT'));
$payment_modules = array();
foreach (PaymentModule::getInstalledPaymentModules() as $p_module) {
diff --git a/controllers/front/ParentOrderController.php b/controllers/front/ParentOrderController.php
index 9f05ead7a..a8faded59 100644
--- a/controllers/front/ParentOrderController.php
+++ b/controllers/front/ParentOrderController.php
@@ -182,7 +182,7 @@ class ParentOrderControllerCore extends FrontController
// order status payment accepted if no amount is pending for the booking
if ($dueAmount > 0) {
- $orderStatus = Configuration::get('PS_OS_AWATING');
+ $orderStatus = Configuration::get('PS_OS_AWAITING');
} else {
$orderStatus = Configuration::get('PS_OS_PAYMENT');
}
diff --git a/install/data/xml/configuration.xml b/install/data/xml/configuration.xml
index 663fc7dfe..f29eb051e 100644
--- a/install/data/xml/configuration.xml
+++ b/install/data/xml/configuration.xml
@@ -374,7 +374,7 @@
1
-
+
1
@@ -410,7 +410,7 @@
-
+
9
diff --git a/install/langs/bg/data/order_state.xml b/install/langs/bg/data/order_state.xml
index 516a2e42d..d0a50242d 100644
--- a/install/langs/bg/data/order_state.xml
+++ b/install/langs/bg/data/order_state.xml
@@ -2,7 +2,7 @@
Awaiting payment
- awating
+ awaiting
Payment accepted
diff --git a/install/langs/bn/data/order_state.xml b/install/langs/bn/data/order_state.xml
index 80a3dad08..f1a4e311b 100644
--- a/install/langs/bn/data/order_state.xml
+++ b/install/langs/bn/data/order_state.xml
@@ -2,7 +2,7 @@
অপেক্ষমান পেমেন্ট
- awating
+ awaiting
পেমেন্ট গৃহীত
diff --git a/install/langs/br/data/order_state.xml b/install/langs/br/data/order_state.xml
index e62b8510d..3ae673a3a 100644
--- a/install/langs/br/data/order_state.xml
+++ b/install/langs/br/data/order_state.xml
@@ -2,7 +2,7 @@
Aguardando pagamento
- awating
+ awaiting
Pagamento aceito
diff --git a/install/langs/cs/data/order_state.xml b/install/langs/cs/data/order_state.xml
index d21deb508..2e1edf045 100644
--- a/install/langs/cs/data/order_state.xml
+++ b/install/langs/cs/data/order_state.xml
@@ -2,7 +2,7 @@
Čeká se na platbu
- awating
+ awaiting
Platba byla přijata
diff --git a/install/langs/de/data/order_state.xml b/install/langs/de/data/order_state.xml
index 933b00906..9ae40deda 100644
--- a/install/langs/de/data/order_state.xml
+++ b/install/langs/de/data/order_state.xml
@@ -2,7 +2,7 @@
Warten auf Zahlung
- awating
+ awaiting
Zahlung eingegangen
diff --git a/install/langs/en/data/order_state.xml b/install/langs/en/data/order_state.xml
index 7b4a5dc43..c153a1108 100644
--- a/install/langs/en/data/order_state.xml
+++ b/install/langs/en/data/order_state.xml
@@ -2,7 +2,7 @@
Awaiting payment
- awating
+ awaiting
Payment accepted
diff --git a/install/langs/es/data/order_state.xml b/install/langs/es/data/order_state.xml
index 565f0779c..8b9745b2c 100644
--- a/install/langs/es/data/order_state.xml
+++ b/install/langs/es/data/order_state.xml
@@ -2,7 +2,7 @@
Pago pendiente
- awating
+ awaiting
Pago aceptado
diff --git a/install/langs/fa/data/order_state.xml b/install/langs/fa/data/order_state.xml
index 39fea76ad..5e9ec1b7f 100644
--- a/install/langs/fa/data/order_state.xml
+++ b/install/langs/fa/data/order_state.xml
@@ -2,7 +2,7 @@
منتظر پرداخت
- awating
+ awaiting
پرداخت تایید شده
diff --git a/install/langs/fr/data/order_state.xml b/install/langs/fr/data/order_state.xml
index 26b248c5c..ba12392d2 100644
--- a/install/langs/fr/data/order_state.xml
+++ b/install/langs/fr/data/order_state.xml
@@ -2,7 +2,7 @@
En attente paiement
- awating
+ awaiting
Paiement accepté
diff --git a/install/langs/he/data/order_state.xml b/install/langs/he/data/order_state.xml
index 979587b98..634c885ff 100644
--- a/install/langs/he/data/order_state.xml
+++ b/install/langs/he/data/order_state.xml
@@ -2,7 +2,7 @@
ממתין לתשלום
- awating
+ awaiting
התקבל תשלום
diff --git a/install/langs/hr/data/order_state.xml b/install/langs/hr/data/order_state.xml
index 516a2e42d..d0a50242d 100644
--- a/install/langs/hr/data/order_state.xml
+++ b/install/langs/hr/data/order_state.xml
@@ -2,7 +2,7 @@
Awaiting payment
- awating
+ awaiting
Payment accepted
diff --git a/install/langs/hu/data/order_state.xml b/install/langs/hu/data/order_state.xml
index b3de46b6f..0e91466b0 100644
--- a/install/langs/hu/data/order_state.xml
+++ b/install/langs/hu/data/order_state.xml
@@ -2,7 +2,7 @@
Awaiting payment
- awating
+ awaiting
Payment accepted
diff --git a/install/langs/id/data/order_state.xml b/install/langs/id/data/order_state.xml
index 4ea433084..bdae92ed7 100644
--- a/install/langs/id/data/order_state.xml
+++ b/install/langs/id/data/order_state.xml
@@ -2,7 +2,7 @@
Menunggu pembayaran
- awating
+ awaiting
Pembayaran diterima
diff --git a/install/langs/it/data/order_state.xml b/install/langs/it/data/order_state.xml
index 5cfee9455..15d5c299a 100644
--- a/install/langs/it/data/order_state.xml
+++ b/install/langs/it/data/order_state.xml
@@ -2,7 +2,7 @@
In attesa del pagamento
- awating
+ awaiting
Pagamento accettato
diff --git a/install/langs/lt/data/order_state.xml b/install/langs/lt/data/order_state.xml
index 2b08f4065..9ef37e7e8 100644
--- a/install/langs/lt/data/order_state.xml
+++ b/install/langs/lt/data/order_state.xml
@@ -2,7 +2,7 @@
Awaiting payment
- awating
+ awaiting
Payment accepted
diff --git a/install/langs/mk/data/order_state.xml b/install/langs/mk/data/order_state.xml
index ca1a854bd..391f50dd5 100644
--- a/install/langs/mk/data/order_state.xml
+++ b/install/langs/mk/data/order_state.xml
@@ -2,7 +2,7 @@
Awaiting payment
- awating
+ awaiting
Payment accepted
diff --git a/install/langs/nl/data/order_state.xml b/install/langs/nl/data/order_state.xml
index c6f6c0913..647699164 100644
--- a/install/langs/nl/data/order_state.xml
+++ b/install/langs/nl/data/order_state.xml
@@ -2,7 +2,7 @@
In afwachting van betaling
- awating
+ awaiting
Betaling aanvaard
diff --git a/install/langs/no/data/order_state.xml b/install/langs/no/data/order_state.xml
index a004b1c0c..2773dbfb1 100644
--- a/install/langs/no/data/order_state.xml
+++ b/install/langs/no/data/order_state.xml
@@ -2,7 +2,7 @@
Awaiting payment
- awating
+ awaiting
Payment accepted
diff --git a/install/langs/pl/data/order_state.xml b/install/langs/pl/data/order_state.xml
index ca080d6a8..332776b28 100644
--- a/install/langs/pl/data/order_state.xml
+++ b/install/langs/pl/data/order_state.xml
@@ -2,7 +2,7 @@
czekać na wypłatę
- awating
+ awaiting
Płatność zaakceptowana
diff --git a/install/langs/pt/data/order_state.xml b/install/langs/pt/data/order_state.xml
index f7aade7cd..096b89ee3 100644
--- a/install/langs/pt/data/order_state.xml
+++ b/install/langs/pt/data/order_state.xml
@@ -2,7 +2,7 @@
A aguardar pagamento
- awating
+ awaiting
Pagamento aceite
diff --git a/install/langs/qc/data/order_state.xml b/install/langs/qc/data/order_state.xml
index d7f557e94..2d77c9d36 100644
--- a/install/langs/qc/data/order_state.xml
+++ b/install/langs/qc/data/order_state.xml
@@ -2,7 +2,7 @@
En attente de paiement
- awating
+ awaiting
Paiement accepté
diff --git a/install/langs/ro/data/order_state.xml b/install/langs/ro/data/order_state.xml
index 5b71d7e9f..fd6dd8ac7 100644
--- a/install/langs/ro/data/order_state.xml
+++ b/install/langs/ro/data/order_state.xml
@@ -2,7 +2,7 @@
În așteptarea plății
- awating
+ awaiting
Plată acceptată
diff --git a/install/langs/ru/data/order_state.xml b/install/langs/ru/data/order_state.xml
index b1013155e..087d333ee 100644
--- a/install/langs/ru/data/order_state.xml
+++ b/install/langs/ru/data/order_state.xml
@@ -2,7 +2,7 @@
Ожидание оплаты
- awating
+ awaiting
Платеж принят
diff --git a/install/langs/si/data/order_state.xml b/install/langs/si/data/order_state.xml
index 2b08f4065..9ef37e7e8 100644
--- a/install/langs/si/data/order_state.xml
+++ b/install/langs/si/data/order_state.xml
@@ -2,7 +2,7 @@
Awaiting payment
- awating
+ awaiting
Payment accepted
diff --git a/install/langs/sr/data/order_state.xml b/install/langs/sr/data/order_state.xml
index ca1a854bd..391f50dd5 100644
--- a/install/langs/sr/data/order_state.xml
+++ b/install/langs/sr/data/order_state.xml
@@ -2,7 +2,7 @@
Awaiting payment
- awating
+ awaiting
Payment accepted
diff --git a/install/langs/sv/data/order_state.xml b/install/langs/sv/data/order_state.xml
index 516a2e42d..d0a50242d 100644
--- a/install/langs/sv/data/order_state.xml
+++ b/install/langs/sv/data/order_state.xml
@@ -2,7 +2,7 @@
Awaiting payment
- awating
+ awaiting
Payment accepted
diff --git a/install/langs/tw/data/order_state.xml b/install/langs/tw/data/order_state.xml
index e1f17f3c0..9717de91a 100644
--- a/install/langs/tw/data/order_state.xml
+++ b/install/langs/tw/data/order_state.xml
@@ -2,7 +2,7 @@
等待付款
- awating
+ awaiting
付款完成
diff --git a/install/langs/vn/data/order_state.xml b/install/langs/vn/data/order_state.xml
index 3b241bb62..f8ed3a75f 100644
--- a/install/langs/vn/data/order_state.xml
+++ b/install/langs/vn/data/order_state.xml
@@ -2,7 +2,7 @@
Đang chờ thanh toán
- awating
+ awaiting
Thanh toán được chấp nhận
diff --git a/install/langs/zh/data/order_state.xml b/install/langs/zh/data/order_state.xml
index 45eb14182..a0e6204e6 100644
--- a/install/langs/zh/data/order_state.xml
+++ b/install/langs/zh/data/order_state.xml
@@ -2,7 +2,7 @@
Awaiting payment
- awating
+ awaiting
Payment accepted
diff --git a/modules/bankwire/bankwire.php b/modules/bankwire/bankwire.php
index a7df7fbe2..757c776bb 100644
--- a/modules/bankwire/bankwire.php
+++ b/modules/bankwire/bankwire.php
@@ -79,7 +79,7 @@ class bankwire extends PaymentModule
public function getMailContent($id_order_state, $id_lang)
{
- if (Configuration::get('PS_OS_AWATING') == $id_order_state) {
+ if (Configuration::get('PS_OS_AWAITING') == $id_order_state) {
$this->context->smarty->assign(array(
'bankwire_owner' => Configuration::get('BANK_WIRE_OWNER'),
'bankwire_details' => nl2br(Configuration::get('BANK_WIRE_DETAILS')),
@@ -210,7 +210,7 @@ class bankwire extends PaymentModule
if (in_array(
$orderState,
array(
- Configuration::get('PS_OS_AWATING'),
+ Configuration::get('PS_OS_AWAITING'),
)
)) {
$objCart = new Cart($objOrder->id_cart);
diff --git a/modules/bankwire/controllers/front/validation.php b/modules/bankwire/controllers/front/validation.php
index 5045f4827..3a083da57 100644
--- a/modules/bankwire/controllers/front/validation.php
+++ b/modules/bankwire/controllers/front/validation.php
@@ -77,7 +77,7 @@ class BankwireValidationModuleFrontController extends ModuleFrontController
'{bankwire_address}' => nl2br(Configuration::get('BANK_WIRE_ADDRESS'))
);
- $this->module->validateOrder($cart->id, Configuration::get('PS_OS_AWATING'), $total, $this->module->displayName, NULL, $mailVars, (int)$currency->id, false, $customer->secure_key);
+ $this->module->validateOrder($cart->id, Configuration::get('PS_OS_AWAITING'), $total, $this->module->displayName, NULL, $mailVars, (int)$currency->id, false, $customer->secure_key);
Tools::redirect('index.php?controller=order-confirmation&id_cart='.$cart->id.'&id_module='.$this->module->id.'&id_order='.$this->module->currentOrder.'&key='.$customer->secure_key);
}
}
diff --git a/modules/cheque/cheque.php b/modules/cheque/cheque.php
index 133f9219c..3271e95d6 100644
--- a/modules/cheque/cheque.php
+++ b/modules/cheque/cheque.php
@@ -74,7 +74,7 @@ class Cheque extends PaymentModule
public function getMailContent($id_order_state, $id_lang)
{
- if (Configuration::get('PS_OS_AWATING') == $id_order_state) {
+ if (Configuration::get('PS_OS_AWAITING') == $id_order_state) {
$this->context->smarty->assign(array(
'cheque_name' => Configuration::get('CHEQUE_NAME'),
'cheque_address' => Configuration::get('CHEQUE_ADDRESS'),
@@ -193,7 +193,7 @@ class Cheque extends PaymentModule
if (in_array(
$orderState,
array(
- Configuration::get('PS_OS_AWATING')
+ Configuration::get('PS_OS_AWAITING')
)
)) {
$objCart = new Cart($objOrder->id_cart);
diff --git a/modules/cheque/controllers/front/validation.php b/modules/cheque/controllers/front/validation.php
index b31e3451f..044a53183 100644
--- a/modules/cheque/controllers/front/validation.php
+++ b/modules/cheque/controllers/front/validation.php
@@ -77,7 +77,7 @@ class ChequeValidationModuleFrontController extends ModuleFrontController
'{cheque_address}' => Configuration::get('CHEQUE_ADDRESS'),
'{cheque_address_html}' => str_replace("\n", ' ', Configuration::get('CHEQUE_ADDRESS')));
- $this->module->validateOrder((int)$cart->id, Configuration::get('PS_OS_AWATING'), $total, $this->module->displayName, NULL, $mailVars, (int)$currency->id, false, $customer->secure_key);
+ $this->module->validateOrder((int)$cart->id, Configuration::get('PS_OS_AWAITING'), $total, $this->module->displayName, NULL, $mailVars, (int)$currency->id, false, $customer->secure_key);
Tools::redirect('index.php?controller=order-confirmation&id_cart='.(int)$cart->id.'&id_module='.(int)$this->module->id.'&id_order='.$this->module->currentOrder.'&key='.$customer->secure_key);
}
}
diff --git a/modules/qlopaypalcommerce/controllers/front/payment.php b/modules/qlopaypalcommerce/controllers/front/payment.php
index 4fa88eeb2..d06c1d06c 100644
--- a/modules/qlopaypalcommerce/controllers/front/payment.php
+++ b/modules/qlopaypalcommerce/controllers/front/payment.php
@@ -138,7 +138,7 @@ class QloPaypalCommercePaymentModuleFrontController extends ModuleFrontControlle
$orderStatus = Configuration::get('PS_OS_PAYMENT');
}
} else {
- $orderStatus = Configuration::get('PS_OS_AWATING');
+ $orderStatus = Configuration::get('PS_OS_AWAITING');
}
// create order for the payment
From 9defea68e2e4582e249d0a8efc5603e7f6144e47 Mon Sep 17 00:00:00 2001
From: Shreesh Arora
Date: Wed, 7 Dec 2022 15:38:43 +0530
Subject: [PATCH 13/60] updated mail file name
---
mails/en/{awating.html => awaiting.html} | 0
mails/en/{awating.txt => awaiting.txt} | 0
2 files changed, 0 insertions(+), 0 deletions(-)
rename mails/en/{awating.html => awaiting.html} (100%)
rename mails/en/{awating.txt => awaiting.txt} (100%)
diff --git a/mails/en/awating.html b/mails/en/awaiting.html
similarity index 100%
rename from mails/en/awating.html
rename to mails/en/awaiting.html
diff --git a/mails/en/awating.txt b/mails/en/awaiting.txt
similarity index 100%
rename from mails/en/awating.txt
rename to mails/en/awaiting.txt
From 9d36f46487553a940bc2092c79993229d88d945f Mon Sep 17 00:00:00 2001
From: Shreesh Arora
Date: Wed, 7 Dec 2022 15:59:45 +0530
Subject: [PATCH 14/60] updated remote payment configuration
---
install/data/xml/order_state.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/install/data/xml/order_state.xml b/install/data/xml/order_state.xml
index cbc8a1978..dfb33ad16 100644
--- a/install/data/xml/order_state.xml
+++ b/install/data/xml/order_state.xml
@@ -32,7 +32,7 @@
-
+
From 0e5b3b8dba0f148f13c449b076d696c3b511272b Mon Sep 17 00:00:00 2001
From: Abhishek Kumar
Date: Tue, 13 Dec 2022 12:02:32 +0530
Subject: [PATCH 15/60] Change tab labels
---
modules/dashguestcycle/dashguestcycle.php | 10 +++++-----
.../views/templates/hook/dashboard-zone-two.tpl | 10 +++++-----
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/modules/dashguestcycle/dashguestcycle.php b/modules/dashguestcycle/dashguestcycle.php
index 92724393f..7539d96b4 100644
--- a/modules/dashguestcycle/dashguestcycle.php
+++ b/modules/dashguestcycle/dashguestcycle.php
@@ -103,19 +103,19 @@ class DashGuestCycle extends Module
// set tables data
$tableCurrentArrivals = $this->getTableArrivalsByDate($dateToday, $params['id_hotel']);
- $dataValue['dgc_count_upcoming_arrivals'] = sprintf('%02d', count($tableCurrentArrivals['body']));
+ $dataValue['dgc_count_upcoming_arrivals'] = count($tableCurrentArrivals['body']);
$tableCurrentDepartures = $this->getTableDeparturesByDate($dateToday, $params['id_hotel']);
- $dataValue['dgc_count_upcoming_departures'] = sprintf('%02d', count($tableCurrentDepartures['body']));
+ $dataValue['dgc_count_upcoming_departures'] = count($tableCurrentDepartures['body']);
$tableCurrentInHouse = $this->getTableInHouseByDate($dateToday, $params['id_hotel']);
- $dataValue['dgc_count_current_in_house'] = sprintf('%02d', count($tableCurrentInHouse['body']));
+ $dataValue['dgc_count_current_in_house'] = count($tableCurrentInHouse['body']);
$tableNewBookings = $this->getTableNewBookingsByDate($dateToday, $params['id_hotel']);
- $dataValue['dgc_count_new_bookings'] = sprintf('%02d', count($tableNewBookings['body']));
+ $dataValue['dgc_count_new_bookings'] = count($tableNewBookings['body']);
$tableCancellations = $this->getTableCancellationsByDate($dateToday, $params['id_hotel']);
- $dataValue['dgc_count_cancellations'] = sprintf('%02d', count($tableCancellations['body']));
+ $dataValue['dgc_count_cancellations'] = count($tableCancellations['body']);
$dataTable = array(
'dgc_table_current_arrivals' => $tableCurrentArrivals,
diff --git a/modules/dashguestcycle/views/templates/hook/dashboard-zone-two.tpl b/modules/dashguestcycle/views/templates/hook/dashboard-zone-two.tpl
index 221b28dd4..18185c442 100644
--- a/modules/dashguestcycle/views/templates/hook/dashboard-zone-two.tpl
+++ b/modules/dashguestcycle/views/templates/hook/dashboard-zone-two.tpl
@@ -34,31 +34,31 @@
{l s='Arrivals' mod='dashguestcycle'}
- --
+ 0
{l s='Departures' mod='dashguestcycle'}
- --
+ 0
{l s='In-house' mod='dashguestcycle'}
- --
+ 0
{l s='Bookings' mod='dashguestcycle'}
- --
+ 0
{l s='Cancellations' mod='dashguestcycle'}
- --
+ 0
From 366950d2d7c06ecbde76c69b921baa8f3beb562a Mon Sep 17 00:00:00 2001
From: shreesh arora
Date: Fri, 11 Mar 2022 17:19:37 +0530
Subject: [PATCH 16/60] Added feature occupancy wise search
---
.../sass/vendor/bootstrap-sass/_buttons.scss | 10 +-
.../orders/_current_cart_details_data.tpl | 67 +-
.../controllers/orders/_new_product.tpl | 90 +-
.../controllers/orders/_product_line.tpl | 85 +-
.../template/controllers/orders/form.tpl | 260 +-
.../controllers/orders/helpers/view/view.tpl | 16 +
.../controllers/products/occupancy.tpl | 48 +-
classes/Cart.php | 30 +-
classes/Cookie.php | 2 +-
classes/PaymentModule.php | 18 +-
classes/Product.php | 6 +-
classes/controller/FrontController.php | 14 +
classes/order/Order.php | 6 +
classes/pdf/HTMLTemplateInvoice.php | 7 +-
controllers/admin/AdminCartsController.php | 70 +
controllers/admin/AdminOrdersController.php | 343 ++-
.../admin/AdminPPreferencesController.php | 71 +-
controllers/admin/AdminProductsController.php | 37 +-
controllers/admin/AdminStatsController.php | 2 +-
controllers/front/CartController.php | 241 +-
controllers/front/CategoryController.php | 41 +-
.../front/OrderConfirmationController.php | 8 +
controllers/front/OrderDetailController.php | 8 +-
controllers/front/ProductController.php | 102 +-
install/data/db_structure.sql | 2 +-
js/admin/orders.js | 310 +-
js/daterangepicker/LICENSE.txt | 21 +
js/daterangepicker/jquery.daterangepicker.css | 460 +++
js/daterangepicker/jquery.daterangepicker.js | 2638 +++++++++++++++++
.../jquery.daterangepicker.min.css | 1 +
.../jquery.daterangepicker.min.js | 7 +
js/daterangepicker/moment.min.js | 2 +
js/daterangepicker/qlodaterangepicker.js | 43 +
js/validate.js | 2 -
modules/blockcart/ajax-cart.js | 203 +-
modules/blockcart/blockcart.php | 48 +-
modules/blockcart/blockcart.tpl | 13 +-
.../checkroomavailabilityajaxprocess.php | 24 +-
.../classes/HotelBookingDemands.php | 4 +-
.../classes/HotelBookingDetail.php | 1553 +++++++---
.../classes/HotelCartBookingData.php | 184 +-
.../classes/HotelHelper.php | 42 +
.../classes/HotelOrderRestrictDate.php | 15 +-
.../classes/HotelReservationSystemDb.php | 11 +-
.../classes/HotelRoomType.php | 60 +-
.../classes/HotelRoomTypeFeaturePricing.php | 54 +-
.../admin/AdminAddHotelController.php | 1 +
.../admin/AdminHotelFeaturePricesSettings.php | 2 +
.../AdminHotelGeneralSettingsController.php | 32 +
.../AdminHotelRoomsBookingController.php | 90 +-
.../views/js/HotelReservationAdmin.js | 467 ++-
.../hotel_rooms_booking/helpers/view/view.tpl | 244 +-
.../statsbestproducts/statsbestproducts.php | 2 +-
modules/statscheckup/statscheckup.php | 2 +-
modules/statsproduct/statsproduct.php | 2 +-
.../wkhotelfilterblock/wkhotelfilterblock.php | 27 +-
.../classes/WkRoomSearchHelper.php | 128 +-
.../views/css/wk-category-search.css | 91 +-
.../views/css/wk-global-search.css | 207 +-
.../views/css/wk-landing-page-search.css | 30 +-
.../views/css/wk-roomtype-search.css | 77 +-
.../views/js/wk-room-search-block.js | 461 ++-
.../templates/hook/categoryPageSearch.tpl | 55 +-
.../templates/hook/landingPageSearch.tpl | 100 +-
.../templates/hook/roomTypePageSearch.tpl | 64 +-
.../views/templates/hook/searchForm.tpl | 200 ++
.../wkroomsearchblock/wkroomsearchblock.php | 49 +-
pdf/invoice.product-tab.tpl | 9 +-
.../_partials/booking-form.tpl | 104 +-
.../_partials/cart_booking_demands.tpl | 3 +-
.../_partials/occupancy_field.tpl | 155 +
.../_partials/order_booking_demands.tpl | 3 +-
.../_partials/quantity_field.tpl | 16 +
.../_partials/room_type_list.tpl | 145 +-
.../hotel-reservation-theme/css/category.css | 90 +-
.../css/daterangepicker.css | 85 +
themes/hotel-reservation-theme/css/global.css | 121 +-
.../hotel-reservation-theme/css/product.css | 64 +-
themes/hotel-reservation-theme/global.tpl | 23 +
.../img/icon/icon-dropdown-arrow.svg | 20 +
.../img/icon/icon-hotel.svg | 25 +
.../img/icon/icon-users.svg | 25 +
.../js/autoload/15-jquery.uniform-modified.js | 2 +-
themes/hotel-reservation-theme/js/category.js | 81 -
themes/hotel-reservation-theme/js/global.js | 322 +-
.../js/modules/blockcart/ajax-cart.js | 203 +-
themes/hotel-reservation-theme/js/product.js | 234 +-
.../modules/blockcart/blockcart.tpl | 11 +-
.../order-confirmation.tpl | 2 +-
.../hotel-reservation-theme/order-detail.tpl | 12 +-
.../hotel-reservation-theme/shopping-cart.tpl | 12 +-
91 files changed, 9230 insertions(+), 2147 deletions(-)
create mode 100644 js/daterangepicker/LICENSE.txt
create mode 100644 js/daterangepicker/jquery.daterangepicker.css
create mode 100755 js/daterangepicker/jquery.daterangepicker.js
create mode 100644 js/daterangepicker/jquery.daterangepicker.min.css
create mode 100755 js/daterangepicker/jquery.daterangepicker.min.js
create mode 100644 js/daterangepicker/moment.min.js
create mode 100644 js/daterangepicker/qlodaterangepicker.js
create mode 100644 modules/wkroomsearchblock/views/templates/hook/searchForm.tpl
create mode 100644 themes/hotel-reservation-theme/_partials/occupancy_field.tpl
create mode 100644 themes/hotel-reservation-theme/_partials/quantity_field.tpl
create mode 100644 themes/hotel-reservation-theme/css/daterangepicker.css
create mode 100644 themes/hotel-reservation-theme/img/icon/icon-dropdown-arrow.svg
create mode 100644 themes/hotel-reservation-theme/img/icon/icon-hotel.svg
create mode 100644 themes/hotel-reservation-theme/img/icon/icon-users.svg
diff --git a/admin/themes/default/sass/vendor/bootstrap-sass/_buttons.scss b/admin/themes/default/sass/vendor/bootstrap-sass/_buttons.scss
index 271ae468f..75c8d0700 100644
--- a/admin/themes/default/sass/vendor/bootstrap-sass/_buttons.scss
+++ b/admin/themes/default/sass/vendor/bootstrap-sass/_buttons.scss
@@ -50,6 +50,14 @@
}
}
+// buttons text align
+.btn-left {
+ text-align: left;
+}
+.btn-right {
+ text-align: right;
+}
+
// Alternate buttons
// --------------------------------------------------
@@ -140,8 +148,6 @@
.btn-block {
display: block;
width: 100%;
- padding-left: 0;
- padding-right: 0;
}
// Vertically space out multiple block buttons
diff --git a/admin/themes/default/template/controllers/orders/_current_cart_details_data.tpl b/admin/themes/default/template/controllers/orders/_current_cart_details_data.tpl
index c26576861..d3d517b2f 100644
--- a/admin/themes/default/template/controllers/orders/_current_cart_details_data.tpl
+++ b/admin/themes/default/template/controllers/orders/_current_cart_details_data.tpl
@@ -23,7 +23,7 @@
{l s='Cart Details'}
-
+
@@ -31,6 +31,9 @@
| {l s='Room Image'} |
{l s='Room Type'} |
{l s='Duration'} |
+ {if $occupancy_wise_booking}
+ {l s='Occupancy'} |
+ {/if}
{l s='Unit Price (tax excl)'} |
{l s='Additinal Facilities (tax excl)'} |
{l s='Total Rooms Price (tax excl)'} |
@@ -42,7 +45,7 @@
{if isset($cart_detail_data) && $cart_detail_data}
{assign var=curr_id value=$cart->id_currency|intval}
{foreach from=$cart_detail_data item=data}
-
+
| {$data.room_num|escape:'html':'UTF-8'} |
 |
@@ -58,13 +61,71 @@
{/if}
|
{dateFormat date=$data.date_from} - {dateFormat date=$data.date_to} |
+ {if $occupancy_wise_booking}
+
+
+
+
+
+ |
+ {/if}
{if $data.feature_price_diff != 0}
{assign var=shown_room_type_price value=$data.feature_price_tax_excl}
{else}
{assign var=shown_room_type_price value=$data.product_price_tax_excl}
{/if}
-
+
|
{if isset($data.extra_demands) && $data.extra_demands}
diff --git a/admin/themes/default/template/controllers/orders/_new_product.tpl b/admin/themes/default/template/controllers/orders/_new_product.tpl
index e67cc63ff..5aa06c218 100644
--- a/admin/themes/default/template/controllers/orders/_new_product.tpl
+++ b/admin/themes/default/template/controllers/orders/_new_product.tpl
@@ -64,7 +64,7 @@
|
-
+ |
|
-
-
-
-
+
+ |
+ {if $order->is_occupnacy_provided}
+
+
+
+
+
+
+
+ {else}
+
+
+
+ {/if}
+
|
+ {*
+
+ | *}
{*{if ($order->hasBeenPaid())} | {/if}
{if $display_warehouse} | {/if}
{if ($order->hasBeenDelivered())} | {/if}
0 | *}
{displayPrice price=0 currency=$currency->id} |
-
+ |
{if sizeof($invoices_collection)}
|
+
+ {if $order->is_occupnacy_provided && $data['children']}
+
+
+
+
+ {else}
+ {if $data['adult']}{$data['adult']}{/if} {if $data['adult'] > 1}{l s='Adults'}{else}{l s='Adult'}{/if}{if {$data['children']}}, {$data['children']} {if $data['children'] > 1}{l s='Children'}{else}{l s='Child'}{/if}{/if}
+ {/if}
+ {if $order->is_occupnacy_provided}
+
+
+
+
+
+
+ {else}
+ {if $data['adult']}{$data['adult']}{/if} {if $data['adult'] > 1}{l s='Adults'}{else}{l s='Adult'}{/if}{if {$data['children']}}, {$data['children']} {if $data['children'] > 1}{l s='Children'}{else}{l s='Child'}{/if}{/if}
+ {/if}
|
diff --git a/admin/themes/default/template/controllers/orders/form.tpl b/admin/themes/default/template/controllers/orders/form.tpl
index 1d80ec936..209f9495a 100644
--- a/admin/themes/default/template/controllers/orders/form.tpl
+++ b/admin/themes/default/template/controllers/orders/form.tpl
@@ -241,12 +241,13 @@
e.preventDefault();
var cart_row = $(this).closest('tr');
var params = {
- id_booking_data: parseInt($(this).attr('data-id-booking-data')),
- id_product: parseInt($(this).attr('data-id-product')),
- id_room: parseInt($(this).attr('data-id-room')),
- date_from: $(this).attr('data-date-from'),
- date_to: $(this).attr('data-date-to'),
+ id_booking_data: parseInt($(cart_row).attr('data-id-booking-data')),
+ id_product: parseInt($(cart_row).attr('data-id-product')),
+ id_room: parseInt($(cart_row).attr('data-id-room')),
+ date_from: $(cart_row).attr('data-date-from'),
+ date_to: $(cart_row).attr('data-date-to'),
price: $(this).val(),
+ id_cart: id_cart
};
updateProductPrice(params, cart_row);
})
@@ -272,6 +273,8 @@
}
});
});
+
+ initOccupancyField();
resetBind();
$('#customer').focus();
@@ -334,6 +337,213 @@
});
});
+ {literal}
+ function initOccupancyField()
+ {
+ $(document).on('click', '.booking_occupancy_wrapper .remove-room-link', function(e) {
+ e.preventDefault();
+
+ booking_occupancy_inner = $(this).closest('.booking_occupancy_inner');
+ $(this).closest('.occupancy_info_block').remove();
+ $(booking_occupancy_inner).find('.room_num_wrapper').each(function(key, val) {
+ $(this).text(room_txt + ' - '+ (key+1) );
+ });
+ setRoomTypeGuestOccupancy($(booking_occupancy_inner).closest('.booking_occupancy_wrapper'));
+ });
+
+ $(document).on('change', '.num_occupancy', function(e) {
+ let current_room_occupancy = 0;
+ $(this).closest('.occupancy_info_block').find('.num_occupancy').each(function(){
+ current_room_occupancy += parseInt($(this).val());
+ });
+ let max_guests_in_room = $(this).closest(".booking_occupancy_wrapper").find('.max_guests').val();
+ let max_allowed_for_current = (max_guests_in_room - current_room_occupancy) + parseInt($(this).val());
+ if ($(this).val() > $(this).attr('max')) {
+ $(this).val($(this).attr('max'));
+ }
+ if ($(this).val() > max_allowed_for_current) {
+ $(this).val(max_allowed_for_current);
+ }
+ if ($(this).hasClass('num_children')) {
+ var totalChilds = $(this).closest('.occupancy_info_block').find('.guest_child_age').length;
+ if (totalChilds < $(this).val()) {
+ if (totalChilds < max_child_in_room) {
+ $(this).closest('.occupancy_info_block').find('.children_age_info_block').show();
+ while ($(this).closest('.occupancy_info_block').find('.guest_child_age').length < $(this).val()) {
+
+
+ var roomBlockIndex = parseInt($(this).closest('.occupancy_info_block').attr('occ_block_index'));
+
+ var childAgeSelect = ' ';
+ childAgeSelect += '';
+ childAgeSelect += ' ';
+ $(this).closest('.occupancy_info_block').find('.children_ages').append(childAgeSelect);
+ }
+ }
+ } else {
+ let child = $(this).val();
+ $(this).closest('.occupancy_info_block').find('.guest_child_age').each(function(ind, element) {
+ if (child <= ind) {
+ $(element).parent().remove();
+ }
+ });
+ if (child == 0) {
+ $(this).closest('.occupancy_info_block').find('.children_age_info_block').hide();
+ }
+
+ }
+ }
+ setRoomTypeGuestOccupancy($(this).closest('.booking_occupancy_wrapper'));
+
+ });
+
+
+ $(document).on('click', '.booking_guest_occupancy', function(e) {
+ $(this).parent().toggleClass('open');
+ });
+
+ $(document).on('click', function(e) {
+ if ($('.booking_occupancy_wrapper:visible').length) {
+ var occupancy_wrapper = $('.booking_occupancy_wrapper:visible');
+ $(occupancy_wrapper).find(".occupancy_info_block").addClass('selected');
+ if (!($(e.target).closest(".booking_occupancy_wrapper").length || $(e.target).closest(".booking_guest_occupancy").length || $(e.target).closest(".ajax_add_to_cart_button").length || $(e.target).closest(".exclusive.book_now_submit").length)) {
+ let hasErrors = 0;
+
+ let adult = $(occupancy_wrapper).find(".num_adults").map(function(){return $(this).val();}).get();
+ let children = $(occupancy_wrapper).find(".num_children").map(function(){return $(this).val();}).get();
+ let child_ages = $(occupancy_wrapper).find(".guest_child_age").map(function(){return $(this).val();}).get();
+
+ // start validating above values
+ if (!adult.length || (adult.length != children.length)) {
+ hasErrors = 1;
+ showErrorMessage(invalid_occupancy_txt);
+ } else {
+ $(occupancy_wrapper).find('.occupancy_count').removeClass('error_border');
+
+ // validate values of adult and children
+ adult.forEach(function (item, index) {
+ if (isNaN(item) || parseInt(item) < 1) {
+ hasErrors = 1;
+ $(occupancy_wrapper).find(".num_adults").eq(index).closest('.occupancy_count_block').find('.occupancy_count').addClass('error_border');
+ }
+ if (isNaN(children[index])) {
+ hasErrors = 1;
+ $(occupancy_wrapper).find(".num_children").eq(index).closest('.occupancy_count_block').find('.occupancy_count').addClass('error_border');
+ }
+ });
+
+ // validate values of selected child ages
+ $(occupancy_wrapper).find('.guest_child_age').parent().removeClass('has-error');
+ child_ages.forEach(function (age, index) {
+ age = parseInt(age);
+ if (isNaN(age) || (age < 0) || (age >= parseInt(max_child_age))) {
+ hasErrors = 1;
+ $(occupancy_wrapper).find(".guest_child_age").eq(index).parent().addClass('has-error');
+ }
+ });
+ }
+ if (hasErrors == 0) {
+ $(occupancy_wrapper).parent().removeClass('open');
+ $(document).trigger( "QloApps:updateRoomOccupancy", [occupancy_wrapper]);
+ }
+ }
+ }
+ });
+
+ $(document).on('QloApps:updateRoomOccupancy', function (e, occupancy_wrapper) {
+ e.preventDefault();
+ let cart_row = $(occupancy_wrapper).closest('tr');
+ let occupancy = getBookingOccupancyDetails(cart_row);
+ let params = {
+ id_cart: id_cart,
+ id_booking_data: parseInt($(cart_row).attr('data-id-booking-data')),
+ occupancy : occupancy.shift(),
+ };
+ updateProductOccupancy(params, cart_row);
+ });
+ }
+ function getBookingOccupancyDetails(bookingform)
+ {
+ let occupancy;
+ let selected_occupancy = $(bookingform).find(".occupancy_info_block.selected")
+ if (selected_occupancy.length) {
+ occupancy = [];
+ $(selected_occupancy).each(function(ind, element) {
+ if (parseInt($(element).find('.num_adults').val())) {
+ let child_ages = [];
+ $(element).find('.guest_child_age').each(function(index) {
+ if ($(this).val() > -1) {
+ child_ages.push($(this).val());
+ }
+ });
+ if ($(element).find('.num_children').val()) {
+ if (child_ages.length != $(element).find('.num_children').val()) {
+ $(bookingform).find('.booking_occupancy_wrapper').parent().addClass('open');
+ occupancy = false;
+ return false;
+ }
+ }
+ occupancy.push({
+ 'adult': $(element).find('.num_adults').val(),
+ 'children': $(element).find('.num_children').val(),
+ 'child_ages': child_ages
+ });
+ } else {
+ $(bookingform).find('.booking_occupancy_wrapper').parent().addClass('open');
+ occupancy = false;
+ return false;
+ }
+ });
+ } else {
+ $(bookingform).find('.booking_occupancy_wrapper').parent().addClass('open');
+ occupancy = false;
+ }
+
+ return occupancy;
+ }
+ {/literal}
+
+ function setRoomTypeGuestOccupancy(booking_occupancy_wrapper)
+ {
+ var adult = 0;
+ var children = 0;
+ var rooms = $(booking_occupancy_wrapper).find('.occupancy_info_block').length;
+
+ $(booking_occupancy_wrapper).find(".num_adults" ).each(function(key, val) {
+ adult += parseInt($(this).val());
+ });
+ $(booking_occupancy_wrapper).find(".num_children" ).each(function(key, val) {
+ children += parseInt($(this).val());
+ });
+
+ var guestButtonVal = parseInt(adult) + ' ';
+ if (parseInt(adult) > 1) {
+ guestButtonVal += adults_txt;
+ } else {
+ guestButtonVal += adult_txt;
+ }
+ if (parseInt(children) > 0) {
+ if (parseInt(children) > 1) {
+ guestButtonVal += ', ' + parseInt(children) + ' ' + children_txt;
+ } else {
+ guestButtonVal += ', ' + parseInt(children) + ' ' + child_txt;
+ }
+ }
+ // if (parseInt(rooms) > 1) {
+ // guestButtonVal += ', ' + parseInt(rooms) + ' ' + rooms_txt;
+ // } else {
+ // guestButtonVal += ', ' + parseInt(rooms) + ' ' + room_txt;
+ // }
+ // console.log($(booking_occupancy_wrapper).siblings('.booking_guest_occupancy > span'));
+ $(booking_occupancy_wrapper).siblings('.booking_guest_occupancy').find('span').text(guestButtonVal);
+ }
+
function resetBind()
{
$('.fancybox').fancybox({
@@ -391,7 +601,6 @@
function updateProductPrice(params, cart_row) {
$.extend(params, {
- id_cart: id_cart,
price: new Number(params.price.replace(",",".")).toFixed(4).toString(),
});
@@ -414,6 +623,28 @@
});
}
+ function updateProductOccupancy(params, cart_row)
+ {
+ $.ajax({
+ type:"POST",
+ url: "{$link->getAdminLink('AdminCarts')|addslashes}",
+ async: true,
+ dataType: "JSON",
+ data: {
+ ajax: "1",
+ token: "{getAdminToken tab='AdminCarts'}",
+ tab: "AdminCarts",
+ action: "updateProductOccupancy",
+ params: params,
+ },
+ success : function(response) {
+ updateCartLine(response.curr_booking_info, cart_row);
+ updateCartSummaryData(response.cart_info);
+ }
+ });
+ }
+
+
function updateCartLine(data, cart_row) {
$(cart_row).find('.cart_line_total_rooms_price').html(data.amt_with_qty);
$(cart_row).find('.cart_line_total_price').html(data.total_price);
@@ -1687,6 +1918,23 @@
+{strip}
+ {addJsDef max_child_age=$max_child_age}
+ {addJsDef max_child_in_room=$max_child_in_room}
+ {addJsDefL name='select_age_txt'}{l s='Select age' js=1}{/addJsDefL}
+ {addJsDefL name='under_1_age'}{l s='Under 1' js=1}{/addJsDefL}
+ {addJsDefL name='room_txt'}{l s='Room' js=1}{/addJsDefL}
+ {addJsDefL name='rooms_txt'}{l s='Rooms' js=1}{/addJsDefL}
+ {addJsDefL name='remove_txt'}{l s='Remove' js=1}{/addJsDefL}
+ {addJsDefL name='adult_txt'}{l s='Adult' js=1}{/addJsDefL}
+ {addJsDefL name='adults_txt'}{l s='Adults' js=1}{/addJsDefL}
+ {addJsDefL name='child_txt'}{l s='Child' js=1}{/addJsDefL}
+ {addJsDefL name='children_txt'}{l s='Children' js=1}{/addJsDefL}
+ {addJsDefL name='below_txt'}{l s='Below' js=1}{/addJsDefL}
+ {addJsDefL name='years_txt'}{l s='years' js=1}{/addJsDefL}
+ {addJsDefL name='all_children_txt'}{l s='years' js=1}{/addJsDefL}
+ {addJsDefL name='invalid_occupancy_txt'}{l s='Invalid occupancy(adults/children) found.' js=1}{/addJsDefL}
+{/strip}
diff --git a/admin/themes/default/template/controllers/orders/helpers/view/view.tpl b/admin/themes/default/template/controllers/orders/helpers/view/view.tpl
index ea80d46a9..b03f3d1af 100644
--- a/admin/themes/default/template/controllers/orders/helpers/view/view.tpl
+++ b/admin/themes/default/template/controllers/orders/helpers/view/view.tpl
@@ -981,6 +981,7 @@
{l s='Room Type'} |
{l s='Hotel Name'} |
{l s='Duration'} |
+ {l s='Occupancy'} |
{l s='Unit Price (Tax excl.)'} |
{l s='Total Price (Tax incl.)'} |
{if isset($refundReqBookings) && $refundReqBookings}
@@ -1412,6 +1413,21 @@
{addJsDefL name=txtSomeErr}{l s='Some error occurred. Please try again.' js=1}{/addJsDefL}
{addJsDefL name=txtDeleteSucc}{l s='Deleted successfully' js=1}{/addJsDefL}
{addJsDefL name=txtInvalidDemandVal}{l s='Invalid demand value found' js=1}{/addJsDefL}
+ {addJsDefL name='select_age_txt'}{l s='Select age' js=1}{/addJsDefL}
+ {addJsDefL name='under_1_age'}{l s='Under 1' js=1}{/addJsDefL}
+ {addJsDefL name='room_txt'}{l s='Room' js=1}{/addJsDefL}
+ {addJsDefL name='rooms_txt'}{l s='Rooms' js=1}{/addJsDefL}
+ {addJsDefL name='remove_txt'}{l s='Remove' js=1}{/addJsDefL}
+ {addJsDefL name='adult_txt'}{l s='Adult' js=1}{/addJsDefL}
+ {addJsDefL name='adults_txt'}{l s='Adults' js=1}{/addJsDefL}
+ {addJsDefL name='child_txt'}{l s='Child' js=1}{/addJsDefL}
+ {addJsDefL name='children_txt'}{l s='Children' js=1}{/addJsDefL}
+ {addJsDefL name='below_txt'}{l s='Below' js=1}{/addJsDefL}
+ {addJsDefL name='years_txt'}{l s='years' js=1}{/addJsDefL}
+ {addJsDefL name='all_children_txt'}{l s='years' js=1}{/addJsDefL}
+ {addJsDefL name='invalid_occupancy_txt'}{l s='Invalid occupancy(adults/children) found.' js=1}{/addJsDefL}
+ {addJsDef max_child_age=$max_child_age|escape:'quotes':'UTF-8'}
+ {addJsDef max_child_in_room=$max_child_in_room|escape:'quotes':'UTF-8'}
{/strip}
{* Apply javascript for the page *}
diff --git a/admin/themes/default/template/controllers/products/occupancy.tpl b/admin/themes/default/template/controllers/products/occupancy.tpl
index c38cd0b92..15b7b3527 100644
--- a/admin/themes/default/template/controllers/products/occupancy.tpl
+++ b/admin/themes/default/template/controllers/products/occupancy.tpl
@@ -24,16 +24,14 @@
{l s='Occupancy'}
- {l s='Set the occupancy of this room type. Enter how much adults and children this room type can accomodate.'}
-
- {l s='Note'} : {l s='These occupancy settings will not affect "ROOM TYPE ADDITIONAL FACILITIES" any way. It will work separately.'}
+ {l s='Below, enter the base occupancy of this room type.'}
| ")}return l.join("")}(e)),f[t]=e,w(),m.find(".day").off("click").on("click",function(e){k(U(this))}),m.find(".day").off("mouseenter").on("mouseenter",function(e){y(U(this))}),m.find(".day").off("mouseleave").on("mouseleave",function(e){m.find(".date-range-length-tip").hide(),f.singleDate&&b()}),m.find(".week-number").off("click").on("click",function(e){var t,a,n,r;t=U(this),r=parseInt(t.attr("data-start-time"),10),f.startWeek?(m.find(".week-number-selected").removeClass("week-number-selected"),a=new Date(re.maxSelectable});return n}function P(e,t){for(var a,n='"+a+" "}function Y(e,t){m.find("."+t).append(""+K("Time")+': 00:00 '),u(t,e)}function A(e){return K("month-name")[e]}function W(e){return Q(e).format(f.format)}function I(){C();var e=parseInt(Q(f.month1).format("YYYYMM")),t=parseInt(Q(f.month2).format("YYYYMM")),a=Math.abs(e-t);1"+K("week-number")+"":"";return"monday"==f.startOfWeek?e+""+K("week-1")+" | "+K("week-2")+" | "+K("week-3")+" | "+K("week-4")+" | "+K("week-5")+" | "+K("week-6")+" | "+K("week-7")+" | ":e+""+K("week-7")+" | "+K("week-1")+" | "+K("week-2")+" | "+K("week-3")+" | "+K("week-4")+" | "+K("week-5")+" | "+K("week-6")+" | "}function q(e){return e=Q(e),!(!f.startDate||!e.endOf("month").isBefore(f.startDate))||!(!f.endDate||!e.startOf("month").isAfter(f.endDate))}function $(e,t,r){var s=U.extend(!0,{},e);U.each(t,function(e,t){var a=t(r);for(var n in a)s.hasOwnProperty(n)?s[n]+=a[n]:s[n]=a[n]});var a="";for(var n in s)s.hasOwnProperty(n)&&(a+=n+'="'+s[n]+'" ');return a}function J(e,t){return f.showDateFilter&&"function"==typeof f.showDateFilter?f.showDateFilter(e,t):t}function K(e){var t=e.toLowerCase(),a=e in r?r[e]:t in r?r[t]:null,n=U.dateRangePickerLanguages.default;return null==a&&(a=e in n?n[e]:t in n?n[t]:""),a}function _(){var e=f.defaultTime?f.defaultTime:new Date;return f.lookBehind?(f.startDate&&L(e,f.startDate)<0&&(e=F(Q(f.startDate).toDate())),f.endDate&&0>>0,s=0;sAe(e)?(r=e+1,t-Ae(e)):(r=e,t);return{year:r,dayOfYear:n}}function qe(e,t,n){var s,i,r=ze(e.year(),t,n),r=Math.floor((e.dayOfYear()-r-1)/7)+1;return r<1?s=r+P(i=e.year()-1,t,n):r>P(e.year(),t,n)?(s=r-P(e.year(),t,n),i=e.year()+1):(i=e.year(),s=r),{week:s,year:i}}function P(e,t,n){var s=ze(e,t,n),t=ze(e+1,t,n);return(Ae(e)-s+t)/7}s("w",["ww",2],"wo","week"),s("W",["WW",2],"Wo","isoWeek"),t("week","w"),t("isoWeek","W"),n("week",5),n("isoWeek",5),v("w",p),v("ww",p,w),v("W",p),v("WW",p,w),Te(["w","ww","W","WW"],function(e,t,n,s){t[s.substr(0,1)]=g(e)});function Be(e,t){return e.slice(t,7).concat(e.slice(0,t))}s("d",0,"do","day"),s("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)}),s("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)}),s("dddd",0,0,function(e){return this.localeData().weekdays(this,e)}),s("e",0,0,"weekday"),s("E",0,0,"isoWeekday"),t("day","d"),t("weekday","e"),t("isoWeekday","E"),n("day",11),n("weekday",11),n("isoWeekday",11),v("d",p),v("e",p),v("E",p),v("dd",function(e,t){return t.weekdaysMinRegex(e)}),v("ddd",function(e,t){return t.weekdaysShortRegex(e)}),v("dddd",function(e,t){return t.weekdaysRegex(e)}),Te(["dd","ddd","dddd"],function(e,t,n,s){s=n._locale.weekdaysParse(e,s,n._strict);null!=s?t.d=s:m(n).invalidWeekday=e}),Te(["d","e","E"],function(e,t,n,s){t[s]=g(e)});var Je="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Qe="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),Xe="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),Ke=k,et=k,tt=k;function nt(){function e(e,t){return t.length-e.length}for(var t,n,s,i=[],r=[],a=[],o=[],u=0;u<7;u++)s=l([2e3,1]).day(u),t=M(this.weekdaysMin(s,"")),n=M(this.weekdaysShort(s,"")),s=M(this.weekdays(s,"")),i.push(t),r.push(n),a.push(s),o.push(t),o.push(n),o.push(s);i.sort(e),r.sort(e),a.sort(e),o.sort(e),this._weekdaysRegex=new RegExp("^("+o.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+a.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+r.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+i.join("|")+")","i")}function st(){return this.hours()%12||12}function it(e,t){s(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}function rt(e,t){return t._meridiemParse}s("H",["HH",2],0,"hour"),s("h",["hh",2],0,st),s("k",["kk",2],0,function(){return this.hours()||24}),s("hmm",0,0,function(){return""+st.apply(this)+r(this.minutes(),2)}),s("hmmss",0,0,function(){return""+st.apply(this)+r(this.minutes(),2)+r(this.seconds(),2)}),s("Hmm",0,0,function(){return""+this.hours()+r(this.minutes(),2)}),s("Hmmss",0,0,function(){return""+this.hours()+r(this.minutes(),2)+r(this.seconds(),2)}),it("a",!0),it("A",!1),t("hour","h"),n("hour",13),v("a",rt),v("A",rt),v("H",p),v("h",p),v("k",p),v("HH",p,w),v("hh",p,w),v("kk",p,w),v("hmm",ge),v("hmmss",we),v("Hmm",ge),v("Hmmss",we),D(["H","HH"],x),D(["k","kk"],function(e,t,n){e=g(e);t[x]=24===e?0:e}),D(["a","A"],function(e,t,n){n._isPm=n._locale.isPM(e),n._meridiem=e}),D(["h","hh"],function(e,t,n){t[x]=g(e),m(n).bigHour=!0}),D("hmm",function(e,t,n){var s=e.length-2;t[x]=g(e.substr(0,s)),t[T]=g(e.substr(s)),m(n).bigHour=!0}),D("hmmss",function(e,t,n){var s=e.length-4,i=e.length-2;t[x]=g(e.substr(0,s)),t[T]=g(e.substr(s,2)),t[N]=g(e.substr(i)),m(n).bigHour=!0}),D("Hmm",function(e,t,n){var s=e.length-2;t[x]=g(e.substr(0,s)),t[T]=g(e.substr(s))}),D("Hmmss",function(e,t,n){var s=e.length-4,i=e.length-2;t[x]=g(e.substr(0,s)),t[T]=g(e.substr(s,2)),t[N]=g(e.substr(i))});k=de("Hours",!0);var at,ot={calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},longDateFormat:{LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},invalidDate:"Invalid date",ordinal:"%d",dayOfMonthOrdinalParse:/\d{1,2}/,relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},months:Ce,monthsShort:Ue,week:{dow:0,doy:6},weekdays:Je,weekdaysMin:Xe,weekdaysShort:Qe,meridiemParse:/[ap]\.?m?\.?/i},R={},ut={};function lt(e){return e&&e.toLowerCase().replace("_","-")}function ht(e){for(var t,n,s,i,r=0;r=t&&function(e,t){for(var n=Math.min(e.length,t.length),s=0;s=t-1)break;t--}r++}return at}function dt(t){var e;if(void 0===R[t]&&"undefined"!=typeof module&&module&&module.exports&&null!=t.match("^[^/\\\\]*$"))try{e=at._abbr,require("./locale/"+t),ct(e)}catch(e){R[t]=null}return R[t]}function ct(e,t){return e&&((t=o(t)?mt(e):ft(e,t))?at=t:"undefined"!=typeof console&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),at._abbr}function ft(e,t){if(null===t)return delete R[e],null;var n,s=ot;if(t.abbr=e,null!=R[e])Q("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),s=R[e]._config;else if(null!=t.parentLocale)if(null!=R[t.parentLocale])s=R[t.parentLocale]._config;else{if(null==(n=dt(t.parentLocale)))return ut[t.parentLocale]||(ut[t.parentLocale]=[]),ut[t.parentLocale].push({name:e,config:t}),null;s=n._config}return R[e]=new K(X(s,t)),ut[e]&&ut[e].forEach(function(e){ft(e.name,e.config)}),ct(e),R[e]}function mt(e){var t;if(!(e=e&&e._locale&&e._locale._abbr?e._locale._abbr:e))return at;if(!a(e)){if(t=dt(e))return t;e=[e]}return ht(e)}function _t(e){var t=e._a;return t&&-2===m(e).overflow&&(t=t[O]<0||11We(t[Y],t[O])?b:t[x]<0||24P(r,u,l)?m(s)._overflowWeeks=!0:null!=h?m(s)._overflowWeekday=!0:(d=$e(r,a,o,u,l),s._a[Y]=d.year,s._dayOfYear=d.dayOfYear)),null!=e._dayOfYear&&(i=bt(e._a[Y],n[Y]),(e._dayOfYear>Ae(i)||0===e._dayOfYear)&&(m(e)._overflowDayOfYear=!0),h=Ze(i,0,e._dayOfYear),e._a[O]=h.getUTCMonth(),e._a[b]=h.getUTCDate()),t=0;t<3&&null==e._a[t];++t)e._a[t]=c[t]=n[t];for(;t<7;t++)e._a[t]=c[t]=null==e._a[t]?2===t?1:0:e._a[t];24===e._a[x]&&0===e._a[T]&&0===e._a[N]&&0===e._a[Ne]&&(e._nextDay=!0,e._a[x]=0),e._d=(e._useUTC?Ze:je).apply(null,c),r=e._useUTC?e._d.getUTCDay():e._d.getDay(),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[x]=24),e._w&&void 0!==e._w.d&&e._w.d!==r&&(m(e).weekdayMismatch=!0)}}function Tt(e){if(e._f===f.ISO_8601)St(e);else if(e._f===f.RFC_2822)Ot(e);else{e._a=[],m(e).empty=!0;for(var t,n,s,i,r,a=""+e._i,o=a.length,u=0,l=ae(e._f,e._locale).match(te)||[],h=l.length,d=0;de.valueOf():e.valueOf()"}),i.toJSON=function(){return this.isValid()?this.toISOString():null},i.toString=function(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},i.unix=function(){return Math.floor(this.valueOf()/1e3)},i.valueOf=function(){return this._d.valueOf()-6e4*(this._offset||0)},i.creationData=function(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}},i.eraName=function(){for(var e,t=this.localeData().eras(),n=0,s=t.length;nthis.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},i.isLocal=function(){return!!this.isValid()&&!this._isUTC},i.isUtcOffset=function(){return!!this.isValid()&&this._isUTC},i.isUtc=At,i.isUTC=At,i.zoneAbbr=function(){return this._isUTC?"UTC":""},i.zoneName=function(){return this._isUTC?"Coordinated Universal Time":""},i.dates=e("dates accessor is deprecated. Use date instead.",ke),i.months=e("months accessor is deprecated. Use month instead",Ge),i.years=e("years accessor is deprecated. Use year instead",Ie),i.zone=e("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",function(e,t){return null!=e?(this.utcOffset(e="string"!=typeof e?-e:e,t),this):-this.utcOffset()}),i.isDSTShifted=e("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",function(){if(!o(this._isDSTShifted))return this._isDSTShifted;var e,t={};return $(t,this),(t=Nt(t))._a?(e=(t._isUTC?l:W)(t._a),this._isDSTShifted=this.isValid()&&0',
+ customArrowNextSymbol: '',
+ getValue: function()
+ {
+ return $(this).find('span').html();
+ },
+ setValue: function(s, s1, s2) {
+ if (s) {
+ $(this).find('span').html(s.replace('to', ' '));
+ } else {
+ $(this).find('span').html(
+ RangePickerCheckin + ' ' + RangePickerCheckout
+ );
+ }
+ }
+ }
+ $.each(opt, function(index) {
+ delete custom_opt[index];
+ });
+
+ $.extend(true, opt, custom_opt);
+
+ }
+
+ var args = Array.prototype.slice.call(arguments,0);
+ return dateRangePickerOrg.apply(this, args);
+ }
+})(jQuery);
\ No newline at end of file
diff --git a/js/validate.js b/js/validate.js
index 85b041fbb..b8c011e0e 100644
--- a/js/validate.js
+++ b/js/validate.js
@@ -184,9 +184,7 @@ function validate_field(that)
var selector = '#id_country';
if ($(that).attr('name') == 'postcode_invoice')
selector += '_invoice';
-
var id_country = $(selector + ' option:selected').val();
-
if (typeof(countriesNeedZipCode[id_country]) != 'undefined' && typeof(countries[id_country]) != 'undefined')
var result = window['validate_'+$(that).attr('data-validate')]($(that).val(), countriesNeedZipCode[id_country], countries[id_country]['iso_code']);
}
diff --git a/modules/blockcart/ajax-cart.js b/modules/blockcart/ajax-cart.js
index d92610635..a355d77bc 100644
--- a/modules/blockcart/ajax-cart.js
+++ b/modules/blockcart/ajax-cart.js
@@ -134,26 +134,28 @@ var ajaxCart = {
var dateFrom = $(this).attr('cat_rm_check_in');
var dateTo = $(this).attr('cat_rm_check_out');
-
+ var occupancy = getBookingOccupancyDetails($(this).closest('.booking_room_fields'));
/* By Webkul
* Note : In our case minimalQuantity is taken from Qty. field
*/
// var minimalQuantity = parseInt($(this).data('minimal_quantity'));
- var minimalQuantity = parseInt($(this).data('minimal_quantity'));
- var minimalQuantity = $("#cat_quantity_wanted_" + idProduct).val();
- if (!minimalQuantity)
- minimalQuantity = 1;
- if ($(this).prop('disabled') != 'disabled')
- ajaxCart.add(idProduct, idProductAttribute, false, this, minimalQuantity, null, dateFrom, dateTo);
+ // var minimalQuantity = parseInt($(this).data('minimal_quantity'));
+ // var minimalQuantity = $("#quantity_wanted_" + idProduct).val();
+ // if (!minimalQuantity)
+ // minimalQuantity = 1;
+ if ($(this).prop('disabled') != 'disabled' && occupancy)
+ ajaxCart.add(idProduct, idProductAttribute, false, this, occupancy, null, dateFrom, dateTo);
});
//for product page 'add' button...
if ($('.cart_block').length) {
- $(document).off('click', '#add_to_cart button').on('click', '#add_to_cart button', function(e) {
+ $(document).off('click', '#add_to_cartadd_to_cart button').on('click', '#add_to_cart button', function(e) {
e.preventDefault();
- var date_from = $.datepicker.formatDate('yy-mm-dd', $.datepicker.parseDate(ajaxCart.dateFormat, $('#room_check_in').val()));
- var date_to = $.datepicker.formatDate('yy-mm-dd', $.datepicker.parseDate(ajaxCart.dateFormat, $('#room_check_out').val()));
- ajaxCart.add($('#product_page_product_id').val(), $('#idCombination').val(), true, null, $('#quantity_wanted').val(), null, date_from, date_to);
-
+ var date_from = $.datepicker.formatDate('yy-mm-dd', $.datepicker.parseDate('yy-mm-dd', $('#room_check_in').val()));
+ var date_to = $.datepicker.formatDate('yy-mm-dd', $.datepicker.parseDate('yy-mm-dd', $('#room_check_out').val()));
+ var occupancy = getBookingOccupancyDetails($(this).closest('.booking_room_fields'));
+ if (occupancy) {
+ ajaxCart.add($('#product_page_product_id').val(), $('#idCombination').val(), true, null, occupancy, null, date_from, date_to);
+ }
});
}
@@ -214,8 +216,8 @@ var ajaxCart = {
/*by webkul*/
if (pagename == 'product') {
- dateFrom = $.datepicker.formatDate('yy-mm-dd', $.datepicker.parseDate(ajaxCart.dateFormat, $('#room_check_in').val()));
- dateTo = $.datepicker.formatDate('yy-mm-dd', $.datepicker.parseDate(ajaxCart.dateFormat, $('#room_check_out').val()));
+ dateFrom = $.datepicker.formatDate('yy-mm-dd', $.datepicker.parseDate('yy-mm-dd', $('#room_check_in').val()));
+ dateTo = $.datepicker.formatDate('yy-mm-dd', $.datepicker.parseDate('yy-mm-dd', $('#room_check_out').val()));
} else if (pagename == 'category') {
dateFrom = $('#check_in_time').val();
dateTo = $('#check_out_time').val();
@@ -319,7 +321,7 @@ var ajaxCart = {
// close fancybox
updateFancyBox: function() {},
// add a product in the cart via ajax
- add: function(idProduct, idCombination, addedFromProductPage, callerElement, quantity, whishlist, dateFrom, dateTo) {
+ add: function(idProduct, idCombination, addedFromProductPage, callerElement, occupancy, whishlist, dateFrom, dateTo) {
if (addedFromProductPage && !checkCustomizations()) {
if (contentOnly) {
@@ -346,8 +348,9 @@ var ajaxCart = {
if (addedFromProductPage) {
$('#add_to_cart button').prop('disabled', 'disabled').addClass('disabled');
$('.filled').removeClass('filled');
- } else
+ } else {
$(callerElement).prop('disabled', 'disabled');
+ }
if ($('.cart_block_list').hasClass('collapsed'))
this.expand();
@@ -365,7 +368,7 @@ var ajaxCart = {
async: true,
cache: false,
dataType: "json",
- data: 'controller=cart&add=1&dateFrom=' + dateFrom + '&dateTo=' + dateTo + '&ajax=true&qty=' + ((quantity && quantity != null) ? quantity : '1') + '&id_product=' + idProduct + '&roomDemands=' + JSON.stringify(roomDemands) + '&token=' + static_token + ((parseInt(idCombination) && idCombination != null) ? '&ipa=' + parseInt(idCombination) : '' + '&id_customization=' + ((typeof customizationId !== 'undefined') ? customizationId : 0)),
+ data: 'controller=cart&add=1&dateFrom=' + dateFrom + '&dateTo=' + dateTo + '&ajax=true&occupancy=' + JSON.stringify(occupancy) + '&id_product=' + idProduct + '&roomDemands=' + JSON.stringify(roomDemands) + '&token=' + static_token + ((parseInt(idCombination) && idCombination != null) ? '&ipa=' + parseInt(idCombination) : '' + '&id_customization=' + ((typeof customizationId !== 'undefined') ? customizationId : 0)),
success: function(jsonData, textStatus, jqXHR) {
/*by webkul checking and setting availability of rooms*/
/*for product page add to cart quantity management*/
@@ -375,7 +378,7 @@ var ajaxCart = {
} else {
$('.num_quantity_alert').hide();
}
- $("#max_avail_type_qty").val(jsonData.avail_rooms);
+ $(".max_avail_type_qty").val(jsonData.avail_rooms);
$(".num_searched_avail_rooms").text(jsonData.avail_rooms);
if (jsonData.avail_rooms == 0) {
@@ -388,18 +391,17 @@ var ajaxCart = {
if (pagename == 'category') {
if (jsonData.avail_rooms <= room_warning_num) {
- $(".cat_remain_rm_qty_" + idProduct).closest('.rm_left').show();
+ $(callerElement).closest(".room_cont").find(".rm_left").show();
} else {
- $("cat_remain_rm_qty_" + idProduct).closest('.rm_left').hide();
+ $(callerElement).closest(".room_cont").find(".rm_left").hide();
}
/*for category page add to cart quantity management*/
-
- $(".cat_remain_rm_qty_" + idProduct).text(jsonData.avail_rooms);
+ $(callerElement).closest(".room_cont").find(".remain_rm_qty").text(jsonData.avail_rooms);
if (jsonData.avail_rooms == 0) {
- $(".cat_remain_rm_qty_" + idProduct).closest('.room_cont').hide();
+ $(callerElement).closest(".room_cont").hide();
}
- //$('#cat_quantity_wanted_'+idProduct).val(1);
+ //$('#quantity_wanted_'+idProduct).val(1);
}
@@ -416,22 +418,27 @@ var ajaxCart = {
if (jsonData.crossSelling)
$('.crossseling').html(jsonData.crossSelling);
- if (idCombination)
- $(jsonData.products).each(function() {
- if (this.id != undefined && this.id == parseInt(idProduct) && this.idCombination == parseInt(idCombination))
- if (contentOnly)
- window.parent.ajaxCart.updateLayer(this);
- else
- ajaxCart.updateLayer(this);
- });
- else
- $(jsonData.products).each(function() {
- if (this.id != undefined && this.id == parseInt(idProduct))
- if (contentOnly)
- window.parent.ajaxCart.updateLayer(this);
- else
- ajaxCart.updateLayer(this);
- });
+ // if (idCombination)
+ // $(jsonData.products).each(function() {
+ // if (this.id != undefined && this.id == parseInt(idProduct) && this.idCombination == parseInt(idCombination))
+ // if (contentOnly)
+ // window.parent.ajaxCart.updateLayer(this);
+ // else
+ // ajaxCart.updateLayer(this);
+ // });
+ // else
+ // $(jsonData.products).each(function() {
+ // if (this.id != undefined && this.id == parseInt(idProduct))
+ // if (contentOnly)
+ // window.parent.ajaxCart.updateLayer(this);
+ // else {
+ // ajaxCart.updateLayer(this);
+ // }
+ // });
+ if (jsonData.last_added_product) {
+ ajaxCart.updateLayer(jsonData.last_added_product);
+
+ }
if (contentOnly)
parent.$.fancybox.close();
} else {
@@ -444,7 +451,9 @@ var ajaxCart = {
else
$(callerElement).removeProp('disabled');
}
-
+ if (!addedFromProductPage) {
+ resetOccupancyField($(callerElement).closest('.booking_room_fields').find('.booking_occupancy_wrapper'));
+ }
emptyCustomizations();
},
@@ -505,8 +514,8 @@ var ajaxCart = {
/*by webkul checking and setting availability of rooms*/
/*for product page add to cart quantity management*/
if (pagename == 'product') {
- var date_checkIn = $.datepicker.formatDate('yy-mm-dd', $.datepicker.parseDate(ajaxCart.dateFormat, $('#room_check_in').val()));
- var date_checkOut = $.datepicker.formatDate('yy-mm-dd', $.datepicker.parseDate(ajaxCart.dateFormat, $('#room_check_out').val()));
+ var date_checkIn = $.datepicker.formatDate('yy-mm-dd', $.datepicker.parseDate('yy-mm-dd', $('#room_check_in').val()));
+ var date_checkOut = $.datepicker.formatDate('yy-mm-dd', $.datepicker.parseDate('yy-mm-dd', $('#room_check_out').val()));
var product_page_id_product = $('#product_page_product_id').val();
if (idProduct == product_page_id_product && dateFrom < date_checkOut && dateTo >= date_checkIn) {
if (jsonData.avail_rooms <= room_warning_num) {
@@ -514,7 +523,7 @@ var ajaxCart = {
} else {
$('.num_quantity_alert').hide();
}
- $("#max_avail_type_qty").val(jsonData.avail_rooms);
+ $(".max_avail_type_qty").val(jsonData.avail_rooms);
$(".num_searched_avail_rooms").text(jsonData.avail_rooms);
if (jsonData.avail_rooms == 0) {
@@ -529,18 +538,18 @@ var ajaxCart = {
if (pagename == 'category') {
if (jsonData.avail_rooms <= room_warning_num) {
- $(".cat_remain_rm_qty_" + idProduct).closest('.rm_left').show();
+ $(".room_cont").find('[data-id-product="'+idProduct+'"] .rm_left').show();
} else {
- $("cat_remain_rm_qty_" + idProduct).closest('.rm_left').hide();
+ $("room_cont").find('[data-id-product="'+idProduct+'"] .rm_left').hide();
}
/*for category page add to cart quantity management*/
- $(".cat_remain_rm_qty_" + idProduct).text(jsonData.avail_rooms);
+ $(".room_cont").find('[data-id-product="'+idProduct+'"] .remain_rm_qty').text(jsonData.avail_rooms);
if (jsonData.avail_rooms == 0) {
- $(".cat_remain_rm_qty_" + idProduct).closest('.room_cont').hide();
+ $(".room_cont").find('[data-id-product="'+idProduct+'"]').hide();
}
- //$('#cat_quantity_wanted_'+idProduct).val(1);
+ //$('#quantity_wanted_'+idProduct).val(1);
}
ajaxCart.updateCart(jsonData);
@@ -628,28 +637,27 @@ var ajaxCart = {
data: 'controller=cart&delete=1&dateFrom=' + dateFrom + '&dateTo=' + dateTo + '&id_product=' + idProduct + '&ipa=' + ((idCombination != null && parseInt(idCombination)) ? idCombination : '') + ((customizationId && customizationId != null) ? '&id_customization=' + customizationId : '') + '&id_address_delivery=' + idAddressDelivery + '&token=' + static_token + '&ajax=true',
success: function(jsonData) {
if (pagename == 'product') {
- if (jsonData.avail_rooms <= room_warning_num) {
- $('.num_quantity_alert').show();
- } else {
- $('.num_quantity_alert').hide();
- }
+ // if (jsonData.avail_rooms <= room_warning_num) {
+ // $('.num_quantity_alert').show();
+ // } else {
+ // $('.num_quantity_alert').hide();
+ // }
- $("#max_avail_type_qty").val(jsonData.avail_rooms);
- $(".num_searched_avail_rooms").text(jsonData.avail_rooms);
- $('.sold_out_alert').hide();
- disableRoomTypeDemands(0);
- $('.unvail_rooms_cond_display').show();
+ // $(".max_avail_type_qty").val(jsonData.avail_rooms);
+ // $(".num_searched_avail_rooms").text(jsonData.avail_rooms);
+ // $('.sold_out_alert').hide();
+ // disableRoomTypeDemands(0);
+ // $('.unvail_rooms_cond_display').show();
}
if (pagename == 'category') {
// for category page....
- $(".cat_remain_rm_qty_" + idProduct).text(jsonData.avail_rooms);
-
- $(".cat_remain_rm_qty_" + idProduct).closest('.room_cont').show(0, function() {
+ $('.room_cont[data-id-product="'+idProduct+'"]').find(".remain_rm_qty").text(jsonData.avail_rooms);
+ $('.room_cont[data-id-product="'+idProduct+'"]').show(0, function() {
if (jsonData.avail_rooms <= room_warning_num) {
- $(".cat_remain_rm_qty_" + idProduct).closest('.rm_left').show();
+ $('.room_cont[data-id-product="'+idProduct+'"]').find('.rm_left').show();
} else {
- $(".cat_remain_rm_qty_" + idProduct).closest('.rm_left').hide();
+ $('.room_cont[data-id-product="'+idProduct+'"]').find('.rm_left').hide();
}
});
}
@@ -1037,17 +1045,20 @@ var ajaxCart = {
$('#layer_cart_product_price').text(product.price);
//by webkul has to work on it more..
- if (pagename == 'product') {
- $('#layer_cart_product_time_duration').text($('#room_check_in').val() + ' - ' + $('#room_check_out').val());
- $('#layer_cart_product_quantity').text($('#quantity_wanted').val());
- $('#quantity_wanted').val(1);
- }
- if (pagename == 'category') {
- $('#layer_cart_product_time_duration').text($('#check_in_time').val() + ' - ' + $('#check_out_time').val());
- $('#layer_cart_product_quantity').text($('#cat_quantity_wanted_' + product.id).val());
- $('#cat_quantity_wanted_' + product.id).val(1);
+ $('#layer_cart_product_time_duration').text(
+ product.date_from + ' - ' + product.date_to
+ );
- }
+ let rooms = 0;
+ let adult = 0;
+ let children = 0;
+ $.each(product.occupancy, function(index, val) {
+ rooms++;
+ adult += parseInt(val.adult);
+ children += parseInt(val.children);
+
+ });
+ $('#layer_cart_product_quantity').text(getRoomTypeGuestOccupancyFormated(adult, children, rooms));
$('.layer_cart_img').html(' ');
@@ -1216,4 +1227,48 @@ function getRoomsExtraDemands()
});
return roomDemands;
+}
+
+function getBookingOccupancyDetails(bookingform)
+{
+ let occupancy;
+ if (occupancy_wise_booking) {
+ let selected_occupancy = $(bookingform).find(".occupancy_info_block.selected")
+ if (selected_occupancy.length) {
+ occupancy = [];
+ $(selected_occupancy).each(function(ind, element) {
+ if (parseInt($(element).find('.num_adults').val())) {
+ let child_ages = [];
+ $(element).find('.guest_child_age').each(function(index) {
+ if ($(this).val() > -1) {
+ child_ages.push($(this).val());
+ }
+ });
+ if ($(element).find('.num_children').val()) {
+ if (child_ages.length != $(element).find('.num_children').val()) {
+ $(bookingform).find('.booking_occupancy_wrapper').parent().addClass('open')
+ occupancy = false;
+ return false;
+ }
+ }
+ occupancy.push({
+ 'adult': $(element).find('.num_adults').val(),
+ 'children': $(element).find('.num_children').val(),
+ 'child_ages': child_ages
+ });
+ } else {
+ $(bookingform).find('.booking_occupancy_wrapper').parent().addClass('open')
+ occupancy = false;
+ return false;
+ }
+ });
+ } else {
+ $(bookingform).find('.booking_occupancy_wrapper').parent().addClass('open')
+ occupancy = false;
+ }
+ } else {
+ occupancy = parseInt($(bookingform).find(".quantity_wanted").val());
+ }
+
+ return occupancy;
}
\ No newline at end of file
diff --git a/modules/blockcart/blockcart.php b/modules/blockcart/blockcart.php
index 2ad83363e..c011e9992 100644
--- a/modules/blockcart/blockcart.php
+++ b/modules/blockcart/blockcart.php
@@ -195,6 +195,52 @@ class Blockcart extends Module
1
);
+ $addedProduct = false;
+ // get currently added product if exists
+ if (!empty($params['cookie']->currentAddedProduct)) {
+ $addedProduct = json_decode($params['cookie']->currentAddedProduct, true);
+ $objProduct = new Product($addedProduct['id_product'], false, $this->context->language->id);
+
+ $addedProduct['name'] = $objProduct->name;
+ $addedProduct['link'] = $this->context->link->getProductLink(
+ $objProduct->id,
+ $objProduct->link_rewrite,
+ $objProduct->category,
+ null,
+ null,
+ $this->context->cart->id_shop
+ );
+ $image = Product::getCover($objProduct->id);
+ $image['id_product'] = $objProduct->id;
+ // Product::defineProductImage(array(Product::getCover($objProduct->id)['id_image']/), $this->id_lang)
+ $addedProduct['image'] = $this->context->link->getImageLink(
+ $objProduct->link_rewrite,
+ Product::defineProductImage($image, $this->context->language->id),
+ 'home_default'
+ );
+ $addedProduct['image_cart'] = $this->context->link->getImageLink(
+ $objProduct->link_rewrite,
+ Product::defineProductImage($image, $this->context->language->id),
+ 'cart_default'
+ );
+ $price = $addedProduct['price'] = HotelRoomTypeFeaturePricing::getRoomTypeTotalPrice(
+ $objProduct->id,
+ $addedProduct['date_from'],
+ $addedProduct['date_to'],
+ $addedProduct['req_rm']
+ );
+
+ if ($priceDisplayMethod == PS_TAX_EXC) {
+ $addedProduct['price'] = Tools::displayPrice($price['total_price_tax_incl']);
+ } else {
+ $addedProduct['price'] = Tools::displayPrice($price['total_price_tax_excl']);
+ }
+ $addedProduct['date_from'] = Tools::displayDate($addedProduct['date_from']);
+ $addedProduct['date_to'] = Tools::displayDate($addedProduct['date_to']);
+
+ unset($this->context->cookie->currentAddedProduct);
+ }
+
$response = array(
'products' => $products,
'customizedDatas' => Product::getAllCustomizedDatas((int) ($params['cart']->id)),
@@ -218,7 +264,7 @@ class Blockcart extends Module
'static_token' => Tools::getToken(false),
'free_shipping' => Tools::displayPrice($total_free_shipping),
'free_shipping_float' => $total_free_shipping,
-
+ 'last_added_product' => $addedProduct,
'cart_booking_data' => $htlCartData,
'total_rooms_in_cart' => $totalRooms,
);
diff --git a/modules/blockcart/blockcart.tpl b/modules/blockcart/blockcart.tpl
index 6192288d3..f5ec9906f 100644
--- a/modules/blockcart/blockcart.tpl
+++ b/modules/blockcart/blockcart.tpl
@@ -24,7 +24,7 @@
*}
{if isset($blockcart_top) && $blockcart_top}
-
@@ -226,7 +333,52 @@
{/foreach}
-
+ {if $occupancy_wise_booking}
+ |
+
+
+
+
+ |
+ {/if}
+
|
@@ -240,34 +392,84 @@
- | {l s='Room No.' mod='hotelreservationsystem'} |
{l s='Duration' mod='hotelreservationsystem'} |
+ {l s='Room No.' mod='hotelreservationsystem'} |
{l s='Allotment Type' mod='hotelreservationsystem'} |
+ {if $occupancy_wise_booking}
+ {l s='Guests' mod='hotelreservationsystem'} |
+ {/if}
{l s='Action' mod='hotelreservationsystem'} |
{foreach from=$book_v['data']['partially_available'] key=part_k item=part_v}
- | {$part_v['room_num']|escape:'htmlall':'UTF-8'} |
-
+ |
+ {dateFormat date=date('Y-m-d', strtotime($part_v['date_from']))} - {dateFormat date=date('Y-m-d', strtotime($part_v['date_to']))}
+ |
+
- {foreach from=$part_v['avai_dates'] key=sub_part_k item=sub_part_v}
+ {foreach from=$part_v['rooms'] key=sub_part_k item=sub_part_v}
|
- {dateFormat date=date('Y-m-d', strtotime($sub_part_v['date_from']))} - {dateFormat date=date('Y-m-d', strtotime($sub_part_v['date_to']))}
+ {$sub_part_v['room_num']}
|
{foreach $allotment_types as $allotment_type}
{/foreach}
-
+
|
+ {if $occupancy_wise_booking}
+
+
+
+
+
+ |
+ {/if}
-
+
|
{/foreach}
@@ -528,7 +730,24 @@
{addJsDef check_calender_var = $check_calender_var}
{addJsDefL name=no_rm_avail_txt}{l s='No rooms available.' js=1 mod='hotelreservationsystem'}{/addJsDefL}
{addJsDefL name=slct_rm_err}{l s='Please select a room first.' js=1 mod='hotelreservationsystem'}{/addJsDefL}
+ {addJsDef max_child_age=$max_child_age}
+ {addJsDef max_child_in_room=$max_child_in_room}
+ {addJsDef occupancy_wise_search=$occupancy_wise_search|boolval}
+ {addJsDef occupancy_wise_booking=$occupancy_wise_booking|boolval}
+ {addJsDefL name='select_age_txt'}{l s='Select age' js=1 mod='hotelreservationsystem'}{/addJsDefL}
+ {addJsDefL name='under_1_age'}{l s='Under 1' js=1 mod='hotelreservationsystem'}{/addJsDefL}
+ {addJsDefL name='room_txt'}{l s='Room' js=1 mod='hotelreservationsystem'}{/addJsDefL}
+ {addJsDefL name='rooms_txt'}{l s='Rooms' js=1 mod='hotelreservationsystem'}{/addJsDefL}
+ {addJsDefL name='remove_txt'}{l s='Remove' js=1 mod='hotelreservationsystem'}{/addJsDefL}
+ {addJsDefL name='adult_txt'}{l s='Adult' js=1 mod='hotelreservationsystem'}{/addJsDefL}
+ {addJsDefL name='adults_txt'}{l s='Adults' js=1 mod='hotelreservationsystem'}{/addJsDefL}
+ {addJsDefL name='child_txt'}{l s='Child' js=1 mod='hotelreservationsystem'}{/addJsDefL}
+ {addJsDefL name='children_txt'}{l s='Children' js=1 mod='hotelreservationsystem'}{/addJsDefL}
+ {addJsDefL name='below_txt'}{l s='Below' js=1 mod='hotelreservationsystem'}{/addJsDefL}
+ {addJsDefL name='years_txt'}{l s='years' js=1 mod='hotelreservationsystem'}{/addJsDefL}
+ {addJsDefL name='all_children_txt'}{l s='years' js=1 mod='hotelreservationsystem'}{/addJsDefL}
+ {addJsDefL name='invalid_occupancy_txt'}{l s='Invalid occupancy(adults/children) found.' js=1 mod='hotelreservationsystem'}{/addJsDefL}
{/strip}
{/if}
@@ -566,4 +785,3 @@ $(document).ready(function() {
});
-
\ No newline at end of file
diff --git a/modules/statsbestproducts/statsbestproducts.php b/modules/statsbestproducts/statsbestproducts.php
index e2e6d1179..b59657afb 100644
--- a/modules/statsbestproducts/statsbestproducts.php
+++ b/modules/statsbestproducts/statsbestproducts.php
@@ -199,7 +199,7 @@ class StatsBestProducts extends ModuleGrid
$bookingParams['date_to'] = $dateTo;
foreach ($values as &$value) {
$bookingParams['hotel_id'] = $value['id_hotel'];
- $bookingParams['room_type'] = $value['id_product'];
+ $bookingParams['id_room_type'] = $value['id_product'];
$booking_data = $objBookingDtl->getBookingData($bookingParams);
if (isset($booking_data['stats']['num_avail'])) {
$value['avail_rooms'] = $booking_data['stats']['num_avail'];
diff --git a/modules/statscheckup/statscheckup.php b/modules/statscheckup/statscheckup.php
index 545d53d96..e5f45b74d 100644
--- a/modules/statscheckup/statscheckup.php
+++ b/modules/statscheckup/statscheckup.php
@@ -260,7 +260,7 @@ class StatsCheckUp extends Module
$row['stock'] = 0;
if ($roomTypeInfo = $objHotelRoomType->getRoomTypeInfoByIdProduct($row['id_product'])) {
$bookingParams['hotel_id'] = $roomTypeInfo['id_hotel'];
- $bookingParams['room_type'] = $row['id_product'];
+ $bookingParams['id_room_type'] = $row['id_product'];
if ($booking_data = $objBookingDtl->getBookingData($bookingParams)) {
if (isset($booking_data['stats']['num_avail'])) {
$row['stock'] = $booking_data['stats']['num_avail'];
diff --git a/modules/statsproduct/statsproduct.php b/modules/statsproduct/statsproduct.php
index 5814d7c41..03bfda68a 100644
--- a/modules/statsproduct/statsproduct.php
+++ b/modules/statsproduct/statsproduct.php
@@ -362,7 +362,7 @@ class StatsProduct extends ModuleGraph
$availRooms = 0;
if ($roomTypeInfo = $objHotelRoomType->getRoomTypeInfoByIdProduct($product['id_product'])) {
$bookingParams['hotel_id'] = $roomTypeInfo['id_hotel'];
- $bookingParams['room_type'] = $product['id_product'];
+ $bookingParams['id_room_type'] = $product['id_product'];
if ($booking_data = $objBookingDtl->getBookingData($bookingParams)) {
if (isset($booking_data['stats']['num_avail'])) {
$availRooms = $booking_data['stats']['num_avail'];
diff --git a/modules/wkhotelfilterblock/wkhotelfilterblock.php b/modules/wkhotelfilterblock/wkhotelfilterblock.php
index 5eb9ce8e1..333a7a3dc 100644
--- a/modules/wkhotelfilterblock/wkhotelfilterblock.php
+++ b/modules/wkhotelfilterblock/wkhotelfilterblock.php
@@ -212,8 +212,6 @@ class wkhotelfilterblock extends Module
$max_adult = HotelRoomType::getMaxAdults($id_hotel);
$max_child = HotelRoomType::getMaxChild($id_hotel);
- $category = new Category($htl_id_category);
-
if (!($date_from = Tools::getValue('date_from'))) {
$date_from = date('Y-m-d');
$date_to = date('Y-m-d', strtotime($date_from) + 86400);
@@ -231,10 +229,27 @@ class wkhotelfilterblock extends Module
$prod_price[] = Product::getPriceStatic($value['id_product'], HotelBookingDetail::useTax());
}
}
+
+ // Create URL of category
+ $occupancy = Tools::getValue('occupancy');
+ $urlData = array (
+ 'date_from' => $date_from,
+ 'date_to' => $date_to,
+ 'occupancy' => $occupancy,
+ );
+
if (Configuration::get('PS_REWRITING_SETTINGS')) {
- $cat_link = $this->context->link->getCategoryLink($category, is_array($category->link_rewrite) ? $category->link_rewrite[$id_lang] : $this->link_rewrite, $id_lang).'?date_from='.$date_from.'&date_to='.$date_to;
+ $categoryUrl = $this->context->link->getCategoryLink(
+ new Category($htl_id_category, $this->context->language->id),
+ null,
+ $this->context->language->id
+ ).'?'.http_build_query($urlData);
} else {
- $cat_link = $this->context->link->getCategoryLink($category, is_array($category->link_rewrite) ? $category->link_rewrite[$id_lang] : $this->link_rewrite, $id_lang).'&date_from='.$date_from.'&date_to='.$date_to;
+ $categoryUrl = $this->context->link->getCategoryLink(
+ new Category($htl_id_category, $this->context->language->id),
+ null,
+ $this->context->language->id
+ ).'&'.http_build_query($urlData);
}
$currency = $this->context->currency;
@@ -252,9 +267,9 @@ class wkhotelfilterblock extends Module
'all_feat' => $all_feat,
'max_adult' => $max_adult,
'max_child' => $max_child,
- 'cat_link' => $cat_link,
+ 'cat_link' => $categoryUrl,
'ratting_img' => $ratting_img,
- 'currency' => $currency,
+ 'currency' => $this->context->currency,
'date_from' => $date_from,
'date_to' => $date_to,
'num_days' => $num_days,
diff --git a/modules/wkroomsearchblock/classes/WkRoomSearchHelper.php b/modules/wkroomsearchblock/classes/WkRoomSearchHelper.php
index 3ac635a15..f8e349442 100644
--- a/modules/wkroomsearchblock/classes/WkRoomSearchHelper.php
+++ b/modules/wkroomsearchblock/classes/WkRoomSearchHelper.php
@@ -54,6 +54,44 @@ class WkRoomSearchHelper
}
}
+ // Lets validate guest occupancy fields
+ // Get guest occupancy variable
+ $guestOccupancy = Tools::getValue('occupancy');
+ if (!count($guestOccupancy)) {
+ $errors[] = $objModule->l('Invalid occupancy', 'WkRoomSearchHelper');
+ } else {
+ $adultTypeErr = 0;
+ $childTypeErr = 0;
+ $childAgeErr = 0;
+ foreach ($guestOccupancy as $occupancy) {
+ if (!isset($occupancy['adult']) || !Validate::isUnsignedInt($occupancy['adult'])) {
+ $adultTypeErr = 1;
+ }
+ if (!isset($occupancy['children']) || !Validate::isUnsignedInt($occupancy['children'])) {
+ $childTypeErr = 1;
+ } elseif ($occupancy['children']) {
+ if (!isset($occupancy['child_ages']) || ($occupancy['children'] != count($occupancy['child_ages']))) {
+ $childAgeErr = 1;
+ } else {
+ foreach ($occupancy['child_ages'] as $childAge) {
+ if (!Validate::isUnsignedInt($childAge)) {
+ $childAgeErr = 1;
+ }
+ }
+ }
+ }
+ }
+ if ($adultTypeErr) {
+ $errors[] = $objModule->l('Invalid adults', 'WkRoomSearchHelper');
+ }
+ if ($childTypeErr) {
+ $errors[] = $objModule->l('Invalid children', 'WkRoomSearchHelper');
+ }
+ if ($childAgeErr) {
+ $errors[] = $objModule->l('Invalid children ages', 'WkRoomSearchHelper');
+ }
+ }
+
return $errors;
}
@@ -71,6 +109,10 @@ class WkRoomSearchHelper
$hotelsInfo = $objHotelInfo->hotelBranchesInfo(0, 1);
$locationEnabled = Configuration::get('WK_HOTEL_LOCATION_ENABLE');
+ $occupancyEnabled = false;
+ if (Configuration::get('PS_FRONT_SEARCH_TYPE') == HotelBookingDetail::SEARCH_TYPE_OWS) {
+ $occupancyEnabled = true;
+ }
// if room type page
if ($idProduct = Tools::getValue('id_product')) {
$objHtlRoomType = new HotelRoomType();
@@ -102,8 +144,8 @@ class WkRoomSearchHelper
$searchedData['num_days'] = $objBookingDetail->getNumberOfDays($dateFrom, $dateTo);
$searchedData['parent_data'] = $htlCategoryInfo;
- $searchedData['date_from'] = date('d-m-Y', strtotime($dateFrom));
- $searchedData['date_to'] = date('d-m-Y', strtotime($dateTo));
+ $searchedData['date_from'] = $dateFrom;
+ $searchedData['date_to'] = $dateTo;
$searchedData['htl_dtl'] = $objHotelInfo->hotelBranchesInfo(0, 1, 1, $idHotel);
$searchedData['location'] = $searchedData['htl_dtl']['city'];
@@ -123,6 +165,20 @@ class WkRoomSearchHelper
}
}
+ if ($occupancyEnabled) {
+ // send occupancy information searched by the user
+ if ($searchedData['occupancies'] = Tools::getvalue('occupancy')) {
+ $searchedData['occupancy_adults'] = array_sum(
+ array_column($searchedData['occupancies'], 'adult')
+ );
+ $searchedData['occupancy_children'] = array_sum(
+ array_column($searchedData['occupancies'], 'children')
+ );
+ $searchedData['occupancy_child_ages'] = array_sum(
+ array_column($searchedData['occupancies'], 'child_ages')
+ );
+ }
+ }
$smartyVars['search_data'] = $searchedData;
}
@@ -142,10 +198,78 @@ class WkRoomSearchHelper
$smartyVars['total_active_hotels'] = $totalActiveHotels;
$smartyVars['hotels_info'] = $hotelsInfo;
$smartyVars['show_hotel_name'] = Configuration::get('WK_HOTEL_NAME_ENABLE');
+ $smartyVars['max_child_age'] = Configuration::get('WK_GLOBAL_CHILD_MAX_AGE');
$maxOrderDate = HotelOrderRestrictDate::getMaxOrderDate($idHotel);
$smartyVars['max_order_date'] = date('Y-m-d', strtotime($maxOrderDate));
+
+ // set base width for each elements
+ $search_column_widths = array(
+ 'location' => 4,
+ 'hotel' => 5,
+ 'date' => 5,
+ 'occupancy' => 5,
+ 'search' => 3
+ );
+
+ if (!$locationEnabled) {
+ unset($search_column_widths['location']);
+
+ $search_column_widths['date'] += 1;
+ $search_column_widths['search'] += 1;
+ if ($occupancyEnabled) {
+ $search_column_widths['search'] += 1;
+ $search_column_widths['occupancy'] += 1;
+ } elseif ($smartyVars['show_hotel_name'] || count($hotelsInfo) > 1) {
+ $search_column_widths['hotel'] += 1;
+ } else {
+ $search_column_widths['search'] += 1;
+ $search_column_widths['date'] += 1;
+ }
+ }
+ if (!$smartyVars['show_hotel_name'] && count($hotelsInfo) <= 1) {
+ unset($search_column_widths['hotel']);
+
+ $search_column_widths['date'] += 1;
+ $search_column_widths['search'] += 1;
+ if ($occupancyEnabled) {
+ $search_column_widths['date'] += 1;
+ $search_column_widths['occupancy'] += 2;
+ } else {
+ $search_column_widths['date'] += 1;
+ $search_column_widths['date'] += 2;
+ }
+ }
+ if (!$occupancyEnabled) {
+ unset($search_column_widths['occupancy']);
+
+ if ($smartyVars['show_hotel_name'] || count($hotelsInfo) > 1) {
+ if ($locationEnabled) {
+ $search_column_widths['hotel'] += 1;
+ $search_column_widths['location'] += 1;
+ $search_column_widths['search'] += 2;
+ $search_column_widths['date'] += 1;
+ } else {
+ $search_column_widths['hotel'] += 2;
+ $search_column_widths['search'] += 2;
+ $search_column_widths['date'] += 2;
+
+ }
+ } else {
+ $search_column_widths['date'] += 1;
+ $search_column_widths['date'] += 4;
+ }
+ }
+ $smartyVars['column_widths'] = $search_column_widths;
+ if (count($search_column_widths) == 2) {
+ $smartyVars['multiple_dates_input'] = true;
+ Media::addJSDef(array(
+ 'multiple_dates_input' => true
+ ));
+ }
+
+
Context::getContext()->smarty->assign($smartyVars);
}
}
diff --git a/modules/wkroomsearchblock/views/css/wk-category-search.css b/modules/wkroomsearchblock/views/css/wk-category-search.css
index c1b707c6a..4e619cde8 100644
--- a/modules/wkroomsearchblock/views/css/wk-category-search.css
+++ b/modules/wkroomsearchblock/views/css/wk-category-search.css
@@ -32,74 +32,29 @@
float: left;
margin-top: 0px;
border-top: 3px solid #FFF;}
- .header-rmsearch-wrapper #search_hotel_block_form .header-rmsearch-input {
- box-shadow: 0 2px 1px 0 rgba(0,0,0,0.18);
- height: 43px;}
- .header-rmsearch-wrapper #search_hotel_block_form #search_room_submit {
- padding: 15px 20px;
- text-align: unset;}
- .header-rmsearch-wrapper #search_hotel_block_form #search_room_submit .icon-arrow-right {
- font-size: 16px;}
- #search_hotel_block_form #hotel_location, #search_hotel_block_form #id_hotel_button, #search_hotel_block_form #guest_occupancy {
- padding-left: 35px};
-
-
-#search_hotel_block_form .input-date {
- padding-right: 35px;}
-/*.header-rmsearch-wrapper .location_search_results_ul {
- top: 1px;}
-.header-rmsearch-wrapper .hotel_dropdown_ul {
- top: 41px;}*/
- .header-rmsearch-wrapper .location_search_results_ul li, .header-rmsearch-wrapper .hotel_dropdown_ul li {
- padding: 10px 15px;}
-
-#search_hotel_block_form #hotel_location, #search_hotel_block_form #id_hotel_button, #search_hotel_block_form #guest_occupancy {
- padding-left: 35px;
- padding-right: 35px;}
-#search_hotel_block_form #hotel_location {
- padding-right: 15px;}
-.occupancy_info_block .occupancy_count {
- padding: 18px;
-}
-#search_hotel_block_form .form-group {
- margin-bottom: 15px;
-}
-@media (min-width: 480px) and (max-width: 767px) {
- #search_hotel_block_form #hotel_location, #search_hotel_block_form #id_hotel_button, #search_hotel_block_form #guest_occupancy {
- padding-left: 35px;
- padding-right: 35px;
- background-position: 2% 50%;}
- #search_hotel_block_form #id_hotel_button {
- background: url("../../views/img/icon-hotel.svg") no-repeat 2% 50%, url("../../views/img/icon-dropdown-arrow.svg") no-repeat 98% 50%;
- background-color: #FFF;}
- #search_hotel_block_form #guest_occupancy {
- background: url("../../views/img/icon-users.svg") no-repeat 2% 50%, url("../../views/img/icon-dropdown-arrow.svg") no-repeat 98% 50%;
- background-color: #FFF;}
- #search_hotel_block_form .input-date {
- background-position: 98% 50%;}
+ .header-rmsearch-wrapper #search_hotel_block_form {
+ grid-template-columns: 1fr;
}
-@media (min-width: 768px) {
- .occupancy_info_block .occupancy_count_block {
- width: 100%;}
- .occupancy_info_block .occupancy_count {
- width: 80%;}
- #search_hotel_block_form #hotel_location, #search_hotel_block_form #id_hotel_button, #search_hotel_block_form #guest_occupancy {
- padding-left: 30px;
- padding-right: 20px;}
-}
-@media (min-width: 768px) and (max-width: 768px) {
+ .header-rmsearch-wrapper #search_hotel_block_form #daterange_value.grid {
+ display: grid;
+ column-gap: 5px;
+ grid-template-columns: 1fr;
+ }
+ #search_hotel_block_form .header-rmsearch-input {
+ height: unset;
+ min-height: 45px;
+ }
+ /* #search_hotel_block_form #search_room_submit {
+ height: 45px;
+ } */
+ #search_hotel_block_form {
+ grid-template-columns: 1fr;
+ }
+ #search_hotel_block_form > div {
+ grid-column-end: unset!important;
+ grid-column: unset!important;}
+@media (min-width: 768px) and (max-width: 991px) {
.header-rmsearch-wrapper {
padding: 10px 5px;}
- #search_hotel_block_form #search_room_submit {
- font-size: 12px;}
- .header-rmsearch-wrapper #search_hotel_block_form #search_room_submit .icon-arrow-right {
- font-size: 12px;}
- #search_hotel_block_form .header-rmsearch-input {
- font-size: 13px;}
- .header-rmsearch-wrapper #search_hotel_block_form #search_room_submit {
- padding: 15px 10px;}
- .children_ages div {
- width: 100%;}
- .occupancy_info_block .occupancy_count {
- width: 75%;}
-}
\ No newline at end of file
+
+}
\ No newline at end of file
diff --git a/modules/wkroomsearchblock/views/css/wk-global-search.css b/modules/wkroomsearchblock/views/css/wk-global-search.css
index 8b8899e41..155e843b7 100644
--- a/modules/wkroomsearchblock/views/css/wk-global-search.css
+++ b/modules/wkroomsearchblock/views/css/wk-global-search.css
@@ -17,39 +17,102 @@
* @license https://store.webkul.com/license.html
*/
+#search_hotel_block_form.grid {
+ display: grid;
+ grid-template-columns: repeat(22, 1fr);
+ column-gap: 5px;
+}
+#search_hotel_block_form.grid > div {
+ display: grid;
+}
+#search_hotel_block_form .area-3 {
+ grid-column-end: span 3;
+}
+#search_hotel_block_form .area-4 {
+ grid-column-end: span 4;
+}
+#search_hotel_block_form .area-5 {
+ grid-column-end: span 5;
+}
+#search_hotel_block_form .area-6 {
+ grid-column-end: span 6;
+}
+#search_hotel_block_form .area-7 {
+ grid-column-end: span 7;
+}
+#search_hotel_block_form .area-8 {
+ grid-column-end: span 8;
+}
+#search_hotel_block_form .area-9 {
+ grid-column-end: span 9;
+}
+#search_hotel_block_form .area-10 {
+ grid-column-end: span 10;
+}
+#search_hotel_block_form .area-11 {
+ grid-column-end: span 11;
+}
+#search_hotel_block_form .area-14 {
+ grid-column-end: span 14;
+}
+#search_hotel_block_form .area-16 {
+ grid-column-end: span 16;
+}
+#daterange_value.grid {
+ display: grid;
+ column-gap: 5px;
+ grid-template-columns: repeat(2, 1fr);
+}
+/* #search_hotel_block_form {
+ display: grid;
+ grid-template-columns: 0.8fr repeat(3, 1fr) 0.6fr;
+ column-gap: 5px;
+}
+@media (min-width: 768px) and (max-width: 991px) {
+ #search_hotel_block_form {
+ grid-template-columns: repeat(12, 1fr);
+ grid-template-rows: repeat(2, 1fr);
+ }
+ #search_hotel_block_form > div {
+ grid-column-end: span 4;
+ }
+ #search_hotel_block_form > div:nth-child(1) {
+ grid-column: 1 / span 5;
+ }
+ #search_hotel_block_form > div:nth-child(2) {
+ grid-column: 6 / span 5;
+ }
+}
+@media (max-width: 767px) {
+ #search_hotel_block_form {
+ grid-template-columns: 1fr;
+ }
+} */
#search_hotel_block_form .header-rmsearch-input {
border-radius: 4px;
border: none;
color: #333;
font-size: 14px;
font-weight: 400;
- padding: 7px 5px 7px 12px;
border: 1px solid #555555;
- background-color: #FFF;}
+ background-color: #FFF;
+ min-height: 55px;}
#search_hotel_block_form .header-rmsearch-input:active, #search_hotel_block_form .header-rmsearch-input:focus {
border: 2px solid #1292FF;}
- #search_hotel_block_form #hotel_location, #search_hotel_block_form #id_hotel_button, #search_hotel_block_form #guest_occupancy {
- padding-left: 45px;
- padding-right: 35px;
- background-repeat: no-repeat;
- background-position: 4% 50%;}
- #search_hotel_block_form #hotel_location {
- background-image: url("../../views/img/icon-hotel.svg");}
#search_hotel_block_form #id_hotel_button {
- background: url("../../views/img/icon-hotel.svg") no-repeat 4% 50%, url("../../views/img/icon-dropdown-arrow.svg") no-repeat 96% 50%;
+ background: url("../../views/img/icon-hotel.svg") no-repeat 10px 50%, url("../../views/img/icon-dropdown-arrow.svg") no-repeat calc(100% - 10px) 50%;
background-color: #FFF;}
#search_hotel_block_form #guest_occupancy {
- background: url("../../views/img/icon-users.svg") no-repeat 4% 50%, url("../../views/img/icon-dropdown-arrow.svg") no-repeat 96% 50%;
- background-color: #FFF;}
-
+ height: unset;
+ text-align: unset;
+ }
#search_hotel_block_form .input-date {
- cursor: text;
- background-image: url("../../views/img/icon-calendar.svg");
- background-repeat: no-repeat;
- padding-right: 40px;
- background-position: 96% 50%;}
- #search_hotel_block_form #hotel_location {
- padding-right: 15px;}
+ display: grid;
+ cursor: text;}
+ #search_hotel_block_form .input-date span {
+ align-self: center;}
+ #search_hotel_block_form .input-date span i {
+ transform: scale(0.8, 0.6);}
.header-rmsearch-input::-webkit-input-placeholder {
color: #333;}
.header-rmsearch-input:-moz-placeholder {
@@ -135,12 +198,110 @@
color: #333333;
line-height: 22px;
text-align: center;}
- #search_hotel_block_form .form-group {
- margin-bottom: 20px;}
#search_hotel_block_form #search_room_submit {
background-color: #1292FF;
width: 100%;
font-size: 13px;
text-transform: uppercase;
border: none;
- border-radius: 4px;}
\ No newline at end of file
+ border-radius: 4px;}
+
+
+/* occupancy */
+#search_occupancy_wrapper {
+ border: none;
+ max-height: 400px;
+ min-width: 250px;
+ overflow: auto;
+ box-shadow: 0 8px 25px -4px rgba(0,0,0,0.39);
+ left: 0px;
+ padding: 20px;}
+ #search_occupancy_wrapper .occupancy-info-separator {
+ margin-bottom: 15px;
+ margin-top: 15px;
+ margin-right: -20px;
+ margin-left: -20px;}
+ #search_occupancy_wrapper .children_age_info_block {
+ display: none;}
+ #search_occupancy_wrapper .children_age_info_block label {
+ font-size: 12px;
+ color: #777777;}
+ #search_occupancy_wrapper label {
+ font-size: 14px;
+ color: #333333;
+ font-weight: 400;}
+ #search_occupancy_wrapper .add_new_occupancy_btn {
+ font-weight: bold;
+ text-decoration: none;
+ font-size: 14px;
+ color: #0000FF;
+ line-height: 24px;}
+ #search_occupancy_wrapper .add_new_occupancy_btn:active, #search_occupancy_wrapper .add_new_occupancy_btn:focus, #search_occupancy_wrapper .add_new_occupancy_btn:hover {
+ text-decoration: none;
+ color: #0000FF;}
+ #search_occupancy_wrapper .occupancy_info_head {
+ font-size: 14px;
+ color: #333333;
+ font-weight: bold;
+ margin-bottom: 10px;}
+ #search_occupancy_wrapper .occupancy_info_head .remove-room-link {
+ font-size: 12px;
+ color: #FF4343;
+ text-align: right;}
+ #search_occupancy_wrapper .occupancy_info_block {
+ display: grid;
+ grid-template-columns: repeat(2, 1fr); }
+ #search_occupancy_wrapper .occupancy_info_block .occupancy_count_block{
+ display: grid;}
+ #search_occupancy_wrapper .occupancy_info_block .occupancy_count_block > div{
+ align-self: end;}
+ #search_occupancy_wrapper .occupancy_info_block .children_age_info_block {
+ grid-column: 1 / 3}
+ #search_occupancy_wrapper .occupancy_info_block .occupancy_count {
+ padding: 14px;
+ border: 1px solid #E1E3E7;
+ font-size: 14px;
+ font-weight: 600;
+ color: #333333;
+ text-align: center;
+ border-radius: 4px;}
+ #search_occupancy_wrapper .occupancy_info_block .occupancy_count > span {
+ min-width: 21px;
+ text-align: center;
+ display: block;}
+ #search_occupancy_wrapper .occupancy_info_block .qty_direction {
+ margin-left: 3px;
+ width: 22px;}
+ #search_occupancy_wrapper .occupancy_info_block .qty_direction a {
+ padding: 1px 5px;
+ border: 0px;
+ border: 1px solid #E1E3E7;
+ color: #333;
+ border-radius: 4px;
+ font-weight: 400;}
+ #search_occupancy_wrapper .occupancy_info_block .qty_direction .occupancy_quantity_down {
+ margin-top: 3px;}
+
+ #search_occupancy_wrapper .children_ages {
+ display: grid;
+ grid-template-columns: 1fr 1fr;
+ column-gap: 5px;
+ justify-content: space-between;
+ }
+ #search_occupancy_wrapper .children_ages select {
+ background-color: #fff;
+ height: 37px;
+ border-radius: 4px;
+ padding: 3px 5px;
+ font-size: 12px;
+ color: #333;
+ border: 1px solid #E1E3E7;
+ width: 100%;}
+
+
+@media (max-width: 411px) {
+ #search_occupancy_wrapper .occupancy_info_block .occupancy_count_block {
+ width: 100%;}
+ #search_occupancy_wrapper .occupancy_info_block .occupancy_count {
+ width: 80%;}
+}
\ No newline at end of file
diff --git a/modules/wkroomsearchblock/views/css/wk-landing-page-search.css b/modules/wkroomsearchblock/views/css/wk-landing-page-search.css
index fe89903bf..f1f5fcd26 100644
--- a/modules/wkroomsearchblock/views/css/wk-landing-page-search.css
+++ b/modules/wkroomsearchblock/views/css/wk-landing-page-search.css
@@ -35,8 +35,7 @@
width: 100%;}
.header-rmsearch-primary {
display: table-cell;
- vertical-align: middle;
- text-align: center;}
+ vertical-align: middle;}
.header-rmsearch-inner-wrapper {
margin-top: 30px;
margin-bottom: 15px;}
@@ -63,27 +62,6 @@
float: left;
margin-top: 5px;
width: 125px;}
-
-#search_hotel_block_form .header-rmsearch-input {
- height: 55px;}
-.header-rmsearch-show-xs {
- background-color: #ffffff;
- top: 0;}
-#search_hotel_block_form .header-rmsearch-input {
- height: 55px;}
-#search_hotel_block_form #search_room_submit {
- padding: 5px;
- box-shadow: 0 0 20px 0 rgba(18,146,255,0.42);}
-@media (min-width: 768px) {
- #search_hotel_block_form .input-date {
- background-position: 92% 50%;}
- #search_hotel_block_form .check_in_field_block {
- padding-right:5px;}
- #search_hotel_block_form .check_out_field_block {
- padding-left:5px;}}
-
-@media (min-width: 768px) and (max-width: 1199px) {
- #search_hotel_block_form #hotel_location, #search_hotel_block_form #id_hotel_button {
- padding-left: 40px;
- padding-right: 30px;}
-}
+/* .fancybox-inner #search_hotel_block_form {
+ grid-template-columns: 1fr;
+} */
\ No newline at end of file
diff --git a/modules/wkroomsearchblock/views/css/wk-roomtype-search.css b/modules/wkroomsearchblock/views/css/wk-roomtype-search.css
index 6aede84bc..d2976d0f0 100644
--- a/modules/wkroomsearchblock/views/css/wk-roomtype-search.css
+++ b/modules/wkroomsearchblock/views/css/wk-roomtype-search.css
@@ -23,26 +23,18 @@
background: #1A4060;
box-shadow: 0 2px 6px 0 rgba(0,0,0,0.16);
padding: 20px 0px;}
- .header-rmsearch-wrapper #search_hotel_block_form {
- padding-left: 10px;
- padding-right: 10px;}
- .header-rmsearch-wrapper .filter_header {
- font-size: 12px;
- color: #FFFFFF;
- line-height: 25px;}
- .header-rmsearch-wrapper .filter_header p {
- margin-bottom: 2px;}
- .header-rmsearch-wrapper #search_hotel_block_form .header-rmsearch-input {
- box-shadow: 0 2px 1px 0 rgba(0,0,0,0.18);
- height: 49px;}
- .header-rmsearch-wrapper #search_hotel_block_form #search_room_submit {
- padding: 15px 20px;}
- .header-rmsearch-wrapper .container {
- position: relative;}
- .header-rmsearch-wrapper .close_room_serach_wrapper {
- position: absolute;
- top: 0px;
- right: 0px;}
+ .header-rmsearch-wrapper .filter_header {
+ font-size: 12px;
+ color: #FFFFFF;
+ line-height: 25px;}
+ .header-rmsearch-wrapper .filter_header p {
+ margin-bottom: 2px;}
+ .header-rmsearch-wrapper .container {
+ position: relative;}
+ .header-rmsearch-wrapper .close_room_serach_wrapper {
+ position: absolute;
+ top: 0px;
+ right: 0px;}
/* hotel searched information wrapper css */
.header-rmsearch-details-wrapper {
@@ -72,52 +64,9 @@
background-color: #FAFAFA;}
.faded-txt {
color: #777777;}
-
- /* .header-rmsearch-wrapper .location_search_results_ul {
- top: 1px;}
- .header-rmsearch-wrapper .hotel_dropdown_ul {
- top: 46px;}*/
-#search_hotel_block_form #hotel_location, #search_hotel_block_form #id_hotel_button, #search_hotel_block_form #guest_occupancy {
- padding-left: 40px;
- padding-right: 30px;}
-.header-rmsearch-wrapper .location_search_results_ul li, .header-rmsearch-wrapper .hotel_dropdown_ul li {
- padding: 13px 15px;}
-#search_hotel_block_form .input-date {
- background-position: 95% 50%;}
-@media (min-width: 768px) and (max-width: 991px) {
- .search_room_submit_block {
- float: right;}
-}
-
@media (max-width: 991px) {
.header-rmsearch-wrapper .close_room_serach_wrapper {
top: -8px;
right: 15px;}
.close_room_serach_wrapper img {
- width: 18px;}}
-
-@media (min-width: 768px) {
- #search_hotel_block_form #hotel_location {
- background-position: 3% 50%;}}
-@media (max-width: 767px) {
- #search_hotel_block_form .input-date {
- background-position: 96% 50%;}
-
- .header-rmsearch-details-wrapper .modify_roomtype_search_btn {
- width: 100%;}
-}
-@media (min-width: 480px) and (max-width: 767px) {
- #search_hotel_block_form #hotel_location, #search_hotel_block_form #id_hotel_button, #search_hotel_block_form #guest_occupancy {
- padding-left: 35px;
- padding-right: 35px;
- background-position: 2% 50%;}
- #search_hotel_block_form #id_hotel_button {
- background: url("../../views/img/icon-hotel.svg") no-repeat 2% 50%, url("../../views/img/icon-dropdown-arrow.svg") no-repeat 98% 50%;
- background-color: #FFF;}
- #search_hotel_block_form #guest_occupancy {
- background: url("../../views/img/icon-users.svg") no-repeat 2% 50%, url("../../views/img/icon-dropdown-arrow.svg") no-repeat 98% 50%;
- background-color: #FFF;}
- #search_hotel_block_form .input-date {
- background-position: 98% 50%;}
-}
-
+ width: 18px;}}
\ No newline at end of file
diff --git a/modules/wkroomsearchblock/views/js/wk-room-search-block.js b/modules/wkroomsearchblock/views/js/wk-room-search-block.js
index f09bbb788..ba33cd21b 100644
--- a/modules/wkroomsearchblock/views/js/wk-room-search-block.js
+++ b/modules/wkroomsearchblock/views/js/wk-room-search-block.js
@@ -20,14 +20,14 @@
$(document).ready(function() {
// for screen size changes for room search
var window_width = $(window).width();
- if (window_width >= 767) {
+ if (window_width > 767) {
$('.fancy_search_header_xs').hide();
}
if ($("body").length) {
$(window).resize(function() {
var window_width = $(window).width();
- if (window_width >= 767) {
+ if (window_width > 767) {
$.fancybox.close();
$('.fancy_search_header_xs').hide();
} else {
@@ -54,89 +54,82 @@ $(document).ready(function() {
var ajax_check_var = '';
$('.location_search_results_ul').hide();
- $("#check_out_time").datepicker({
- dateFormat: 'dd-mm-yy',
- dayNamesMin: [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
- //for calender Css
- beforeShowDay: function (date) {
- // get check-in date
- return highlightSelectedDateRange(date, $("#check_in_time").val(), $("#check_out_time").val());
- },
- beforeShow: function (input, instance) {
- // So that on translating page date is translated to NaN-NaN-NaN
- $('.ui-datepicker').addClass('notranslate');
-
- var date_to = $('#check_in_time').val();
- if (typeof date_to != 'undefined' && date_to != '') {
- var date_format = date_to.split("-");
- var selectedDate = new Date($.datepicker.formatDate('yy-mm-dd', new Date(date_format[2], date_format[1] - 1, date_format[0])));
- selectedDate.setDate(selectedDate.getDate()+1);
- $("#check_out_time").datepicker("option", "minDate", selectedDate);
- } else {
- var date_format = new Date();
- var selectedDate = new Date($.datepicker.formatDate('yy-mm-dd', new Date()));
- selectedDate.setDate(selectedDate.getDate()+1);
- $("#check_out_time").datepicker("option", "minDate", selectedDate);
- }
+ function createDateRangePicker(max_order_date, dateFrom, dateTo)
+ {
+ if (max_order_date) {
+ max_order_date = $.datepicker.parseDate('yy-mm-dd', max_order_date );
+ } else {
+ max_order_date = false;
}
- });
- $("#check_in_time").datepicker({
- dateFormat: 'dd-mm-yy',
- minDate: 0,
- dayNamesMin: [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
- beforeShow: function (input, instance) {
- // So that on translating page date is translated to NaN-NaN-NaN
- $('.ui-datepicker').addClass('notranslate');
- },
- //for calender Css
- beforeShowDay: function (date) {
- // highlight dates of the selected date range
- return highlightSelectedDateRange(date, $("#check_in_time").val(), $("#check_out_time").val());
- },
- onClose: function() {
- // get checkout date before making any changes for the operations
- var checkOut = $("#check_out_time").val();
- var date = $("#check_in_time").val();
- var dateFormat = date.split("-");
- var selectedDate = new Date(
- $.datepicker.formatDate('yy-mm-dd', new Date(dateFormat[2], dateFormat[1] - 1, dateFormat[0]))
+ if (typeof $('#daterange_value').data('dateRangePicker') != 'undefined') {
+ if (max_order_date) {
+ if ($.datepicker.parseDate('yy-mm-dd', $('#check_out_time').val()) < max_order_date) {
+ dateFrom = dateFrom ? dateFrom :$('#check_in_time').val();
+ dateTo = dateTo ? dateTo : $('#check_out_time').val();
+ } else {
+ dateFrom = false;
+ dateTo = false;
+ }
+ }
+ $('#daterange_value').data('dateRangePicker').clear();
+ $('#daterange_value').data('dateRangePicker').destroy();
+ $("#daterange_value").off("datepicker-change");
+ }
+
+ if (max_order_date) {
+ max_order_date = $.datepicker.formatDate('dd-mm-yy', max_order_date);
+ }
+
+ if (typeof(multiple_dates_input) != 'undefined' && multiple_dates_input) {
+ $('#daterange_value').dateRangePicker({
+ startDate: $.datepicker.formatDate('dd-mm-yy', new Date()),
+ separator : ' to ',
+ setValue: function(s,s1,s2)
+ {
+ if (s1) {
+ $('#daterange_value_from').find('span').html(s1);
+ } else {
+ $(daterange_value_from).find('span').html(
+ RangePickerCheckin
+ );
+ }
+ if (s2) {
+ $('#daterange_value_to').find('span').html(s2);
+ } else {
+ $('#daterange_value_to').find('span').html(
+ RangePickerCheckin
+ );
+ }
+ },
+ endDate: max_order_date,
+ }).on('datepicker-change', function(event,obj){
+ $('#check_in_time').val($.datepicker.formatDate('yy-mm-dd', obj.date1));
+ $('#check_out_time').val($.datepicker.formatDate('yy-mm-dd', obj.date2));
+ });
+ } else {
+ $('#daterange_value').dateRangePicker({
+ startDate: $.datepicker.formatDate('dd-mm-yy', new Date()),
+ endDate: max_order_date,
+ }).on('datepicker-change', function(event,obj){
+ $('#check_in_time').val($.datepicker.formatDate('yy-mm-dd', obj.date1));
+ $('#check_out_time').val($.datepicker.formatDate('yy-mm-dd', obj.date2));
+ });
+ }
+
+ if (dateFrom && dateTo) {
+ $('#daterange_value').data('dateRangePicker').setDateRange(
+ $.datepicker.formatDate('dd-mm-yy', $.datepicker.parseDate('yy-mm-dd', dateFrom)),
+ $.datepicker.formatDate('dd-mm-yy', $.datepicker.parseDate('yy-mm-dd', dateTo))
);
- selectedDate.setDate(selectedDate.getDate() + 1);
- $("#check_out_time").datepicker("option", "minDate", selectedDate);
-
- /* open datepicker of chechout date only if
- checkout date is empty or checkin selected is equal or more than check out date */
- if (checkOut == '') {
- $("#check_out_time").datepicker( "show" );
- } else {
- // Lets make the date in the required format
- selectedDate.setDate(selectedDate.getDate() - 1);
- var currentDate = selectedDate.getDate();
- var currentMonth = selectedDate.getMonth() + 1;
- if (currentMonth < 10) {
- currentMonth = '0' + currentMonth;
- }
- if (currentDate < 10) {
- currentDate = '0' + currentDate;
- }
-
- dmy = selectedDate.getFullYear() + "-" + currentMonth + "-" + currentDate;
- checkOut = checkOut.split("-");
- checkOut = (checkOut[2]) + '-' + (checkOut[1]) + '-' + (checkOut[0]);
-
- if (checkOut <= dmy) {
- $("#check_out_time").datepicker('show');
- }
- }
}
- });
+
+ }
+
+ createDateRangePicker(false, $('#check_in_time').val(), $('#check_out_time').val());
if (typeof max_order_date != 'undefined' && typeof booking_date_to != 'undefined') {
- max_order_date_cal = new Date(max_order_date);
- $("#check_out_time").datepicker("option", "maxDate", new Date(max_order_date));
- max_order_date_cal.setDate(max_order_date_cal.getDate() - 1);
- $("#check_in_time").datepicker("option", "maxDate", max_order_date_cal);
+ createDateRangePicker(max_order_date, $('#check_in_time').val(), $('#check_out_time').val());
}
function abortRunningAjax() {
@@ -265,17 +258,7 @@ $(document).ready(function() {
$(document).on('click', '.hotel_dropdown_ul li', function() {
var max_order_date = $(this).attr('data-max_order_date');
- var max_date_from = new Date(max_order_date);
- max_date_from.setDate(max_date_from.getDate() - 1);
- var max_date_to = new Date(max_order_date);
- if($("#check_in_time").datepicker("getDate") > max_date_from) {
- $("#check_in_time").val('');
- }
- if($("#check_out_time").datepicker("getDate") > max_date_to) {
- $("#check_out_time").val('');
- }
- $("#check_in_time").datepicker("option", "maxDate", max_date_from);
- $("#check_out_time").datepicker("option", "maxDate", max_date_to);
+ createDateRangePicker(max_order_date, $('#check_in_time').val(), $('#check_out_time').val());
$("#max_order_date").val(max_order_date);
$('#id_hotel').val($(this).attr('data-id-hotel'));
$('#hotel_cat_id').val($(this).attr('data-hotel-cat-id'));
@@ -285,30 +268,14 @@ $(document).ready(function() {
// If only one hotel then set max order date on date pickers
var max_order_date = $('#max_order_date').val();
if (max_order_date != '') {
- var max_date_from = new Date(max_order_date);
- max_date_from.setDate(max_date_from.getDate() - 1);
- var max_date_to = new Date(max_order_date);
- if($("#check_in_time").datepicker("getDate") > max_date_from) {
- $("#check_in_time").val('');
- }
- if($("#check_out_time").datepicker("getDate") > max_date_to) {
- $("#check_out_time").val('');
- }
- $("#check_in_time").datepicker("option", "maxDate", max_date_from);
- $("#check_out_time").datepicker("option", "maxDate", max_date_to);
+ createDateRangePicker(max_order_date, $('#check_in_time').val(), $('#check_out_time').val());
}
// validations on the submit of the search fields
$('#search_room_submit').on('click', function(e) {
var check_in_time = $("#check_in_time").val();
var check_out_time = $("#check_out_time").val();
-
- var date_format_check_in = check_in_time.split("-");
- var new_chk_in = new Date($.datepicker.formatDate('yy-mm-dd', new Date(date_format_check_in[2], date_format_check_in[1] - 1, date_format_check_in[0])));
- var date_format_check_out = check_out_time.split("-");
- var new_chk_out = new Date($.datepicker.formatDate('yy-mm-dd', new Date(date_format_check_out[2], date_format_check_out[1] - 1, date_format_check_out[0])));
var max_order_date = $("#max_order_date").val();
- var max_order_date_format = $.datepicker.formatDate('yy-mm-dd', new Date(max_order_date));
var error = false;
var locationCatId = $('#hotel_location').attr('city_cat_id');
@@ -324,35 +291,283 @@ $(document).ready(function() {
$('#select_htl_error_p').text(hotel_name_cond);
error = true;
}
+ var date_selector
+ if (typeof(multiple_dates_input) != 'undefined' && multiple_dates_input) {
+ date_selector = '#daterange_value_from, #daterange_value_to';
+ } else {
+ date_selector = '#daterange_value';
+ }
if (check_in_time == '') {
- $("#check_in_time").addClass("error_border");
- $('#check_in_time_error_p').text(check_in_time_cond);
+ $(date_selector).addClass("error_border");
+ $('#daterange_value_error_p').text(check_in_time_cond);
error = true;
- } else if (new_chk_in < $.datepicker.formatDate('yy-mm-dd', new Date())) {
- $("#check_in_time").addClass("error_border");
- $('#check_in_time_error_p').text(less_checkin_date);
+ } else if (check_in_time < $.datepicker.formatDate('yy-mm-dd', new Date())) {
+ $(date_selector).addClass("error_border");
+ $('#daterange_value_error_p').text(less_checkin_date);
error = true;
}
if (check_out_time == '') {
- $("#check_out_time").addClass("error_border");
- $('#check_out_time_error_p').text(check_out_time_cond);
+ $(date_selector).addClass("error_border");
+ $('#daterange_value_error_p').text(check_out_time_cond);
error = true;
- } else if (new_chk_out < new_chk_in) {
- $("#check_out_time").addClass("error_border");
- $('#check_out_time_error_p').text(more_checkout_date);
+ } else if (check_out_time < check_in_time) {
+ $(date_selector).addClass("error_border");
+ $('#daterange_value_error_p').text(more_checkout_date);
error = true;
- } else if (max_order_date_format < new_chk_in) {
- $("#check_in_time").addClass("error_border");
- $('#check_in_time_error_p').text(max_order_date_err + ' ' + max_order_date);
+ } else if (max_order_date < check_in_time) {
+ $(date_selector).addClass("error_border");
+ $('#daterange_value_error_p').text(max_order_date_err + ' ' + max_order_date);
error = true;
- } else if (max_order_date_format < new_chk_out) {
- $("#check_out_time").addClass("error_border");
- $('#check_out_time_error_p').text(max_order_date_err + ' ' + max_order_date);
+ } else if (max_order_date < check_out_time) {
+ $(date_selector).addClass("error_border");
+ $('#daterange_value_error_p').text(max_order_date_err + ' ' + max_order_date);
error = true;
}
+
if (error)
return false;
else
return true;
});
+ // Occupancy field dropdown
+ // add occupancy info block
+ $('#search_occupancy_wrapper .add_new_occupancy_btn').on('click', function(e) {
+ e.preventDefault();
+
+ var occupancy_block = '';
+
+ var roomBlockIndex = parseInt($("#search_occupancy_wrapper .occupancy_info_block").last().attr('occ_block_index'));
+ roomBlockIndex += 1;
+
+ var countRooms = parseInt($('#search_occupancy_wrapper .occupancy_info_block').length);
+ countRooms += 1
+
+ occupancy_block += '';
+ occupancy_block += ' ';
+ occupancy_block += ' ';
+ occupancy_block += ' ';
+ occupancy_block += ' ';
+ occupancy_block += ' ';
+ occupancy_block += ' ';
+ occupancy_block += '
';
+ occupancy_block += ' ';
+ $('#occupancy_inner_wrapper').append(occupancy_block);
+
+ // scroll to the latest added room
+ $("#search_occupancy_wrapper").animate({ scrollTop: $("#search_occupancy_wrapper").prop('scrollHeight') }, "slow");
+
+ setGuestOccupancy();
+ });
+
+ // remove occupancy info block
+ $(document).on('click', '#search_occupancy_wrapper .remove-room-link', function(e) {
+ e.preventDefault();
+ $(this).closest('#search_occupancy_wrapper .occupancy-room-block').remove();
+
+ $( "#search_occupancy_wrapper .room_num_wrapper" ).each(function(key, val) {
+ $(this).text(room_txt + ' - '+ (key+1) );
+ });
+
+ setGuestOccupancy();
+ });
+
+ // increase the quantity of adult and child
+ $(document).on('click', '#search_occupancy_wrapper .occupancy_quantity_up', function(e) {
+ e.preventDefault();
+ // set input field value
+ var element = $(this).closest('.occupancy_count_block').find('.num_occupancy');
+ var elementVal = parseInt(element.val()) + 1;
+
+ var childElement = $(this).closest('.occupancy_count_block').find('.num_children').length;
+ if (childElement) {
+ var totalChilds = $(this).closest('.occupancy_info_block').find('.guest_child_age').length;
+
+ if (max_child_in_room == 0 || totalChilds < max_child_in_room) {
+ element.val(elementVal);
+ $(this).closest('.occupancy_info_block').find('.children_age_info_block').show();
+
+ var roomBlockIndex = parseInt($(this).closest('.occupancy_info_block').attr('occ_block_index'));
+
+ var childAgeSelect = '';
+ childAgeSelect += '';
+ childAgeSelect += ' ';
+
+ $(this).closest('.occupancy_info_block').find('.children_ages').append(childAgeSelect);
+
+ // set input field value
+ $(this).closest('.occupancy_count_block').find('.occupancy_count > span').text(elementVal);
+ }
+ } else {
+ element.val(elementVal);
+
+ // set input field value
+ $(this).closest('.occupancy_count_block').find('.occupancy_count > span').text(elementVal);
+ }
+
+ setGuestOccupancy();
+ });
+
+ $(document).on('click', '#search_occupancy_wrapper .occupancy_quantity_down', function(e) {
+ e.preventDefault();
+ // set input field value
+ var element = $(this).closest('.occupancy_count_block').find('.num_occupancy');
+ var elementVal = parseInt(element.val()) - 1;
+ var childElement = $(this).closest('.occupancy_count_block').find('.num_children').length;
+
+ if (childElement) {
+ if (elementVal < 0) {
+ elementVal = 0;
+ } else {
+ $(this).closest('.occupancy_info_block').find('.children_ages select').last().closest('div').remove();
+ if (elementVal <= 0) {
+ $(this).closest('.occupancy_info_block').find('.children_age_info_block').hide();
+ }
+ }
+ } else {
+ if (elementVal == 0) {
+ elementVal = 1;
+ }
+ }
+
+ element.val(elementVal);
+ // set input field value
+ $(this).closest('.occupancy_count_block').find('.occupancy_count > span').text(elementVal);
+
+ setGuestOccupancy();
+ });
+
+ // toggle occupancy block
+ $('#guest_occupancy').on('click', function(e) {
+ e.stopPropagation();
+ $("#search_occupancy_wrapper").toggle();
+ });
+
+ // close the occupancy block when clink anywhere in the body outside occupancy block
+ $('body').on('click', function(e) {
+ // @TODO better approach to be found
+ if ($('#search_occupancy_wrapper').length) {
+ if ($('#search_occupancy_wrapper').css('display') !== 'none') {
+ if (!($(e.target).closest("#search_occupancy_wrapper").length)) {
+ // Before closing the occupancy block validate the vaules inside
+ let hasErrors = 0;
+
+ let adult = $("#search_occupancy_wrapper").find(".num_adults").map(function(){return $(this).val();}).get();
+ let children = $("#search_occupancy_wrapper").find(".num_children").map(function(){return $(this).val();}).get();
+ let child_ages = $("#search_occupancy_wrapper").find(".guest_child_age").map(function(){return $(this).val();}).get();
+
+ // start validating above values
+ if (!adult.length || (adult.length != children.length)) {
+ hasErrors = 1;
+ showErrorMessage(invalid_occupancy_txt);
+ } else {
+ $("#search_occupancy_wrapper").find('.occupancy_count').removeClass('error_border');
+
+ // validate values of adult and children
+ adult.forEach(function (item, index) {
+ if (isNaN(item) || parseInt(item) < 1) {
+ hasErrors = 1;
+ $("#search_occupancy_wrapper .num_adults").eq(index).closest('.occupancy_count_block').find('.occupancy_count').addClass('error_border');
+ }
+ if (isNaN(children[index])) {
+ hasErrors = 1;
+ $("#search_occupancy_wrapper .num_children").eq(index).closest('.occupancy_count_block').find('.occupancy_count').addClass('error_border');
+ }
+ });
+
+ // validate values of selected child ages
+ $("#search_occupancy_wrapper").find('.guest_child_age').removeClass('error_border');
+ child_ages.forEach(function (age, index) {
+ age = parseInt(age);
+ if (isNaN(age) || (age < 0) || (age >= parseInt(max_child_age))) {
+ hasErrors = 1;
+ $("#search_occupancy_wrapper .guest_child_age").eq(index).addClass('error_border');
+ }
+ });
+ }
+
+ if (hasErrors == 0) {
+ $("#search_occupancy_wrapper").hide();
+ $("#search_hotel_block_form #guest_occupancy").removeClass('error_border');
+ } else {
+ $("#search_hotel_block_form #guest_occupancy").addClass('error_border');
+ return false;
+ }
+ }
+ }
+ }
+ });
});
+// function to set occupancy infor in guest occupancy field(search form)
+function setGuestOccupancy()
+{
+ var adult = 0;
+ var children = 0;
+ var rooms = $('#search_occupancy_wrapper .occupancy_info_block').length;
+ $( "#search_occupancy_wrapper .num_adults" ).each(function(key, val) {
+ adult += parseInt($(this).val());
+ });
+ $( "#search_occupancy_wrapper .num_children" ).each(function(key, val) {
+ children += parseInt($(this).val());
+ });
+ var guestButtonVal = parseInt(adult) + ' ';
+ if (parseInt(adult) > 1) {
+ guestButtonVal += adults_txt;
+ } else {
+ guestButtonVal += adult_txt;
+ }
+ if (parseInt(children) > 0) {
+ if (parseInt(children) > 1) {
+ guestButtonVal += ', ' + parseInt(children) + ' ' + children_txt;
+ } else {
+ guestButtonVal += ', ' + parseInt(children) + ' ' + child_txt;
+ }
+ }
+ if (parseInt(rooms) > 1) {
+ guestButtonVal += ', ' + parseInt(rooms) + ' ' + rooms_txt;
+ } else {
+ guestButtonVal += ', ' + parseInt(rooms) + ' ' + room_txt;
+ }
+ $('#guest_occupancy > span').text(guestButtonVal);
+}
\ No newline at end of file
diff --git a/modules/wkroomsearchblock/views/templates/hook/categoryPageSearch.tpl b/modules/wkroomsearchblock/views/templates/hook/categoryPageSearch.tpl
index aa6ab0fb8..065998342 100644
--- a/modules/wkroomsearchblock/views/templates/hook/categoryPageSearch.tpl
+++ b/modules/wkroomsearchblock/views/templates/hook/categoryPageSearch.tpl
@@ -19,61 +19,10 @@
{if isset($hotels_info) && count($hotels_info)}
-
diff --git a/modules/wkroomsearchblock/views/templates/hook/roomTypePageSearch.tpl b/modules/wkroomsearchblock/views/templates/hook/roomTypePageSearch.tpl
index a58e5ed2f..95f9783e0 100644
--- a/modules/wkroomsearchblock/views/templates/hook/roomTypePageSearch.tpl
+++ b/modules/wkroomsearchblock/views/templates/hook/roomTypePageSearch.tpl
@@ -46,69 +46,11 @@
{* search form wrapper block*}
diff --git a/mails/en/awaiting.txt b/mails/en/awaiting.txt
index acd54716a..0cec17845 100644
--- a/mails/en/awaiting.txt
+++ b/mails/en/awaiting.txt
@@ -18,6 +18,6 @@ clicking "My account" [/{my_account_url}] on our shop.
If you have a guest account, you can follow your order via the
"Guest Tracking" [/{guest_tracking_url}] section on our shop.
-{shop_name} [/{shop_url}] powered by PrestaShop(tm)
-[http://www.prestashop.com/]
+{shop_name} [/{shop_url}] powered by Webkul(tm)
+[https://webkul.com]
From 41c01c6d5482203e3ae37bf8a30840653b117e62 Mon Sep 17 00:00:00 2001
From: Shreesh Arora
Date: Tue, 27 Dec 2022 13:38:45 +0530
Subject: [PATCH 24/60] undo partial payment order status changes
---
classes/order/OrderHistory.php | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/classes/order/OrderHistory.php b/classes/order/OrderHistory.php
index 9d121f109..73531efe7 100644
--- a/classes/order/OrderHistory.php
+++ b/classes/order/OrderHistory.php
@@ -312,7 +312,7 @@ class OrderHistoryCore extends ObjectModel
}
// set orders as paid
- if ($new_os->paid == 1 || (Configuration::get('PS_OS_PARTIAL_PAYMENT') == $new_os->id && $new_os->logable == 1)) {
+ if ($new_os->paid == 1) {
$invoices = $order->getInvoicesCollection();
if ($order->total_paid != 0) {
$payment_method = Module::getInstanceByName($order->module);
@@ -322,13 +322,6 @@ class OrderHistoryCore extends ObjectModel
/** @var OrderInvoice $invoice */
$rest_paid = $invoice->getRestPaid();
if ($rest_paid > 0) {
- if (Configuration::get('PS_OS_PARTIAL_PAYMENT') == $new_os->id) {
- if ($order->total_paid_real < $order->advance_paid_amount) {
- $rest_paid = $order->advance_paid_amount - $order->total_paid_real;
- } else {
- break;
- }
- }
$payment = new OrderPayment();
$payment->order_reference = Tools::substr($order->reference, 0, 9);
$payment->id_currency = $order->id_currency;
From be780220dc9a09aebedae64cbffde54575001858 Mon Sep 17 00:00:00 2001
From: Shreesh Arora
Date: Tue, 27 Dec 2022 14:55:33 +0530
Subject: [PATCH 25/60] update order status name
---
classes/Hook.php | 2 +-
classes/order/OrderHistory.php | 2 +-
config/config.inc.php | 6 +++---
controllers/admin/AdminOrdersController.php | 4 ++--
controllers/front/ParentOrderController.php | 4 ++--
install/data/xml/configuration.xml | 6 +++---
install/data/xml/order_state.xml | 2 +-
install/langs/bg/data/order_state.xml | 10 +++++-----
install/langs/bn/data/order_state.xml | 10 +++++-----
install/langs/br/data/order_state.xml | 10 +++++-----
install/langs/cs/data/order_state.xml | 10 +++++-----
install/langs/de/data/order_state.xml | 10 +++++-----
install/langs/en/data/order_state.xml | 10 +++++-----
install/langs/es/data/order_state.xml | 10 +++++-----
install/langs/fa/data/order_state.xml | 10 +++++-----
install/langs/fr/data/order_state.xml | 10 +++++-----
install/langs/he/data/order_state.xml | 10 +++++-----
install/langs/hr/data/order_state.xml | 10 +++++-----
install/langs/hu/data/order_state.xml | 10 +++++-----
install/langs/id/data/order_state.xml | 8 ++++----
install/langs/it/data/order_state.xml | 8 ++++----
install/langs/lt/data/order_state.xml | 10 +++++-----
install/langs/mk/data/order_state.xml | 10 +++++-----
install/langs/nl/data/order_state.xml | 8 ++++----
install/langs/no/data/order_state.xml | 10 +++++-----
install/langs/pl/data/order_state.xml | 10 +++++-----
install/langs/pt/data/order_state.xml | 10 +++++-----
install/langs/qc/data/order_state.xml | 8 ++++----
install/langs/ro/data/order_state.xml | 10 +++++-----
install/langs/ru/data/order_state.xml | 10 +++++-----
install/langs/si/data/order_state.xml | 10 +++++-----
install/langs/sr/data/order_state.xml | 10 +++++-----
install/langs/sv/data/order_state.xml | 10 +++++-----
install/langs/tw/data/order_state.xml | 10 +++++-----
install/langs/vn/data/order_state.xml | 10 +++++-----
install/langs/zh/data/order_state.xml | 10 +++++-----
mails/en/{awaiting.html => awaiting_payment.html} | 0
mails/en/{awaiting.txt => awaiting_payment.txt} | 0
mails/en/{payment.html => payment_accepted.html} | 0
mails/en/{payment.txt => payment_accepted.txt} | 0
modules/bankwire/bankwire.php | 4 ++--
modules/bankwire/controllers/front/validation.php | 2 +-
modules/cheque/cheque.php | 4 ++--
modules/cheque/controllers/front/validation.php | 2 +-
.../classes/WkPaypalCommerceWebhook.php | 8 ++++----
.../qlopaypalcommerce/controllers/front/payment.php | 6 +++---
46 files changed, 167 insertions(+), 167 deletions(-)
rename mails/en/{awaiting.html => awaiting_payment.html} (100%)
rename mails/en/{awaiting.txt => awaiting_payment.txt} (100%)
rename mails/en/{payment.html => payment_accepted.html} (100%)
rename mails/en/{payment.txt => payment_accepted.txt} (100%)
diff --git a/classes/Hook.php b/classes/Hook.php
index 4483ced1b..356d7b5b5 100644
--- a/classes/Hook.php
+++ b/classes/Hook.php
@@ -638,7 +638,7 @@ class HookCore extends ObjectModel
$order = new Order((int)$id_order);
$new_os = new OrderState((int)$new_order_status_id, $order->id_lang);
- $return = ((int)$new_os->id == Configuration::get('PS_OS_PAYMENT')) ? Hook::exec('paymentConfirm', array('id_order' => (int)($order->id))) : true;
+ $return = ((int)$new_os->id == Configuration::get('PS_OS_PAYMENT_ACCEPTED')) ? Hook::exec('paymentConfirm', array('id_order' => (int)($order->id))) : true;
$return = Hook::exec('updateOrderStatus', array('newOrderStatus' => $new_os, 'id_order' => (int)($order->id))) && $return;
return $return;
}
diff --git a/classes/order/OrderHistory.php b/classes/order/OrderHistory.php
index 73531efe7..6ea97d187 100644
--- a/classes/order/OrderHistory.php
+++ b/classes/order/OrderHistory.php
@@ -97,7 +97,7 @@ class OrderHistoryCore extends ObjectModel
$old_os = $order->getCurrentOrderState();
// executes hook
- if (in_array($new_os->id, array(Configuration::get('PS_OS_PAYMENT'), Configuration::get('PS_OS_WS_PAYMENT')))) {
+ if (in_array($new_os->id, array(Configuration::get('PS_OS_PAYMENT_ACCEPTED'), Configuration::get('PS_OS_WS_PAYMENT')))) {
Hook::exec('actionPaymentConfirmation', array('id_order' => (int)$order->id), null, false, true, false, $order->id_shop);
}
diff --git a/config/config.inc.php b/config/config.inc.php
index 525ecb249..1c46634a1 100644
--- a/config/config.inc.php
+++ b/config/config.inc.php
@@ -240,14 +240,14 @@ $context->link = new Link($https_link, $https_link);
* USE : Configuration::get() method in order to getting the id of order status
*/
-define('_PS_OS_AWAITING_', Configuration::get('PS_OS_AWAITING'));
-define('_PS_OS_PAYMENT_', Configuration::get('PS_OS_PAYMENT'));
+define('_PS_OS_AWAITING_PAYMENT_', Configuration::get('PS_OS_AWAITING_PAYMENT'));
+define('_PS_OS_PAYMENT_ACCEPTED_', Configuration::get('PS_OS_PAYMENT_ACCEPTED'));
define('_PS_OS_PROCESSING_', Configuration::get('PS_OS_PROCESSING'));
define('_PS_OS_CANCELED_', Configuration::get('PS_OS_CANCELED'));
define('_PS_OS_REFUND_', Configuration::get('PS_OS_REFUND'));
define('_PS_OS_ERROR_', Configuration::get('PS_OS_ERROR'));
define('_PS_OS_OVERBOOKING_', Configuration::get('PS_OS_OVERBOOKING'));
-define('_PS_OS_PARTIAL_PAYMENT_', Configuration::get('PS_OS_PARTIAL_PAYMENT'));
+define('_PS_OS_PARTIAL_PAYMENT_ACCEPTED_', Configuration::get('PS_OS_PARTIAL_PAYMENT_ACCEPTED'));
if (!defined('_MEDIA_SERVER_1_')) {
define('_MEDIA_SERVER_1_', Configuration::get('PS_MEDIA_SERVER_1'));
diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php
index dbe0543b4..05395ec7b 100644
--- a/controllers/admin/AdminOrdersController.php
+++ b/controllers/admin/AdminOrdersController.php
@@ -232,8 +232,8 @@ class AdminOrdersControllerCore extends AdminController
$this->addJqueryPlugin(array('autocomplete', 'fancybox', 'typewatch'));
$defaults_order_state = array(
- 'awaiting' => (int)Configuration::get('PS_OS_AWAITING'),
- 'other' => (int)Configuration::get('PS_OS_PAYMENT'));
+ 'awaiting_payment' => (int)Configuration::get('PS_OS_AWAITING_PAYMENT'),
+ 'other' => (int)Configuration::get('PS_OS_PAYMENT_ACCEPTED'));
$payment_modules = array();
foreach (PaymentModule::getInstalledPaymentModules() as $p_module) {
$payment_modules[] = Module::getInstanceById((int)$p_module['id_module']);
diff --git a/controllers/front/ParentOrderController.php b/controllers/front/ParentOrderController.php
index a8faded59..eb2bf17d7 100644
--- a/controllers/front/ParentOrderController.php
+++ b/controllers/front/ParentOrderController.php
@@ -182,9 +182,9 @@ class ParentOrderControllerCore extends FrontController
// order status payment accepted if no amount is pending for the booking
if ($dueAmount > 0) {
- $orderStatus = Configuration::get('PS_OS_AWAITING');
+ $orderStatus = Configuration::get('PS_OS_AWAITING_PAYMENT');
} else {
- $orderStatus = Configuration::get('PS_OS_PAYMENT');
+ $orderStatus = Configuration::get('PS_OS_PAYMENT_ACCEPTED');
}
$order->validateOrder($this->context->cart->id, $orderStatus, 0, Tools::displayError('Free order', false), null, array(), null, false, $this->context->cart->secure_key);
diff --git a/install/data/xml/configuration.xml b/install/data/xml/configuration.xml
index 52d07c2ed..145d8b8a1 100644
--- a/install/data/xml/configuration.xml
+++ b/install/data/xml/configuration.xml
@@ -377,10 +377,10 @@
1
-
+
1
-
+
2
@@ -404,7 +404,7 @@
7
-
+
8
-
-
- | Room Num |
- Room Type |
- Hotel |
- Duration |
-
- {refundBookingHtml}
- |
-
-
-
-
-
-
-
-
- | |
-
-
- Customer details
-
- Customer name: {customer_name}
- Customer email: {customer_email}
-
- |
- |
-
-
- |
-
-
-
-
-
-
-
-
-
- |
-
-
- | | | | | | | | |