Updated: The cart customer guest detail flow.
Updated: The cart customer guest detail flow.
This commit is contained in:
@@ -664,6 +664,38 @@
|
||||
</table>
|
||||
{/if}
|
||||
</div>
|
||||
{if $customer_guests && count($customer_guests)}
|
||||
<div class="panel">
|
||||
<div class="panel-heading">
|
||||
<i class="icon-user"></i>
|
||||
{l s='Customer Guests'}
|
||||
<span class="badge customer-guests-count">{count($customer_guests)}</span>
|
||||
</div>
|
||||
<table class="table customer-guests">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><span class="title_box ">{l s='Email'}</span></th>
|
||||
<th><span class="title_box ">{l s='First name'}</span></th>
|
||||
<th><span class="title_box ">{l s='Last name'}</span></th>
|
||||
<th><span class="title_box ">{l s='phone'}</span></th>
|
||||
<th colspan="2"><span class="title_box ">{l s='Actions'}</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{foreach $customer_guests AS $key => $customer_guest}
|
||||
<tr class="customer_guest_detail_{$customer_guest['id_customer_guest_detail']} customer_guest_details">
|
||||
<td>{$customer_guest['email']}</td>
|
||||
<td>{$customer_guest['firstname']}</td>
|
||||
<td>{$customer_guest['lastname']}</td>
|
||||
<td>{$customer_guest['phone']}</td>
|
||||
<td><a href="#" class="edit-customer-guest-detail" data-id_customer_guest_detail="{$customer_guest['id_customer_guest_detail']}"><i class="icon-pencil"></i></a></td>
|
||||
<td><a href="#" class="delete-customer-guest-detail" data-id_customer_guest_detail="{$customer_guest['id_customer_guest_detail']}"><i class="icon-trash"></i></a></td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
{*
|
||||
* Since 2010 Webkul.
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* All right is reserved,
|
||||
* Please go through this link for complete license : https://store.webkul.com/license.html
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to newer
|
||||
* versions in the future. If you wish to customize this module for your
|
||||
* needs please refer to https://store.webkul.com/customisation-guidelines/ for more information.
|
||||
*
|
||||
* @author Webkul IN <support@webkul.com>
|
||||
* @copyright Since 2010 Webkul IN
|
||||
* @license https://store.webkul.com/license.html
|
||||
*}
|
||||
|
||||
<div class="modal-body">
|
||||
<div class="text-left errors-wrap"></div>
|
||||
<form id="customer-guest-details-form">
|
||||
<div class="form-group row">
|
||||
<input type="hidden" value="{$customerGuestDetail->id}" name="id_customer_guest_detail">
|
||||
<div class="col-sm-2">
|
||||
<label class="control-label">{l s='Title'}</label>
|
||||
<select name="id_gender">
|
||||
{foreach from=$genders key=k item=gender}
|
||||
<option value="{$gender->id_gender}"{if $customerGuestDetail->id_gender == $gender->id_gender} selected="selected"{/if}>{$gender->name}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-sm-5">
|
||||
<label class="control-label">{l s='First Name'}</label>
|
||||
<input type="text" value="{$customerGuestDetail->firstname}" name="firstname">
|
||||
</div>
|
||||
<div class="col-sm-5">
|
||||
<label class="control-label">{l s='Last Name'}</label>
|
||||
<input type="text" value="{$customerGuestDetail->lastname}" name="lastname">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="col-sm-6">
|
||||
<label class="control-label">{l s='Email'}</label>
|
||||
<input type="text" value="{$customerGuestDetail->email}" name="email" readonly>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<label class="control-label">{l s='Phone'}</label>
|
||||
<input type="text" value="{$customerGuestDetail->phone}" name="phone">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* 2010-2020 Webkul.
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* All right is reserved,
|
||||
* Please go through this link for complete license : https://store.webkul.com/license.html
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to newer
|
||||
* versions in the future. If you wish to customize this module for your
|
||||
* needs please refer to https://store.webkul.com/customisation-guidelines/ for more information.
|
||||
*
|
||||
* @author Webkul IN <support@webkul.com>
|
||||
* @copyright 2010-2020 Webkul IN
|
||||
* @license https://store.webkul.com/license.html
|
||||
*/
|
||||
|
||||
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;
|
||||
@@ -1,124 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* 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 <support@webkul.com>
|
||||
* @copyright 2010-2022 Webkul IN
|
||||
* @license https://store.webkul.com/license.html
|
||||
*/
|
||||
|
||||
class CartCustomerGuestDetailCore extends ObjectModel
|
||||
{
|
||||
public $id_customer_guest_detail;
|
||||
public $id_cart;
|
||||
public $id_gender;
|
||||
public $firstname;
|
||||
public $lastname;
|
||||
public $email;
|
||||
public $phone;
|
||||
public $date_add;
|
||||
public $date_upd;
|
||||
|
||||
public static $definition = array(
|
||||
'table' => 'cart_customer_guest_detail',
|
||||
'primary' => 'id_customer_guest_detail',
|
||||
'fields' => array(
|
||||
'id_cart' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||
'id_gender' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||
'firstname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'size' => 32),
|
||||
'lastname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'size' => 32),
|
||||
'email' => array('type' => self::TYPE_STRING, 'validate' => 'isEmail', 'size' => 128),
|
||||
'phone' => array('type' => self::TYPE_STRING, 'validate' => 'isPhoneNumber', 'size' => 32),
|
||||
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||
'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||
),
|
||||
);
|
||||
|
||||
public static function getCartCustomerGuest($id_cart)
|
||||
{
|
||||
return Db::getInstance()->getValue('
|
||||
SELECT `id_customer_guest_detail`
|
||||
FROM `'._DB_PREFIX_.'cart_customer_guest_detail`
|
||||
WHERE `id_cart` = '.(int)$id_cart
|
||||
);
|
||||
}
|
||||
|
||||
public static function getCustomerGuestDetail($id_customer_guest_detail)
|
||||
{
|
||||
return Db::getInstance()->getRow('
|
||||
SELECT `id_gender`, `firstname`, `lastname`, `email`, `phone`
|
||||
FROM `'._DB_PREFIX_.'cart_customer_guest_detail`
|
||||
WHERE `id_customer_guest_detail` = '.(int)$id_customer_guest_detail
|
||||
);
|
||||
}
|
||||
|
||||
public static function getIdCustomerGuest($email)
|
||||
{
|
||||
return Db::getInstance()->getValue(
|
||||
'SELECT `id_customer_guest_detail` FROM `'._DB_PREFIX_.'cart_customer_guest_detail`
|
||||
WHERE `id_cart` = 0 AND `email` = "'.pSQL($email).'"'
|
||||
);
|
||||
}
|
||||
|
||||
public static function getCustomerPhone($email)
|
||||
{
|
||||
return Db::getInstance()->getValue(
|
||||
'SELECT `phone` FROM `'._DB_PREFIX_.'cart_customer_guest_detail`
|
||||
WHERE `id_cart` = 0 AND `email` = "'.pSQL($email).'"'
|
||||
);
|
||||
}
|
||||
|
||||
public function validateGuestInfo()
|
||||
{
|
||||
$isValid = true;
|
||||
if (!trim($this->firstname) || !Validate::isName($this->firstname)) {
|
||||
$isValid = false;
|
||||
}
|
||||
if (!trim($this->lastname) || !Validate::isName($this->lastname)) {
|
||||
$isValid = false;
|
||||
}
|
||||
if (!trim($this->email) || !Validate::isEmail($this->email)) {
|
||||
$isValid = false;
|
||||
}
|
||||
if (!trim($this->phone) || !Validate::isPhoneNumber($this->phone)) {
|
||||
$isValid = false;
|
||||
}
|
||||
|
||||
$className = 'CartCustomerGuestDetail';
|
||||
$rules = call_user_func(array($className, 'getValidationRules'), $className);
|
||||
|
||||
if (isset($rules['size']['firstname'])) {
|
||||
if (Tools::strlen(trim($this->firstname)) > $rules['size']['firstname']) {
|
||||
$isValid = false;
|
||||
}
|
||||
}
|
||||
if (isset($rules['size']['lastname'])) {
|
||||
if (Tools::strlen(trim($this->lastname)) > $rules['size']['lastname']) {
|
||||
$isValid = false;
|
||||
}
|
||||
}
|
||||
if (isset($rules['size']['email'])) {
|
||||
if (Tools::strlen(trim($this->email)) > $rules['size']['email']) {
|
||||
$isValid = false;
|
||||
}
|
||||
}
|
||||
if (isset($rules['size']['phone'])) {
|
||||
if (Tools::strlen(trim($this->phone)) > $rules['size']['phone']) {
|
||||
$isValid = false;
|
||||
}
|
||||
}
|
||||
|
||||
return $isValid;
|
||||
}
|
||||
}
|
||||
@@ -283,9 +283,7 @@ class CustomerCore extends ObjectModel
|
||||
}
|
||||
}
|
||||
|
||||
$objOldCustomer = new Customer($this->id);
|
||||
$success = parent::update(true);
|
||||
return $success;
|
||||
return parent::update(true);
|
||||
}
|
||||
|
||||
public function delete()
|
||||
@@ -327,6 +325,9 @@ class CustomerCore extends ObjectModel
|
||||
|
||||
CartRule::deleteByIdCustomer((int)$this->id);
|
||||
// delete customer data from customerGuest table
|
||||
$objCustomerGuestDetail = new CustomerGuestDetail();
|
||||
$objCustomerGuestDetail->deleteCustomerGuestByIdCustomer($this->id);
|
||||
|
||||
return parent::delete();
|
||||
}
|
||||
|
||||
@@ -518,18 +519,6 @@ class CustomerCore extends ObjectModel
|
||||
return Cache::retrieve($cache_id);
|
||||
}
|
||||
|
||||
public static function getPhone($id_customer)
|
||||
{
|
||||
|
||||
return Db::getInstance()->getValue(
|
||||
'SELECT cgd.`phone`
|
||||
FROM `'._DB_PREFIX_.'customer` c
|
||||
INNER JOIN `'._DB_PREFIX_.'cart_customer_guest_detail` cgd
|
||||
ON (cgd.`email` = c.`email`)
|
||||
WHERE `id_cart` = 0 AND c.`id_customer` = '.(int)($id_customer)
|
||||
);
|
||||
}
|
||||
|
||||
public static function getCustomerIdAddress($id_customer, $use_cache = true)
|
||||
{
|
||||
$cache_id = 'Customer::getCustomerIdAddress'.(int)$id_customer;
|
||||
|
||||
258
classes/CustomerGuestDetail.php
Normal file
258
classes/CustomerGuestDetail.php
Normal file
@@ -0,0 +1,258 @@
|
||||
<?php
|
||||
/**
|
||||
* 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 <support@webkul.com>
|
||||
* @copyright 2010-2022 Webkul IN
|
||||
* @license https://store.webkul.com/license.html
|
||||
*/
|
||||
|
||||
class CustomerGuestDetailCore extends ObjectModel
|
||||
{
|
||||
public $id_customer_guest_detail;
|
||||
public $id_customer;
|
||||
public $id_gender;
|
||||
public $firstname;
|
||||
public $lastname;
|
||||
public $email;
|
||||
public $phone;
|
||||
public $date_add;
|
||||
public $date_upd;
|
||||
|
||||
public static $definition = array(
|
||||
'table' => 'customer_guest_detail',
|
||||
'primary' => 'id_customer_guest_detail',
|
||||
'fields' => array(
|
||||
'id_customer' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||
'id_gender' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
|
||||
'firstname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'size' => 32),
|
||||
'lastname' => array('type' => self::TYPE_STRING, 'validate' => 'isName', 'size' => 32),
|
||||
'email' => array('type' => self::TYPE_STRING, 'validate' => 'isEmail', 'size' => 128),
|
||||
'phone' => array('type' => self::TYPE_STRING, 'validate' => 'isPhoneNumber', 'size' => 32),
|
||||
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||
'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* Get the customer guest id by id cart.
|
||||
*
|
||||
* @param int id_cart
|
||||
* @return int|false id_customer_guest_detail if exists
|
||||
*/
|
||||
public static function getCustomerGuestIdByIdCart($id_cart)
|
||||
{
|
||||
return Db::getInstance()->getValue('
|
||||
SELECT `id_customer_guest_detail`
|
||||
FROM `'._DB_PREFIX_.'cart_customer_guest`
|
||||
WHERE `id_cart` = '.(int) $id_cart
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* set the customer guest id for the id cart.
|
||||
*
|
||||
* @param int id_cart
|
||||
* @param int id_customer_guest_detail
|
||||
* @return bool True on success, false on failure
|
||||
*/
|
||||
public function saveCustomerGuestInCart($idCart, $idCustomerGuestDetail)
|
||||
{
|
||||
return Db::getInstance()->insert(
|
||||
'cart_customer_guest',
|
||||
array(
|
||||
'id_cart' => (int) $idCart,
|
||||
'id_customer_guest_detail' => (int) $idCustomerGuestDetail
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* removes the customer guest id for the id cart.
|
||||
*
|
||||
* @param int id_cart
|
||||
* @return bool True on success, false on failure
|
||||
*/
|
||||
public function deleteCustomerGuestInCart($idCart)
|
||||
{
|
||||
return Db::getInstance()->delete(
|
||||
'cart_customer_guest',
|
||||
' `id_cart`='.(int) $idCart
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes this guest's ID from all related cart entries.
|
||||
*
|
||||
* @return bool True on success, false on failure
|
||||
*/
|
||||
public function deleteCustomerGuestFromCart()
|
||||
{
|
||||
return Db::getInstance()->delete(
|
||||
'cart_customer_guest',
|
||||
'`id_customer_guest_detail` = ' . (int) $this->id
|
||||
);
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
$this->deleteCustomerGuestFromCart();
|
||||
|
||||
return parent::delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes the guest profiles created by a customer.
|
||||
*
|
||||
* @param int $idCustomer Customer ID
|
||||
* @param int $offset Number of guests to skip
|
||||
* @return bool True on success, false on failure
|
||||
*/
|
||||
public function deleteCustomerGuestByIdCustomer($idCustomer, $offset = 0)
|
||||
{
|
||||
$guests = $this->getCustomerGuestsByIdCustomer((int)$idCustomer);
|
||||
if (empty($guests)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$guestsToDelete = array_slice($guests, $offset);
|
||||
if (empty($guestsToDelete)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$res = true;
|
||||
foreach ($guestsToDelete as $guest) {
|
||||
$customerGuestDetail = new CustomerGuestDetail($guest['id_customer_guest_detail']);
|
||||
$res &= $customerGuestDetail->delete();
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves guest profiles created by a customer using the "booking for someone else" feature.
|
||||
*
|
||||
* @param int $idCustomer The customer ID
|
||||
* @param string $firstname Optional first name filter
|
||||
* @param string $lastname Optional last name filter
|
||||
* @param string $email Optional email filter
|
||||
* @return array List of matching guest profiles
|
||||
*/
|
||||
public function getCustomerGuestsByIdCustomer($idCustomer, $firstname = '', $lastname = '', $email = '')
|
||||
{
|
||||
$sql = 'SELECT cgd.`id_customer_guest_detail`, cgd.`email`, cgd.`firstname`, cgd.`lastname`, cgd.`phone`
|
||||
FROM `' . _DB_PREFIX_ . 'customer_guest_detail` cgd
|
||||
LEFT JOIN `' . _DB_PREFIX_ . 'cart_customer_guest` ccg
|
||||
ON ccg.`id_customer_guest_detail` = cgd.`id_customer_guest_detail`
|
||||
WHERE cgd.`id_customer` = '.(int) $idCustomer;
|
||||
|
||||
if ($firstname !== '') {
|
||||
$sql .= ' AND cgd.`firstname` LIKE "%'.pSQL($firstname).'%"';
|
||||
}
|
||||
|
||||
if ($lastname !== '') {
|
||||
$sql .= ' AND cgd.`lastname` LIKE "%'.pSQL($lastname).'%"';
|
||||
}
|
||||
|
||||
if ($email !== '') {
|
||||
$sql .= ' AND cgd.`email` LIKE "%'.pSQL($email).'%"';
|
||||
}
|
||||
|
||||
$sql .= ' GROUP BY cgd.`id_customer_guest_detail` ORDER BY cgd.`date_add` DESC';
|
||||
|
||||
return Db::getInstance()->executeS($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves guest information using the Id.
|
||||
*
|
||||
* @param int id_customer_guest_detail
|
||||
* @return array customer guest details.
|
||||
*/
|
||||
public static function getCustomerGuestDetailById($idCustomerGuestDetail)
|
||||
{
|
||||
return Db::getInstance()->getRow('
|
||||
SELECT `id_gender`, `firstname`, `lastname`, `email`, `phone`
|
||||
FROM `'._DB_PREFIX_.'customer_guest_detail`
|
||||
WHERE `id_customer_guest_detail` = '.(int) $idCustomerGuestDetail
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves guest information using the email.
|
||||
*
|
||||
* @param int email
|
||||
* @return int|false id customer guest details.
|
||||
*/
|
||||
public static function getCustomerGuestByEmail($email, $idCustomer = null, $idCart = 0)
|
||||
{
|
||||
return Db::getInstance()->getValue(
|
||||
'SELECT cgd.`id_customer_guest_detail` FROM `'._DB_PREFIX_.'customer_guest_detail` as cgd
|
||||
LEFT JOIN `'._DB_PREFIX_.'cart_customer_guest` ccg
|
||||
ON ccg.`id_customer_guest_detail` = cgd.`id_customer_guest_detail`
|
||||
WHERE cgd.`email` = "'.pSQL($email).'"'.
|
||||
(!is_null($idCart) ? ' AND (ccg.`id_cart` = '.(int) $idCart.' '. (($idCart) ? ')' : ' OR ISNULL(ccg.`id_cart`)) ') : ' ').
|
||||
(!is_null($idCustomer) ? ' AND cgd.`id_customer` = '.(int) $idCustomer : ' ')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates the Guest profile details.
|
||||
*
|
||||
* @return bool return true or false after validating the guest profile.
|
||||
*/
|
||||
public function validateGuestInfo()
|
||||
{
|
||||
$isValid = true;
|
||||
if (!trim($this->firstname) || !Validate::isName($this->firstname)) {
|
||||
$isValid = false;
|
||||
}
|
||||
if (!trim($this->lastname) || !Validate::isName($this->lastname)) {
|
||||
$isValid = false;
|
||||
}
|
||||
if (!trim($this->email) || !Validate::isEmail($this->email)) {
|
||||
$isValid = false;
|
||||
}
|
||||
if (!trim($this->phone) || !Validate::isPhoneNumber($this->phone)) {
|
||||
$isValid = false;
|
||||
}
|
||||
|
||||
$className = 'CustomerGuestDetail';
|
||||
$rules = call_user_func(array($className, 'getValidationRules'), $className);
|
||||
|
||||
if (isset($rules['size']['firstname'])) {
|
||||
if (Tools::strlen(trim($this->firstname)) > $rules['size']['firstname']) {
|
||||
$isValid = false;
|
||||
}
|
||||
}
|
||||
if (isset($rules['size']['lastname'])) {
|
||||
if (Tools::strlen(trim($this->lastname)) > $rules['size']['lastname']) {
|
||||
$isValid = false;
|
||||
}
|
||||
}
|
||||
if (isset($rules['size']['email'])) {
|
||||
if (Tools::strlen(trim($this->email)) > $rules['size']['email']) {
|
||||
$isValid = false;
|
||||
}
|
||||
}
|
||||
if (isset($rules['size']['phone'])) {
|
||||
if (Tools::strlen(trim($this->phone)) > $rules['size']['phone']) {
|
||||
$isValid = false;
|
||||
}
|
||||
}
|
||||
|
||||
return $isValid;
|
||||
}
|
||||
}
|
||||
@@ -400,16 +400,16 @@ abstract class PaymentModuleCore extends Module
|
||||
}
|
||||
|
||||
// save customer guest information
|
||||
if ($id_customer_guest_detail = CartCustomerGuestDetail::getCartCustomerGuest($this->context->cart->id)) {
|
||||
if (Validate::isLoadedObject($objCartCustomerGuestDetail = new CartCustomerGuestDetail(
|
||||
$id_customer_guest_detail
|
||||
if ($idCustomerGuestDetail = CustomerGuestDetail::getCustomerGuestIdByIdCart($this->context->cart->id)) {
|
||||
if (Validate::isLoadedObject($objCustomerGuestDetail = new CustomerGuestDetail(
|
||||
$idCustomerGuestDetail
|
||||
))) {
|
||||
$objOrderCustomerGuestDetail = new OrderCustomerGuestDetail();
|
||||
$objOrderCustomerGuestDetail->id_gender = $objCartCustomerGuestDetail->id_gender;
|
||||
$objOrderCustomerGuestDetail->firstname = $objCartCustomerGuestDetail->firstname;
|
||||
$objOrderCustomerGuestDetail->lastname = $objCartCustomerGuestDetail->lastname;
|
||||
$objOrderCustomerGuestDetail->email = $objCartCustomerGuestDetail->email;
|
||||
$objOrderCustomerGuestDetail->phone = $objCartCustomerGuestDetail->phone;
|
||||
$objOrderCustomerGuestDetail->id_gender = $objCustomerGuestDetail->id_gender;
|
||||
$objOrderCustomerGuestDetail->firstname = $objCustomerGuestDetail->firstname;
|
||||
$objOrderCustomerGuestDetail->lastname = $objCustomerGuestDetail->lastname;
|
||||
$objOrderCustomerGuestDetail->email = $objCustomerGuestDetail->email;
|
||||
$objOrderCustomerGuestDetail->phone = $objCustomerGuestDetail->phone;
|
||||
$objOrderCustomerGuestDetail->id_order = (int)$order->id;
|
||||
$objOrderCustomerGuestDetail->save();
|
||||
}
|
||||
@@ -1236,9 +1236,9 @@ abstract class PaymentModuleCore extends Module
|
||||
);
|
||||
}
|
||||
// send mail to customer guest if customer booked for someone other.
|
||||
if ($id_customer_guest_detail = OrderCustomerGuestDetail::isCustomerGuestBooking($order->id)) {
|
||||
if ($idCustomerGuestDetail = OrderCustomerGuestDetail::isCustomerGuestBooking($order->id)) {
|
||||
if ($objOrderCustomerGuestDetail = new OrderCustomerGuestDetail(
|
||||
$id_customer_guest_detail
|
||||
$idCustomerGuestDetail
|
||||
)) {
|
||||
if (Validate::isEmail($objOrderCustomerGuestDetail->email)) {
|
||||
$data['{firstname}'] = $objOrderCustomerGuestDetail->firstname;
|
||||
@@ -1391,7 +1391,7 @@ abstract class PaymentModuleCore extends Module
|
||||
} // End foreach $order_detail_list
|
||||
|
||||
// delete cart feature prices after booking creation success
|
||||
HotelRoomTypeFeaturePricing::deleteFeaturePrices($id_cart);
|
||||
HotelRoomTypeFeaturePricing::deleteByIdCart($id_cart);
|
||||
|
||||
if (count($cart_rules)) {
|
||||
foreach ($cart_rules as $idCartRule => $cartRule) {
|
||||
|
||||
@@ -39,9 +39,9 @@ class CheckoutCustomerDetailsStepCore extends AbstractCheckoutStepCore
|
||||
}
|
||||
} elseif (Tools::getValue('proceed_to_payment')) {
|
||||
$guestInfoComplete = true;
|
||||
if ($id_customer_guest_detail = CartCustomerGuestDetail::getCartCustomerGuest($this->context->cart->id)) {
|
||||
if ($idCustomerGuestDetail = CustomerGuestDetail::getCustomerGuestIdByIdCart($this->context->cart->id)) {
|
||||
$guestInfoComplete = false;
|
||||
$objCustomerGuestDetail = new CartCustomerGuestDetail($id_customer_guest_detail);
|
||||
$objCustomerGuestDetail = new CustomerGuestDetail($idCustomerGuestDetail);
|
||||
if ($objCustomerGuestDetail->validateGuestInfo()) {
|
||||
$guestInfoComplete = true;
|
||||
}
|
||||
|
||||
@@ -579,8 +579,7 @@ class AdminAddressesControllerCore extends AdminController
|
||||
$customer = Customer::searchByName($email);
|
||||
if (!empty($customer)) {
|
||||
$customer = $customer['0'];
|
||||
$phone = Customer::getPhone($customer['id_customer']);
|
||||
echo json_encode(array('infos' => pSQL($customer['firstname']).'_'.pSQL($customer['lastname']).'_'.pSQL($customer['company']).'_'.pSQL($customer['id_customer']).'_'.pSQL($phone)));
|
||||
echo json_encode(array('infos' => pSQL($customer['firstname']).'_'.pSQL($customer['lastname']).'_'.pSQL($customer['company']).'_'.pSQL($customer['id_customer']).'_'.pSQL($customer['phone'])));
|
||||
}
|
||||
}
|
||||
die;
|
||||
|
||||
@@ -121,6 +121,16 @@ class AdminCustomerPreferencesControllerCore extends AdminController
|
||||
'cast' => 'intval',
|
||||
'type' => 'bool'
|
||||
),
|
||||
'PS_CUSTOMER_GUEST_MAX_LIMIT' => array(
|
||||
'title' => $this->l('Maximum Guests per Customer'),
|
||||
'validation' => 'isUnsignedInt',
|
||||
'cast' => 'intval',
|
||||
'size' => 5,
|
||||
'type' => 'text',
|
||||
'class' => 'fixed-width-xl',
|
||||
'hint' => $this->l('Enter the maximum number of guest profiles a customer can create when using the "Booking for Someone Else" option.'),
|
||||
'desc' => $this->l('Set as 0 for no limit.')
|
||||
),
|
||||
),
|
||||
'submit' => array(
|
||||
'title' => $this->l('Save'),
|
||||
|
||||
@@ -975,6 +975,9 @@ class AdminCustomersControllerCore extends AdminController
|
||||
|
||||
$customerLanguage = new Language($customer->id_lang);
|
||||
$shop = new Shop($customer->id_shop);
|
||||
|
||||
$objCustomerGuestDetail = new CustomerGuestDetail();
|
||||
$customerGuests = $objCustomerGuestDetail->getCustomerGuestsByIdCustomer($customer->id);
|
||||
$this->tpl_view_vars = array(
|
||||
'customer' => $customer,
|
||||
'gender' => $gender,
|
||||
@@ -1021,7 +1024,8 @@ class AdminCustomersControllerCore extends AdminController
|
||||
'connections' => $connections,
|
||||
// Referrers
|
||||
'referrers' => $referrers,
|
||||
'show_toolbar' => true
|
||||
'show_toolbar' => true,
|
||||
'customer_guests' => $customerGuests,
|
||||
);
|
||||
return parent::renderView();
|
||||
}
|
||||
@@ -1038,11 +1042,11 @@ class AdminCustomersControllerCore extends AdminController
|
||||
$this->errors[] = Tools::displayError('Some error ocurred while deleting the Customer');
|
||||
return;
|
||||
} else {
|
||||
if ($idCustomerGuest = CartCustomerGuestDetail::getIdCustomerGuest($customerEmail)) {
|
||||
$objCartCustomerGuestDetail = new CartCustomerGuestDetail($idCustomerGuest);
|
||||
$objCartCustomerGuestDetail->phone = preg_replace('/[0-9]/', '0', $objCustomer->phone);
|
||||
$objCartCustomerGuestDetail->email = $objCustomer->email;
|
||||
$objCartCustomerGuestDetail->save();
|
||||
if ($idCustomerGuest = CustomerGuestDetail::getCustomerGuestByEmail($customerEmail, false)) {
|
||||
$objCustomerGuestDetail = new CustomerGuestDetail($idCustomerGuest);
|
||||
$objCustomerGuestDetail->phone = preg_replace('/[0-9]/', '0', $objCustomer->phone);
|
||||
$objCustomerGuestDetail->email = $objCustomer->email;
|
||||
$objCustomerGuestDetail->save();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1220,14 +1224,6 @@ class AdminCustomersControllerCore extends AdminController
|
||||
$this->errors[] = Tools::displayError('Phone number is required.');
|
||||
}
|
||||
}
|
||||
$className = 'CartCustomerGuestDetail';
|
||||
$rules = call_user_func(array($className, 'getValidationRules'), $className);
|
||||
if ($phone && !Validate::isPhoneNumber($phone)) {
|
||||
$this->errors[] = Tools::displayError('Invaid phone number.');
|
||||
} elseif ($phone && Tools::strlen($phone) > $rules['size']['phone']) {
|
||||
$this->errors[] = sprintf(Tools::displayError('Phone number is too long. (%s chars max).'), $rules['size']['phone']);
|
||||
}
|
||||
|
||||
|
||||
$customer = new Customer();
|
||||
$this->errors = array_merge($this->errors, $customer->validateFieldsRequiredDatabase());
|
||||
@@ -1433,17 +1429,128 @@ class AdminCustomersControllerCore extends AdminController
|
||||
$this->ajaxDie(json_encode($response));
|
||||
}
|
||||
|
||||
public function ajaxProcessInitGuestModal()
|
||||
{
|
||||
$response['hasError'] = 1;
|
||||
if (Validate::isLoadedObject($objCustomerGuestDetail = new CustomerGuestDetail((int) Tools::getValue('id_customer_guest_detail')))) {
|
||||
$this->context->smarty->assign(
|
||||
array(
|
||||
'genders' => Gender::getGenders(),
|
||||
'customerGuestDetail' => $objCustomerGuestDetail,
|
||||
)
|
||||
);
|
||||
$modal = array(
|
||||
'modal_id' => 'customer-guest-modal',
|
||||
'modal_class' => 'customer_guest_modal',
|
||||
'modal_title' => '<i class="icon icon-user"></i>  '.$this->l('Guest details'),
|
||||
'modal_content' => $this->context->smarty->fetch('controllers/customers/modals/_customer_guest_form.tpl'),
|
||||
'modal_actions' => array(
|
||||
array(
|
||||
'type' => 'button',
|
||||
'value' => 'submitGuestInfo',
|
||||
'class' => 'submitGuestInfoInfo btn-primary pull-right',
|
||||
'label' => '<i class="icon-user"></i> '.$this->l('Save Guest'),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
$this->context->smarty->assign($modal);
|
||||
$response['hasError'] = 0;
|
||||
$response['modalHtml'] = $this->context->smarty->fetch('modal.tpl');
|
||||
}
|
||||
|
||||
$this->ajaxDie(json_encode($response));
|
||||
}
|
||||
|
||||
|
||||
public function ajaxProcessUpdateGuestDetails()
|
||||
{
|
||||
$response = array('hasError' => 0, 'errors' => array());
|
||||
// Check tab access is allowed to edit
|
||||
if ($this->tabAccess['edit'] == 1) {
|
||||
if (Validate::isLoadedObject($objCustomerGuestDetail = new CustomerGuestDetail((int) Tools::getValue('id_customer_guest_detail')))) {
|
||||
$response['errors'] = $objCustomerGuestDetail->validateController();
|
||||
if (!Tools::getValue('lastname')) {
|
||||
$response['errors']['lastname'] = Tools::displayError('lastname is required');
|
||||
}
|
||||
if (!Tools::getValue('firstname')) {
|
||||
$response['errors']['firstname'] = Tools::displayError('firstname is required');
|
||||
}
|
||||
if (!Tools::getValue('email')) {
|
||||
$response['errors']['email'] = Tools::displayError('email is required');
|
||||
}
|
||||
if (!Tools::getValue('phone')) {
|
||||
$response['errors']['phone'] = Tools::displayError('phone is required');
|
||||
}
|
||||
if (!$response['errors']) {
|
||||
$objCustomerGuestDetail->id_gender = Tools::getValue('id_gender');
|
||||
$objCustomerGuestDetail->firstname = Tools::getValue('firstname');
|
||||
$objCustomerGuestDetail->lastname = Tools::getValue('lastname');
|
||||
$objCustomerGuestDetail->phone = Tools::getValue('phone');
|
||||
if ($objCustomerGuestDetail->save()) {
|
||||
$gender = new Gender($objCustomerGuestDetail->id_gender, $this->context->language->id);
|
||||
$response['data']['gender'] = $gender->name;
|
||||
$response['data']['firstname'] = $objCustomerGuestDetail->firstname;
|
||||
$response['data']['lastname'] = $objCustomerGuestDetail->lastname ;
|
||||
$response['data']['email'] = $objCustomerGuestDetail->email;
|
||||
$response['data']['phone'] = $objCustomerGuestDetail->phone;
|
||||
$response['data']['id'] = $objCustomerGuestDetail->id;
|
||||
$response['msg'] = $this->l('Guest details are updated.');
|
||||
} else {
|
||||
$response['errors'][] = Tools::displayError('Unable to save guest details.');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$response['errors'][] = Tools::displayError('Guest details not found.');
|
||||
}
|
||||
} else {
|
||||
$response['errors'][] = Tools::displayError('You do not have permission to edit this.');
|
||||
}
|
||||
|
||||
if ($response['errors']) {
|
||||
$response['hasError'] = 1;
|
||||
$this->context->smarty->assign('errors', $response['errors']);
|
||||
$response['errorsHtml'] = $this->context->smarty->fetch('alerts.tpl');
|
||||
}
|
||||
|
||||
$this->ajaxDie(json_encode($response));
|
||||
}
|
||||
|
||||
public function ajaxProcessDeleteGuest()
|
||||
{
|
||||
$response = array('hasError' => 1, 'errors' => array());
|
||||
// Check tab access is allowed to edit
|
||||
if ($this->tabAccess['delete'] == 1) {
|
||||
if (Validate::isLoadedObject($objCustomerGuestDetail = new CustomerGuestDetail((int) Tools::getValue('id_customer_guest_detail')))) {
|
||||
if ($objCustomerGuestDetail->delete()) {
|
||||
$response['hasError'] = false;
|
||||
$response['msg'] = $this->l('Successful deletion.');
|
||||
} else {
|
||||
$response['msg'] = $this->l('Unable to delete guest details.');
|
||||
}
|
||||
} else {
|
||||
$response['msg'] = $this->l('Guest details not found.');
|
||||
}
|
||||
} else {
|
||||
$response['msg'] = $this->l('You do not have permission to delete this.');
|
||||
}
|
||||
|
||||
$this->ajaxDie(json_encode($response));
|
||||
}
|
||||
|
||||
public function setMedia()
|
||||
{
|
||||
parent::setMedia();
|
||||
if ($this->loadObject(true)
|
||||
&& ($this->display == 'edit' || $this->display == 'add')
|
||||
&& ($this->display == 'edit' || $this->display == 'add' || $this->display == 'view')
|
||||
) {
|
||||
$idCustomer = $this->object->id ? $this->object->id : 0;
|
||||
Media::addJSDef(
|
||||
array(
|
||||
'customer_controller_url' => self::$currentIndex.'&token='.$this->token,
|
||||
'id_customer' => $idCustomer
|
||||
'id_customer' => $idCustomer,
|
||||
'txtSomeErr' => $this->l('Some error occurred. Please try again.', null, true),
|
||||
'confirmTxt' => $this->l('Are you sure you want to delete this guest details?', null, true)
|
||||
)
|
||||
);
|
||||
$this->addJS(_PS_JS_DIR_.'admin/customers.js');
|
||||
|
||||
@@ -422,16 +422,8 @@ class AuthControllerCore extends FrontController
|
||||
$addresses_types[] = 'address_invoice';
|
||||
}
|
||||
|
||||
$className = 'CartCustomerGuestDetail';
|
||||
$rules = call_user_func(array($className, 'getValidationRules'), $className);
|
||||
if (Configuration::get('PS_ONE_PHONE_AT_LEAST') && !Tools::getValue('phone')) {
|
||||
$this->errors[] = Tools::displayError('Phone number is required.');
|
||||
} else {
|
||||
if (Tools::getValue('phone') && !Validate::isPhoneNumber(Tools::getValue('phone'))) {
|
||||
$this->errors[] = Tools::displayError('Invald phone number.');
|
||||
} elseif (Tools::getValue('phone') && Tools::strlen(Tools::getValue('phone')) > $rules['size']['phone']) {
|
||||
$this->errors[] = sprintf(Tools::displayError('Phone number is too long. (%s chars max).'), $rules['size']['phone']);
|
||||
}
|
||||
}
|
||||
|
||||
if (!Tools::getValue('is_new_customer', 1)) {
|
||||
|
||||
@@ -88,17 +88,9 @@ class IdentityControllerCore extends FrontController
|
||||
$this->errors[] = Tools::displayError('Phone number is required.');
|
||||
}
|
||||
}
|
||||
$className = 'CartCustomerGuestDetail';
|
||||
$rules = call_user_func(array($className, 'getValidationRules'), $className);
|
||||
if ($phone && !Validate::isPhoneNumber($phone)) {
|
||||
$this->errors[] = Tools::displayError('Invaid phone number.');
|
||||
} elseif ($phone && Tools::strlen($phone) > $rules['size']['phone']) {
|
||||
$this->errors[] = sprintf(Tools::displayError('Phone number is too long. (%s chars max).'), $rules['size']['phone']);;
|
||||
} else {
|
||||
$this->customer->phone = $phone;
|
||||
}
|
||||
|
||||
if (!count($this->errors)) {
|
||||
$this->customer->phone = $phone;
|
||||
$this->customer->id_default_group = (int)$prev_id_default_group;
|
||||
$this->customer->firstname = Tools::ucwords($this->customer->firstname);
|
||||
|
||||
|
||||
@@ -119,16 +119,8 @@ class OrderOpcControllerCore extends ParentOrderController
|
||||
if (Configuration::get('PS_ONE_PHONE_AT_LEAST') && !$phone) {
|
||||
$this->errors[] = Tools::displayError('Phone number is a required field.', false);
|
||||
}
|
||||
$className = 'CartCustomerGuestDetail';
|
||||
$rules = call_user_func(array($className, 'getValidationRules'), $className);
|
||||
if (!Validate::isPhoneNumber($phone)) {
|
||||
$this->errors[] = Tools::displayError('Please enter a valid Mobile phone number.', false);
|
||||
} elseif (Tools::strlen($phone) > $rules['size']['phone']) {
|
||||
$this->errors[] = sprintf(Tools::displayError('Mobile phone number is too long. (%s chars max).'), $rules['size']['phone']);
|
||||
} else {
|
||||
$this->context->customer->phone = $phone;
|
||||
}
|
||||
|
||||
$this->context->customer->phone = $phone;
|
||||
$_POST['lastname'] = $_POST['customer_lastname'];
|
||||
$_POST['firstname'] = $_POST['customer_firstname'];
|
||||
$this->errors = array_merge($this->errors, $this->context->customer->validateController());
|
||||
@@ -387,8 +379,8 @@ class OrderOpcControllerCore extends ParentOrderController
|
||||
$this->ajaxDie($this->changeRoomDemands());
|
||||
exit;
|
||||
break;
|
||||
case 'submitCustomerGuestDetail':
|
||||
$this->ajaxDie($this->submitCustomerGuestDetail());
|
||||
case 'getCustomerGuestDetail':
|
||||
$this->ajaxDie($this->getCustomerGuestDetail());
|
||||
exit;
|
||||
break;
|
||||
default:
|
||||
@@ -438,6 +430,10 @@ class OrderOpcControllerCore extends ParentOrderController
|
||||
|
||||
parent::initContent();
|
||||
|
||||
if (Tools::getValue('submitGuestDetails')) {
|
||||
$this->submitCustomerGuestDetail();
|
||||
}
|
||||
|
||||
/* id_carrier is not defined in database before choosing a carrier, set it to a default one to match a potential cart _rule */
|
||||
if (empty($this->context->cart->id_carrier)) {
|
||||
$checked = $this->context->cart->simulateCarrierSelectedOutput();
|
||||
@@ -551,12 +547,12 @@ class OrderOpcControllerCore extends ParentOrderController
|
||||
$this->_assignPayment();
|
||||
// GUEST BOOKING
|
||||
if ($this->isLogged) {
|
||||
if ($id_customer_guest_detail = CartCustomerGuestDetail::getCartCustomerGuest($this->context->cart->id)) {
|
||||
if ($idCustomerGuestDetail = CustomerGuestDetail::getCustomerGuestIdByIdCart($this->context->cart->id)) {
|
||||
$this->context->smarty->assign(
|
||||
'customer_guest_detail', CartCustomerGuestDetail::getCustomerGuestDetail($id_customer_guest_detail)
|
||||
'customer_guest_detail', CustomerGuestDetail::getCustomerGuestDetailById($idCustomerGuestDetail)
|
||||
);
|
||||
}
|
||||
$this->context->smarty->assign('id_customer_guest_detail', $id_customer_guest_detail);
|
||||
$this->context->smarty->assign('id_customer_guest_detail', $idCustomerGuestDetail);
|
||||
}
|
||||
Tools::safePostVars();
|
||||
|
||||
@@ -1069,77 +1065,112 @@ class OrderOpcControllerCore extends ParentOrderController
|
||||
die('0');
|
||||
}
|
||||
|
||||
public function getCustomerGuestDetail()
|
||||
{
|
||||
$response = array('status' => false);
|
||||
$firstname = trim(Tools::getValue('firstname'));
|
||||
$lastname = trim(Tools::getValue('lastname'));
|
||||
$email = trim(Tools::getValue('email'));
|
||||
$objCustomerGuestDetail = new CustomerGuestDetail();
|
||||
if ($guestDetails = $objCustomerGuestDetail->getCustomerGuestsByIdCustomer(
|
||||
$this->context->cart->id_customer,
|
||||
$firstname,
|
||||
$lastname,
|
||||
$email
|
||||
)) {
|
||||
$response['status'] = true;
|
||||
$response['guest_details'] = $guestDetails;
|
||||
}
|
||||
|
||||
return json_encode($response);
|
||||
}
|
||||
|
||||
|
||||
public function submitCustomerGuestDetail()
|
||||
{
|
||||
$customerGuestDetail = Tools::getValue('customer_guest_detail');
|
||||
$this->context->cookie->__set('customer_details_proceeded', 0);
|
||||
$this->context->cookie->checkedTOS = false;
|
||||
if ($customerGuestDetail) {
|
||||
if ($id_customer_guest_detail = CartCustomerGuestDetail::getCartCustomerGuest($this->context->cart->id)) {
|
||||
$objCustomerGuestDetail = new CartCustomerGuestDetail($id_customer_guest_detail);
|
||||
} else {
|
||||
$objCustomerGuestDetail = new CartCustomerGuestDetail();
|
||||
}
|
||||
|
||||
$customerGuestDetailErrors = array();
|
||||
$customerGuestDetailGender = Tools::getValue('customer_guest_detail_gender');
|
||||
$customerGuestDetailFirstname = Tools::getValue('customer_guest_detail_firstname');
|
||||
$customerGuestDetailLastname = Tools::getValue('customer_guest_detail_lastname');
|
||||
$customerGuestDetailEmail = Tools::getValue('customer_guest_detail_email');
|
||||
$customerGuestDetailPhone = Tools::getValue('customer_guest_detail_phone');
|
||||
|
||||
$className = 'CartCustomerGuestDetail';
|
||||
$rules = call_user_func(array($className, 'getValidationRules'), $className);
|
||||
|
||||
if (trim($customerGuestDetailGender) && Validate::isUnsignedInt($customerGuestDetailGender)) {
|
||||
$objCustomerGuestDetail->id_gender = $customerGuestDetailGender;
|
||||
if ($idCustomerGuestDetail = CustomerGuestDetail::getCustomerGuestByEmail($customerGuestDetailEmail, $this->context->cart->id)) {
|
||||
$objCustomerGuestDetail = new CustomerGuestDetail($idCustomerGuestDetail);
|
||||
} else if ($idCustomerGuestDetail = CustomerGuestDetail::getCustomerGuestByEmail($customerGuestDetailEmail, $this->context->customer->id, null)) {
|
||||
$objCustomerGuestDetail = new CustomerGuestDetail($idCustomerGuestDetail);
|
||||
} else {
|
||||
$result['errors']['customer_guest_detail_gender'] = Tools::displayError('Invalid gender');
|
||||
$objCustomerGuestDetail = new CustomerGuestDetail();
|
||||
}
|
||||
|
||||
if (trim($customerGuestDetailFirstname)
|
||||
&& Validate::isName($customerGuestDetailFirstname)
|
||||
&& (!isset($rules['size']['firstname'])
|
||||
$className = 'CustomerGuestDetail';
|
||||
$rules = call_user_func(array($className, 'getValidationRules'), $className);
|
||||
|
||||
if (!(trim($customerGuestDetailGender) || !Validate::isUnsignedInt($customerGuestDetailGender))) {
|
||||
$customerGuestDetailErrors[] = Tools::displayError('Invalid gender');
|
||||
}
|
||||
|
||||
if (!trim($customerGuestDetailFirstname)
|
||||
|| !Validate::isName($customerGuestDetailFirstname)
|
||||
|| !(!isset($rules['size']['firstname'])
|
||||
|| (isset($rules['size']['firstname']) && (Tools::strlen(trim($customerGuestDetailFirstname)) <= $rules['size']['firstname']))
|
||||
)
|
||||
) {
|
||||
$objCustomerGuestDetail->firstname = $customerGuestDetailFirstname;
|
||||
$customerGuestDetailErrors[] = Tools::displayError('Invalid first name');
|
||||
}
|
||||
|
||||
if (trim($customerGuestDetailLastname)
|
||||
&& Validate::isName($customerGuestDetailLastname)
|
||||
&& (!isset($rules['size']['lastname'])
|
||||
if (!trim($customerGuestDetailLastname)
|
||||
|| !Validate::isName($customerGuestDetailLastname)
|
||||
|| !(!isset($rules['size']['lastname'])
|
||||
|| (isset($rules['size']['lastname']) && (Tools::strlen(trim($customerGuestDetailLastname)) <= $rules['size']['lastname']))
|
||||
)
|
||||
) {
|
||||
$objCustomerGuestDetail->lastname = $customerGuestDetailLastname;
|
||||
$customerGuestDetailErrors[] = Tools::displayError('Invalid last name');
|
||||
}
|
||||
|
||||
if (trim($customerGuestDetailEmail)
|
||||
&& Validate::isEmail($customerGuestDetailEmail)
|
||||
&& (!isset($rules['size']['email'])
|
||||
if (!trim($customerGuestDetailEmail)
|
||||
|| !Validate::isEmail($customerGuestDetailEmail)
|
||||
|| !(!isset($rules['size']['email'])
|
||||
|| (isset($rules['size']['email']) && (Tools::strlen(trim($customerGuestDetailEmail)) <= $rules['size']['email']))
|
||||
)
|
||||
) {
|
||||
$objCustomerGuestDetail->email = $customerGuestDetailEmail;
|
||||
$customerGuestDetailErrors[] = Tools::displayError('Invalid email');
|
||||
}
|
||||
|
||||
if (trim($customerGuestDetailPhone)
|
||||
&& Validate::isPhoneNumber($customerGuestDetailPhone)
|
||||
&& (!isset($rules['size']['phone'])
|
||||
if (!trim($customerGuestDetailPhone)
|
||||
|| !Validate::isPhoneNumber($customerGuestDetailPhone)
|
||||
|| !(!isset($rules['size']['phone'])
|
||||
|| (isset($rules['size']['phone']) && (Tools::strlen(trim($customerGuestDetailPhone)) <= $rules['size']['phone']))
|
||||
)
|
||||
) {
|
||||
$objCustomerGuestDetail->phone = $customerGuestDetailPhone;
|
||||
$customerGuestDetailErrors[] = Tools::displayError('Invalid phone');
|
||||
}
|
||||
|
||||
$objCustomerGuestDetail->id_cart = $this->context->cart->id;
|
||||
$objCustomerGuestDetail->save();
|
||||
} else {
|
||||
if ($id_customer_guest_detail = CartCustomerGuestDetail::getCartCustomerGuest($this->context->cart->id)) {
|
||||
if (Validate::isLoadedObject($objCustomerGuestDetail = new CartCustomerGuestDetail($id_customer_guest_detail))) {
|
||||
$objCustomerGuestDetail->delete();
|
||||
if (empty($customerGuestDetailErrors)) {
|
||||
$objCustomerGuestDetail->id_gender = $customerGuestDetailGender;
|
||||
$objCustomerGuestDetail->firstname = $customerGuestDetailFirstname;
|
||||
$objCustomerGuestDetail->lastname = $customerGuestDetailLastname;
|
||||
$objCustomerGuestDetail->email = $customerGuestDetailEmail;
|
||||
$objCustomerGuestDetail->phone = $customerGuestDetailPhone;
|
||||
$objCustomerGuestDetail->id_customer = $this->context->customer->id;
|
||||
if ($objCustomerGuestDetail->save()) {
|
||||
if ($maxGuestAccountAllowed = Configuration::get('PS_CUSTOMER_GUEST_MAX_LIMIT')) {
|
||||
$objCustomerGuestDetail->deleteCustomerGuestByIdCustomer($this->context->cart->id_customer, $maxGuestAccountAllowed);
|
||||
}
|
||||
// To prevent duplications for the same cart.
|
||||
$objCustomerGuestDetail->deleteCustomerGuestInCart($this->context->cart->id);
|
||||
$objCustomerGuestDetail->saveCustomerGuestInCart($this->context->cart->id, $objCustomerGuestDetail->id);
|
||||
Tools::redirect($this->context->link->getPageLink('order-opc', null, $this->context->language->id, array('proceed_to_payment' => 1)));
|
||||
}
|
||||
}
|
||||
|
||||
$this->context->smarty->assign('customerGuestDetailErrors', $customerGuestDetailErrors);
|
||||
} else {
|
||||
CustomerGuestDetail::deleteCustomerGuestInCart($this->context->cart->id);
|
||||
Tools::redirect($this->context->link->getPageLink('order-opc', null, $this->context->language->id, array('proceed_to_payment' => 1)));
|
||||
}
|
||||
|
||||
$this->context->cart->save();
|
||||
|
||||
@@ -687,9 +687,9 @@ CREATE TABLE `PREFIX_order_customer_guest_detail` (
|
||||
PRIMARY KEY (`id_order_customer_guest_detail`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8 COLLATION;
|
||||
|
||||
CREATE TABLE `PREFIX_cart_customer_guest_detail` (
|
||||
CREATE TABLE `PREFIX_customer_guest_detail` (
|
||||
`id_customer_guest_detail` int(10) unsigned NOT NULL auto_increment,
|
||||
`id_cart` int(10) unsigned NOT NULL,
|
||||
`id_customer` int(10) unsigned NOT NULL,
|
||||
`id_gender` int(10) unsigned NOT NULL,
|
||||
`firstname` varchar(32) NOT NULL,
|
||||
`lastname` varchar(32) NOT NULL,
|
||||
@@ -700,6 +700,12 @@ CREATE TABLE `PREFIX_cart_customer_guest_detail` (
|
||||
PRIMARY KEY (`id_customer_guest_detail`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8 COLLATION;
|
||||
|
||||
CREATE TABLE `PREFIX_cart_customer_guest` (
|
||||
`id_customer_guest_detail` int(10) unsigned NOT NULL,
|
||||
`id_cart` int(10) unsigned NOT NULL,
|
||||
PRIMARY KEY (`id_customer_guest_detail`, `id_cart`)
|
||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8 COLLATION;
|
||||
|
||||
CREATE TABLE `PREFIX_customization` (
|
||||
`id_customization` int(10) unsigned NOT NULL auto_increment,
|
||||
`id_product_attribute` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
|
||||
@@ -955,6 +955,9 @@
|
||||
</configuration>
|
||||
<configuration id="PS_BACKDATE_ORDER_EMPLOYEES" name="PS_BACKDATE_ORDER_EMPLOYEES">
|
||||
<value>0</value>
|
||||
</configuration>
|
||||
<configuration id="PS_CUSTOMER_GUEST_MAX_LIMIT" name="PS_CUSTOMER_GUEST_MAX_LIMIT">
|
||||
<value>5</value>
|
||||
</configuration>
|
||||
</entities>
|
||||
</entity_configuration>
|
||||
|
||||
@@ -48,4 +48,129 @@ $(document).ready(function() {
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on('click', '.edit-customer-guest-detail', function(e) {
|
||||
e.preventDefault();
|
||||
GuestModal.show($(this).data('id_customer_guest_detail'));
|
||||
});
|
||||
$(document).on('click', '.delete-customer-guest-detail', function(e) {
|
||||
e.preventDefault();
|
||||
if (confirm(confirmTxt)) {
|
||||
GuestModal.deleteGuest($(this).data('id_customer_guest_detail'));
|
||||
}
|
||||
});
|
||||
|
||||
const GuestModal = {
|
||||
show: function(id_customer_guest_detail) {
|
||||
$("#page-loader").show();
|
||||
$('#customer-guest-modal').remove();
|
||||
$.ajax({
|
||||
url: customer_controller_url,
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
ajax : 1,
|
||||
id_customer_guest_detail: id_customer_guest_detail,
|
||||
action: 'InitGuestModal'
|
||||
},
|
||||
beforeSend: function() {
|
||||
$("#page-loader").show();
|
||||
},
|
||||
success: function(result) {
|
||||
if (result.hasError == 0 && result.modalHtml) {
|
||||
$('#footer').next('.bootstrap').append(result.modalHtml);
|
||||
$('#customer-guest-modal').modal('show');
|
||||
} else {
|
||||
showErrorMessage(txtSomeErr);
|
||||
}
|
||||
},
|
||||
complete: function() {
|
||||
$("#page-loader").hide();
|
||||
}
|
||||
});
|
||||
},
|
||||
close: function() {
|
||||
$('#customer-guest-modal').modal('hide');
|
||||
},
|
||||
submit: function() {
|
||||
$("#page-loader").show();
|
||||
GuestModal.hideErrors();
|
||||
$.ajax({
|
||||
headers: {
|
||||
"cache-control": "no-cache"
|
||||
},
|
||||
url: customer_controller_url,
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
cache: false,
|
||||
data: $('#customer-guest-details-form').serialize()+'&ajax=true&action=updateGuestDetails',
|
||||
success: function(result) {
|
||||
if (result.hasError == true) {
|
||||
GuestModal.showErrors(result.errorsHtml);
|
||||
} else {
|
||||
if (result.msg) {
|
||||
showSuccessMessage(result.msg);
|
||||
}
|
||||
let tr = $('<tr>');
|
||||
tr.append('<td>' + result.data.email + '</td>')
|
||||
.append('<td>' + result.data.firstname + '</td>')
|
||||
.append('<td>' + result.data.lastname + '</td>')
|
||||
.append('<td>' + result.data.phone + '</td>')
|
||||
.append('<td><a class="edit-customer-guest-detail" data-id_customer_guest_detail="'+result.data.id+'"><i class="icon-pencil"></i></a></td>')
|
||||
.append('<td><a class="delete-customer-guest-detail" data-id_customer_guest_detail="'+result.data.id+'"><i class="icon-trash"></i></a></td>');
|
||||
$('.customer_guest_detail_'+result.data.id).html($(tr).html());
|
||||
}
|
||||
},
|
||||
complete: function() {
|
||||
$("#page-loader").hide();
|
||||
}
|
||||
});
|
||||
},
|
||||
deleteGuest: function(id_customer_guest_detail) {
|
||||
$("#page-loader").show();
|
||||
GuestModal.hideErrors();
|
||||
$.ajax({
|
||||
headers: {
|
||||
"cache-control": "no-cache"
|
||||
},
|
||||
url: customer_controller_url,
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
cache: false,
|
||||
data: {
|
||||
ajax : 1,
|
||||
id_customer_guest_detail: id_customer_guest_detail,
|
||||
action: 'DeleteGuest'
|
||||
},
|
||||
success: function(result) {
|
||||
if (result.hasError == true) {
|
||||
showErrorMessage(result.msg);
|
||||
} else if (result.msg) {
|
||||
showSuccessMessage(result.msg);
|
||||
$('.customer_guest_detail_'+id_customer_guest_detail).remove();
|
||||
if ($('.customer_guest_details').length == 0) {
|
||||
$('.customer-guests').closest('.panel').hide();
|
||||
} else {
|
||||
$('.customer-guests-count').text(parseInt($('.customer_guest_details').length));
|
||||
}
|
||||
}
|
||||
},
|
||||
complete: function() {
|
||||
$("#page-loader").hide();
|
||||
}
|
||||
});
|
||||
},
|
||||
showErrors: function(errorsHtml) {
|
||||
$('#customer-guest-modal .errors-wrap').html(errorsHtml);
|
||||
$('#customer-guest-modal .errors-wrap').show(200);
|
||||
},
|
||||
hideErrors: function(cb) {
|
||||
$('#customer-guest-modal .errors-wrap').hide(200);
|
||||
$('#customer-guest-modal .errors-wrap').html('');
|
||||
}
|
||||
};
|
||||
$(document).on('click', '.submitGuestInfoInfo', function(e) {
|
||||
e.preventDefault();
|
||||
GuestModal.submit();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-12 search_result_info">
|
||||
{$search_data['htl_dtl']['hotel_name']|escape:'htmlall':'UTF-8'}, {$search_data['htl_dtl']['city']|escape:'htmlall':'UTF-8'} {if !$search_data['order_date_restrict']}<img src="{$module_dir}views/img/icon-arrow-left.svg"> {$search_data['date_from']|escape:'htmlall':'UTF-8'|date_format:"%d %b %Y"} - {$search_data['date_to']|escape:'htmlall':'UTF-8'|date_format:"%d %b %Y"}<span class="faded-txt"> ({1+$search_data['num_days']|escape:'htmlall':'UTF-8'} {l s='Days' mod='wkroomsearchblock'} {$search_data['num_days']|escape:'htmlall':'UTF-8'} {if $search_data['num_days'] > 1}{l s='Nights' mod='wkroomsearchblock'}{else}{l s='Night' mod='wkroomsearchblock'}{/if})</span> {/if}
|
||||
{$search_data['htl_dtl']['hotel_name']|escape:'htmlall':'UTF-8'}, {$search_data['htl_dtl']['city']|escape:'htmlall':'UTF-8'} {if !$search_data['order_date_restrict']}<img src="{$module_dir}views/img/icon-arrow-left.svg"> {if (isset($search_data['date_from']))}{$search_data['date_from']|escape:'htmlall':'UTF-8'|date_format:"%d %b %Y"}{/if} - {if isset($search_data['date_to'])}{$search_data['date_to']|escape:'htmlall':'UTF-8'|date_format:"%d %b %Y"}{/if}<span class="faded-txt"> ({1+$search_data['num_days']|escape:'htmlall':'UTF-8'} {l s='Days' mod='wkroomsearchblock'} {$search_data['num_days']|escape:'htmlall':'UTF-8'} {if $search_data['num_days'] > 1}{l s='Nights' mod='wkroomsearchblock'}{else}{l s='Night' mod='wkroomsearchblock'}{/if})</span> {/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -682,3 +682,29 @@
|
||||
line-height: 19px;
|
||||
color: #333;
|
||||
margin-bottom: 15px; }
|
||||
|
||||
/* Customer guest suggetions Css */
|
||||
.customer_guest_detail_ul {
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
max-height: 200px;
|
||||
background: #fff;
|
||||
z-index: 10;
|
||||
box-shadow: 0 4px 5px rgba(0, 0, 0, 0.15);
|
||||
position: absolute;
|
||||
width: 90%;}
|
||||
.customer_guest_detail_email_list{
|
||||
width: 92%;}
|
||||
.customer_guest_detail_li {
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
padding: 10px;}
|
||||
.customer_guest_detail_li.active {
|
||||
color: #fff;
|
||||
background-color: #379bf0;}
|
||||
.customer_guest_detail_li:hover {
|
||||
cursor: pointer;
|
||||
background-color: #379bf0;
|
||||
color: #fff;}
|
||||
|
||||
@@ -94,9 +94,11 @@ $(document).ready(function()
|
||||
if ($("#customer_guest_detail:checked").val() == 1) {
|
||||
$('#checkout-guest-info-block').hide('slow');
|
||||
$('#customer-guest-detail-container').show('slow');
|
||||
$('#customer_guest_detail_errors').show('slow');
|
||||
} else {
|
||||
$('#customer-guest-detail-container').hide('slow');
|
||||
$('#checkout-guest-info-block').show('slow');
|
||||
$('#customer_guest_detail_errors').hide('hide');
|
||||
}
|
||||
}
|
||||
function validateCustomerGuestDetailForm() {
|
||||
@@ -115,16 +117,148 @@ $(document).ready(function()
|
||||
if ($("#customer_guest_detail:checked").val() == 1) {
|
||||
validateCustomerGuestDetailForm();
|
||||
}
|
||||
$(document).on('click', '.submit-guest-details', function(e) {
|
||||
e.preventDefault();
|
||||
if ($('#customer_guest_detail').prop('checked')) {
|
||||
validateCustomerGuestDetailForm();
|
||||
if ($('#customer_guest_detail_form').find('.form-error').length == 0) {
|
||||
$('#customer_guest_detail_form').get(0).submit();
|
||||
}
|
||||
} else {
|
||||
$('#customer_guest_detail_form').get(0).submit();
|
||||
}
|
||||
});
|
||||
|
||||
$('#customer_guest_detail_form').on('change', function(e) {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: orderOpcUrl,
|
||||
async: false,
|
||||
cache: false,
|
||||
dataType : "json",
|
||||
data: $(this).serialize()+'&method=submitCustomerGuestDetail&ajax=true&token=' + static_token
|
||||
});
|
||||
function setCustomerGuestDetailForm(guestDetail) {
|
||||
$('#customer_guest_detail_firstname').val(guestDetail.firstname);
|
||||
$('#customer_guest_detail_lastname').val(guestDetail.lastname);
|
||||
$('#customer_guest_detail_email').val(guestDetail.email);
|
||||
$('#customer_guest_detail_phone').val(guestDetail.phone);
|
||||
validateCustomerGuestDetailForm();
|
||||
$('.customer_guest_detail_ul').remove();
|
||||
}
|
||||
|
||||
$(document).on('keyup', function(e) {
|
||||
if (!$(e.target).attr('id') == 'customer_guest_detail_firstname'
|
||||
|| !$(e.target).attr('id') == 'customer_guest_detail_lastname'
|
||||
|| !$(e.target).attr('id') == 'customer_guest_detail_email'
|
||||
) {
|
||||
$('.customer_guest_detail_ul').remove();
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on('click', function(e) {
|
||||
if ($(e.target).hasClass('customer_guest_detail_li')) {
|
||||
let guestDetail = $(e.target).data('guest_detail');
|
||||
setCustomerGuestDetailForm(guestDetail);
|
||||
}
|
||||
|
||||
$('.customer_guest_detail_ul').remove();
|
||||
});
|
||||
let debounceTimeout;
|
||||
$(document).on('keyup', '#customer_guest_detail_firstname, #customer_guest_detail_lastname, #customer_guest_detail_email', function(e) {
|
||||
var keyCode = e.keyCode || e.which;
|
||||
if (keyCode == 40 || keyCode == 38) {
|
||||
let activeElem = $(".customer_guest_detail_ul .active");
|
||||
let newActiveElem;
|
||||
if (activeElem.length) {
|
||||
if (keyCode == 40) {
|
||||
newActiveElem = activeElem.next("li");
|
||||
if (!newActiveElem.length) {
|
||||
newActiveElem = $(".customer_guest_detail_ul li:first"); // Loop back to first
|
||||
}
|
||||
} else if (keyCode == 38) {
|
||||
newActiveElem = activeElem.prev("li");
|
||||
if (!newActiveElem.length) {
|
||||
newActiveElem = $(".customer_guest_detail_ul li:last"); // Loop back to last
|
||||
}
|
||||
}
|
||||
} else {
|
||||
newActiveElem = keyCode == 40 ? $(".customer_guest_detail_ul li:first") : $(".customer_guest_detail_ul li:last");
|
||||
}
|
||||
|
||||
activeElem.removeClass("active");
|
||||
newActiveElem.addClass("active");
|
||||
|
||||
return;
|
||||
} else if (keyCode == 13) {
|
||||
if ($('.customer_guest_detail_ul .active').length != 0) {
|
||||
let guestDetail = $('.customer_guest_detail_ul .active').data('guest_detail');
|
||||
setCustomerGuestDetailForm(guestDetail);
|
||||
}
|
||||
} else if (!((keyCode < 65 || keyCode > 122) && (keyCode < 48 || keyCode > 57) && (keyCode != 8))) {
|
||||
clearTimeout(debounceTimeout); // Clear the existing timeout
|
||||
debounceTimeout = setTimeout(() => {
|
||||
let firstName = '';
|
||||
let lastName = '';
|
||||
let email = '';
|
||||
if ($(e.target).prop('id') == 'customer_guest_detail_firstname') {
|
||||
firstName = $('#customer_guest_detail_firstname').val();
|
||||
} else if ($(e.target).prop('id') == 'customer_guest_detail_lastname') {
|
||||
lastName = $('#customer_guest_detail_lastname').val();
|
||||
} else if ($(e.target).prop('id') == 'customer_guest_detail_email') {
|
||||
email = $('#customer_guest_detail_email').val();
|
||||
}
|
||||
|
||||
let targetElem = $(this);
|
||||
if ($.trim($(targetElem).val()) != '') {
|
||||
customerGuestDetailAjax = $.ajax({
|
||||
type: 'POST',
|
||||
url: orderOpcUrl,
|
||||
async: false,
|
||||
cache: false,
|
||||
dataType : "json",
|
||||
data: {
|
||||
token : static_token,
|
||||
ajax : true,
|
||||
method : 'getCustomerGuestDetail',
|
||||
firstname : firstName,
|
||||
lastname : lastName,
|
||||
email : email,
|
||||
},
|
||||
success: function(data) {
|
||||
$('.customer_guest_detail_ul').remove();
|
||||
if (data.status) {
|
||||
let listElem = $('<ul>').addClass('customer_guest_detail_ul');
|
||||
$.each(data.guest_details, function(index, guest_detail) {
|
||||
let itemElem = $('<li>').addClass('customer_guest_detail_li').text(guest_detail.firstname + ' '+ guest_detail.lastname + ' ('+ guest_detail.email+')');
|
||||
$(itemElem).attr('data-guest_detail', JSON.stringify(guest_detail));
|
||||
$(listElem).append(itemElem);
|
||||
});
|
||||
if ($(targetElem).prop('id') == 'customer_guest_detail_email') {
|
||||
$(listElem).addClass('customer_guest_detail_email_list');
|
||||
}
|
||||
$(targetElem).closest('.form-group').append($(listElem).prop('outerHTML'));
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$('.customer_guest_detail_ul').remove();
|
||||
}
|
||||
}, 200);
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on('keydown', '.customer_guest_detail_ul li', function(e) {
|
||||
if (e.which == 40 || e.which == 38) {
|
||||
var ulElement = $(this).closest('ul');
|
||||
var ulLength = ulElement.find('li').length;
|
||||
$(this).blur();
|
||||
ulElement.scrollTop($(this).index() * $(this).outerHeight());
|
||||
if (e.which == 40) {
|
||||
if ($(this).index() != (ulLength - 1)) {
|
||||
$(this).next('li.customer_guest_detail_li').focus();
|
||||
} else {
|
||||
ulElement.find('li:first').focus();
|
||||
}
|
||||
} else if (e.which == 38) {
|
||||
if ($(this).index()) {
|
||||
$(this).prev('li.customer_guest_detail_li').focus();
|
||||
} else {
|
||||
ulElement.find('li:last').focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// GUEST CHECKOUT / NEW ACCOUNT MANAGEMENT
|
||||
|
||||
@@ -98,11 +98,22 @@
|
||||
{if $is_logged || $isGuest}
|
||||
{if $is_logged}
|
||||
{block name='order_opc_guest_detail_form'}
|
||||
<form id="customer_guest_detail_form">
|
||||
<form id="customer_guest_detail_form" method="post" action="{$link->getPageLink('order-opc', null, null)}">
|
||||
<input type="hidden" name="submitGuestDetails" value="1">
|
||||
<p class="checkbox">
|
||||
<input type="checkbox" name="customer_guest_detail" id="customer_guest_detail" value="1" {if $id_customer_guest_detail}checked="checked"{/if}/>
|
||||
<label for="customer_guest_detail" id="customer_guest_detail_txt">{l s='Booking for someone else?'}</label>
|
||||
</p>
|
||||
{if isset($customerGuestDetailErrors) && $customerGuestDetailErrors}
|
||||
<div class="alert alert-danger" id="customer_guest_detail_errors">
|
||||
<p>{if $customerGuestDetailErrors|@count > 1}{l s='There are %d errors' sprintf=$customerGuestDetailErrors|@count}{else}{l s='There is %d error' sprintf=$customerGuestDetailErrors|@count}{/if}</p>
|
||||
<ol>
|
||||
{foreach from=$customerGuestDetailErrors key=k item=customerGuestDetailError}
|
||||
<li>{$customerGuestDetailError}</li>
|
||||
{/foreach}
|
||||
</ol>
|
||||
</div>
|
||||
{/if}
|
||||
<div id="customer-guest-detail-container" {if !$id_customer_guest_detail}style="display: none;"{/if}>
|
||||
<div class="row">
|
||||
<div class="required clearfix gender-line col-sm-2">
|
||||
@@ -173,7 +184,7 @@
|
||||
<hr>
|
||||
<div class="row">
|
||||
<div class="col-sm-12 proceed_btn_block">
|
||||
<a class="btn btn-default button button-medium pull-right" href="{$link->getPageLink('order-opc', null, null, ['proceed_to_payment' => 1])}" title="Proceed to Payment" rel="nofollow">
|
||||
<a class="btn btn-default button button-medium pull-right submit-guest-details" href="{$link->getPageLink('order-opc', null, null, ['proceed_to_payment' => 1])}" title="Proceed to Payment" rel="nofollow">
|
||||
<span>
|
||||
{l s='Proceed'}
|
||||
</span>
|
||||
|
||||
Reference in New Issue
Block a user