Merge pull request #1051 from shreesh-webkul/gli-2087
Fixed: Customer phone number not saving during account creation
This commit is contained in:
@@ -71,6 +71,7 @@
|
||||
$('input[name=lastname]').val(infos[1]);
|
||||
$('input[name=company]').val(infos[2]);
|
||||
$('input[name=id_customer]').val(infos[3]);
|
||||
$('input[name=phone]').val(infos[4]);
|
||||
} else {
|
||||
resetCustomerRelatedAddressFields();
|
||||
}
|
||||
|
||||
@@ -54,6 +54,12 @@
|
||||
<p class="form-control-static">{if $gender->name}{$gender->name}{else}{l s='Unknown'}{/if}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label class="control-label col-lg-3">{l s='Phone'}</label>
|
||||
<div class="col-lg-9">
|
||||
<p class="form-control-static">{$customer->phone}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label class="control-label col-lg-3">{l s='Age'}</label>
|
||||
<div class="col-lg-9">
|
||||
|
||||
@@ -554,11 +554,10 @@
|
||||
|
||||
<dd><i class="icon-user"></i> <b><a href="?tab=AdminCustomers&id_customer={$customer->id}&viewcustomer&token={getAdminToken tab='AdminCustomers'}">{$customer->firstname} {$customer->lastname}</a></b></dd>
|
||||
<dd><i class="icon-envelope"></i> <b><a href="mailto:{$customer->email}">{$customer->email}</a></b></dd>
|
||||
{if $addresses.invoice->phone_mobile || $addresses.invoice->phone}
|
||||
<dd><i class="icon-phone"></i> <b><a href="tel:{if $addresses.invoice->phone_mobile}{$addresses.invoice->phone_mobile}{else}{$addresses.invoice->phone}{/if}">{if $addresses.invoice->phone_mobile}{$addresses.invoice->phone_mobile}{else}{$addresses.invoice->phone}{/if}</a></b></dd>
|
||||
{if $customer->phone}
|
||||
<dd><i class="icon-phone"></i> <b><a href="tel:{$customer->phone}">{$customer->phone}</a></b></dd>
|
||||
{/if}
|
||||
</dl>
|
||||
|
||||
<form method="post" action="index.php?tab=AdminCustomers&id_customer={$customer->id}&id_order={$order->id|intval}&token={getAdminToken tab='AdminCustomers'}">
|
||||
<input type="hidden" name="id_lang" value="{$order->id_lang}" />
|
||||
<input class="btn btn-primary" type="submit" name="submitGuestToCustomer" value="{l s='Transform this guest into a customer'}" />
|
||||
@@ -575,8 +574,8 @@
|
||||
|
||||
<dd><i class="icon-user"></i> <b><a href="?tab=AdminCustomers&id_customer={$customer->id}&viewcustomer&token={getAdminToken tab='AdminCustomers'}">{$customer->firstname} {$customer->lastname}</a></b></dd>
|
||||
<dd><i class="icon-envelope"></i> <b><a href="mailto:{$customer->email}">{$customer->email}</a></b></dd>
|
||||
{if $addresses.invoice->phone_mobile || $addresses.invoice->phone}
|
||||
<dd><i class="icon-phone"></i> <b><a href="tel:{if $addresses.invoice->phone_mobile}{$addresses.invoice->phone_mobile}{else}{$addresses.invoice->phone}{/if}">{if $addresses.invoice->phone_mobile}{$addresses.invoice->phone_mobile}{else}{$addresses.invoice->phone}{/if}</a></b></dd>
|
||||
{if $customer->phone}
|
||||
<dd><i class="icon-phone"></i> <b><a href="tel:{$customer->phone}">{$customer->phone}</a></b></dd>
|
||||
{/if}
|
||||
</dl>
|
||||
<dl class="list-detail col-sm-6">
|
||||
|
||||
@@ -63,6 +63,45 @@ class CartCustomerGuestDetailCore extends ObjectModel
|
||||
);
|
||||
}
|
||||
|
||||
public static function getCustomerDefaultDetails($email)
|
||||
{
|
||||
return Db::getInstance()->getRow(
|
||||
'SELECT * FROM `'._DB_PREFIX_.'cart_customer_guest_detail`
|
||||
WHERE `id_cart` = 0 AND `email` = "'.pSQL($email).'"'
|
||||
);
|
||||
}
|
||||
|
||||
public static function updateCustomerPhoneNumber($email, $phone)
|
||||
{
|
||||
if ($customerDetail = self::getCustomerDefaultDetails($email)) {
|
||||
$objCartCustomerGuestDetail = new CartCustomerGuestDetail($customerDetail['id_customer_guest_detail']);
|
||||
$objCartCustomerGuestDetail->phone = $phone;
|
||||
return $objCartCustomerGuestDetail->save();
|
||||
} else {
|
||||
$objCustomer = new Customer();
|
||||
if (Validate::isLoadedObject($customer = $objCustomer->getByEmail($email, null, false))) {
|
||||
$objCartCustomerGuestDetail = new CartCustomerGuestDetail();
|
||||
$objCartCustomerGuestDetail->id_cart = 0;
|
||||
$objCartCustomerGuestDetail->id_gender = $customer->id_gender;
|
||||
$objCartCustomerGuestDetail->firstname = $customer->firstname;
|
||||
$objCartCustomerGuestDetail->lastname = $customer->lastname;
|
||||
$objCartCustomerGuestDetail->email = $customer->email;
|
||||
$objCartCustomerGuestDetail->phone = $phone;
|
||||
return $objCartCustomerGuestDetail->save();
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
@@ -135,6 +135,8 @@ class CustomerCore extends ObjectModel
|
||||
|
||||
public $groupBox;
|
||||
|
||||
public $phone;
|
||||
|
||||
const STATUS_BANNED = 1;
|
||||
const STATUS_DELETED = 2;
|
||||
|
||||
@@ -202,6 +204,10 @@ class CustomerCore extends ObjectModel
|
||||
{
|
||||
$this->id_default_group = (int)Configuration::get('PS_CUSTOMER_GROUP');
|
||||
parent::__construct($id);
|
||||
|
||||
if ($this->email) {
|
||||
$this->phone = CartCustomerGuestDetail::getCustomerPhone($this->email);
|
||||
}
|
||||
}
|
||||
|
||||
public function add($autodate = true, $null_values = true)
|
||||
@@ -484,6 +490,18 @@ 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;
|
||||
|
||||
@@ -1163,16 +1163,6 @@ abstract class PaymentModuleCore extends Module
|
||||
$this->context->currency,
|
||||
false
|
||||
),
|
||||
'{delivery_block_txt}' => $this->_getFormatedAddress($delivery, "\n"),
|
||||
'{invoice_block_txt}' => $this->_getFormatedAddress($invoice, "\n"),
|
||||
'{delivery_block_html}' => $this->_getFormatedAddress($delivery, '<br />', array(
|
||||
'firstname' => '<span style="font-weight:bold;">%s</span>',
|
||||
'lastname' => '<span style="font-weight:bold;">%s</span>'
|
||||
)),
|
||||
'{invoice_block_html}' => $this->_getFormatedAddress($invoice, '<br />', array(
|
||||
'firstname' => '<span style="font-weight:bold;">%s</span>',
|
||||
'lastname' => '<span style="font-weight:bold;">%s</span>'
|
||||
)),
|
||||
'{delivery_company}' => $delivery->company,
|
||||
'{delivery_firstname}' => $delivery->firstname,
|
||||
'{delivery_lastname}' => $delivery->lastname,
|
||||
|
||||
@@ -534,7 +534,7 @@ class ValidateCore
|
||||
*/
|
||||
public static function isPhoneNumber($number)
|
||||
{
|
||||
return preg_match('/^[+0-9. ()-]*$/', $number);
|
||||
return preg_match('/^\+?[\s\d.()-]*\d+$/', $number);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -544,7 +544,8 @@ class AdminAddressesControllerCore extends AdminController
|
||||
$customer = Customer::searchByName($email);
|
||||
if (!empty($customer)) {
|
||||
$customer = $customer['0'];
|
||||
echo json_encode(array('infos' => pSQL($customer['firstname']).'_'.pSQL($customer['lastname']).'_'.pSQL($customer['company']).'_'.pSQL($customer['id_customer'])));
|
||||
$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)));
|
||||
}
|
||||
}
|
||||
die;
|
||||
|
||||
@@ -64,7 +64,7 @@ class AdminCustomerPreferencesControllerCore extends AdminController
|
||||
),
|
||||
'PS_ONE_PHONE_AT_LEAST' => array(
|
||||
'title' => $this->l('Phone number is mandatory'),
|
||||
'hint' => $this->l('If you chose yes, your customer will have to provide at least one phone number to register.'),
|
||||
'hint' => $this->l('If you chose yes, your customer will have to provide phone number to register.'),
|
||||
'validation' => 'isBool',
|
||||
'cast' => 'intval',
|
||||
'type' => 'bool'
|
||||
|
||||
@@ -431,6 +431,15 @@ class AdminCustomersControllerCore extends AdminController
|
||||
'required' => true,
|
||||
'autocomplete' => false
|
||||
),
|
||||
array(
|
||||
'type' => 'text',
|
||||
'prefix' => '<i class="icon-phone"></i>',
|
||||
'label' => $this->l('Phone'),
|
||||
'name' => 'phone',
|
||||
'col' => '4',
|
||||
'required' => true,
|
||||
'autocomplete' => false
|
||||
),
|
||||
array(
|
||||
'type' => 'password',
|
||||
'label' => $this->l('Password'),
|
||||
@@ -990,11 +999,19 @@ class AdminCustomersControllerCore extends AdminController
|
||||
// If customer is going to be deleted permanently then if customer has orders the change this customer as an anonymous customer
|
||||
if (Validate::isLoadedObject($objCustomer = $this->loadObject())) {
|
||||
if ($this->delete_mode == 'real' && Order::getCustomerOrders($objCustomer->id, true)) {
|
||||
$customerEmail = $objCustomer->email;
|
||||
$objCustomer->email = 'anonymous'.'-'.$objCustomer->id.'@'.Tools::link_rewrite(Configuration::get('PS_SHOP_NAME')).'_anonymous.com';
|
||||
$objCustomer->deleted = Customer::STATUS_DELETED;
|
||||
if (!$objCustomer->update()) {
|
||||
$this->errors[] = Tools::displayError('Some error ocurred while deleting the Customer');
|
||||
return;
|
||||
} else {
|
||||
if ($customerDetail = CartCustomerGuestDetail::getCustomerDefaultDetails($customerEmail)) {
|
||||
$objCartCustomerGuestDetail = new CartCustomerGuestDetail($customerDetail['id_customer_guest_detail']);
|
||||
$objCartCustomerGuestDetail->phone = preg_replace('/[0-9]/', '0', $objCustomer->phone);
|
||||
$objCartCustomerGuestDetail->email = $objCustomer->email;
|
||||
$objCartCustomerGuestDetail->save();
|
||||
}
|
||||
}
|
||||
|
||||
$this->redirect_after = self::$currentIndex.'&conf=1&token='.$this->token;
|
||||
@@ -1088,6 +1105,7 @@ class AdminCustomersControllerCore extends AdminController
|
||||
$this->errors[] = Tools::displayError('Password can not be empty.');
|
||||
$this->display = 'edit';
|
||||
} elseif ($customer = parent::processAdd()) {
|
||||
CartCustomerGuestDetail::updateCustomerPhoneNumber($customer->email, Tools::getValue('phone'));
|
||||
$this->context->smarty->assign('new_customer', $customer);
|
||||
return $customer;
|
||||
}
|
||||
@@ -1119,7 +1137,10 @@ class AdminCustomersControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
return parent::processUpdate();
|
||||
if ($res = parent::processUpdate()) {
|
||||
CartCustomerGuestDetail::updateCustomerPhoneNumber($this->object->email, Tools::getValue('phone'));
|
||||
return $res;
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = Tools::displayError('An error occurred while loading the object.').'
|
||||
<b>'.$this->table.'</b> '.Tools::displayError('(cannot load object)');
|
||||
@@ -1149,6 +1170,21 @@ class AdminCustomersControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
$phone = Tools::getValue('phone');
|
||||
if (Configuration::get('PS_ONE_PHONE_AT_LEAST')) {
|
||||
if ($phone == '') {
|
||||
$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());
|
||||
|
||||
|
||||
@@ -76,6 +76,7 @@ class AddressControllerCore extends FrontController
|
||||
$_POST['firstname'] = $this->context->customer->firstname;
|
||||
$_POST['lastname'] = $this->context->customer->lastname;
|
||||
$_POST['company'] = $this->context->customer->company;
|
||||
$_POST['phone'] = $this->context->customer->phone;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -409,8 +409,10 @@ class AuthControllerCore extends FrontController
|
||||
$customer = new Customer();
|
||||
$lastnameAddress = Tools::getValue('lastname');
|
||||
$firstnameAddress = Tools::getValue('firstname');
|
||||
$phoneAddress = Tools::getValue('phone');
|
||||
$_POST['lastname'] = Tools::getValue('customer_lastname', $lastnameAddress);
|
||||
$_POST['firstname'] = Tools::getValue('customer_firstname', $firstnameAddress);
|
||||
$_POST['phone'] = Tools::getValue('customer_phone', $phoneAddress);
|
||||
$addresses_types = [];
|
||||
if (Configuration::get('PS_REGISTRATION_PROCESS_TYPE')) {
|
||||
$addresses_types[] = 'address';
|
||||
@@ -420,24 +422,18 @@ class AuthControllerCore extends FrontController
|
||||
$addresses_types[] = 'address_invoice';
|
||||
}
|
||||
|
||||
$error_phone = false;
|
||||
if (Configuration::get('PS_ONE_PHONE_AT_LEAST')) {
|
||||
if (Tools::isSubmit('submitGuestAccount') || !Tools::getValue('is_new_customer')) {
|
||||
if (!Tools::getValue('phone') && !Tools::getValue('phone_mobile')) {
|
||||
$error_phone = true;
|
||||
}
|
||||
} elseif (((Configuration::get('PS_REGISTRATION_PROCESS_TYPE') && Configuration::get('PS_ORDER_PROCESS_TYPE'))
|
||||
|| (Configuration::get('PS_ORDER_PROCESS_TYPE') && !Tools::getValue('email_create'))
|
||||
|| (Configuration::get('PS_REGISTRATION_PROCESS_TYPE') && Tools::getValue('email_create')))
|
||||
&& (!Tools::getValue('phone') && !Tools::getValue('phone_mobile'))) {
|
||||
$error_phone = true;
|
||||
$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 ($error_phone) {
|
||||
$this->errors[] = Tools::displayError('You must register at least one phone number.');
|
||||
}
|
||||
|
||||
if (!Tools::getValue('is_new_customer', 1)) {
|
||||
if ($idCustomer = Customer::customerExists(Tools::getValue('email'), true, false)) {
|
||||
$customer = new Customer($idCustomer);
|
||||
@@ -468,6 +464,8 @@ class AuthControllerCore extends FrontController
|
||||
|
||||
if (!count($this->errors)) {
|
||||
if ($customer->add()) {
|
||||
$phone = Tools::getValue('phone');
|
||||
CartCustomerGuestDetail::updateCustomerPhoneNumber($customer->email, $phone);
|
||||
if (!$customer->is_guest) {
|
||||
if (!$this->sendConfirmationMail($customer)) {
|
||||
$this->errors[] = Tools::displayError('The email cannot be sent.');
|
||||
@@ -614,6 +612,11 @@ class AuthControllerCore extends FrontController
|
||||
if (!$customer->save()) {
|
||||
$this->errors[] = Tools::displayError('An error occurred while creating your account.');
|
||||
} else {
|
||||
// save customer phone number in cart_customer_guest_detail
|
||||
$phone = Tools::getValue('phone');
|
||||
CartCustomerGuestDetail::updateCustomerPhoneNumber($customer->email, $phone);
|
||||
$_POST['phone'] = $phoneAddress;
|
||||
|
||||
foreach ($addresses_types as $addresses_type) {
|
||||
$$addresses_type->id_customer = (int)$customer->id;
|
||||
if ($addresses_type == 'address_invoice') {
|
||||
|
||||
@@ -82,6 +82,20 @@ class IdentityControllerCore extends FrontController
|
||||
$this->errors = array_merge($this->errors, $this->customer->validateController());
|
||||
}
|
||||
|
||||
$phone = Tools::getValue('phone');
|
||||
if (Configuration::get('PS_ONE_PHONE_AT_LEAST')) {
|
||||
if ($phone == '') {
|
||||
$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']);;
|
||||
}
|
||||
|
||||
if (!count($this->errors)) {
|
||||
$this->customer->id_default_group = (int)$prev_id_default_group;
|
||||
$this->customer->firstname = Tools::ucwords($this->customer->firstname);
|
||||
@@ -109,6 +123,7 @@ class IdentityControllerCore extends FrontController
|
||||
$this->context->cookie->passwd = $this->customer->passwd;
|
||||
}
|
||||
if ($this->customer->update()) {
|
||||
CartCustomerGuestDetail::updateCustomerPhoneNumber($this->customer->email, $phone);
|
||||
$this->context->cookie->customer_lastname = $this->customer->lastname;
|
||||
$this->context->cookie->customer_firstname = $this->customer->firstname;
|
||||
$this->context->smarty->assign('confirmation', 1);
|
||||
@@ -118,6 +133,7 @@ class IdentityControllerCore extends FrontController
|
||||
}
|
||||
} else {
|
||||
$_POST = array_map('stripslashes', $this->customer->getFields());
|
||||
$_POST['phone'] = $this->customer->phone;
|
||||
}
|
||||
|
||||
return $this->customer;
|
||||
|
||||
@@ -115,6 +115,18 @@ class OrderOpcControllerCore extends ParentOrderController
|
||||
$this->context->customer->birthday = (int)Tools::getValue('years').'-'.(int)Tools::getValue('months').'-'.(int)Tools::getValue('days');
|
||||
}
|
||||
|
||||
$phone = Tools::getValue('phone');
|
||||
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']);
|
||||
}
|
||||
|
||||
$_POST['lastname'] = $_POST['customer_lastname'];
|
||||
$_POST['firstname'] = $_POST['customer_firstname'];
|
||||
$this->errors = array_merge($this->errors, $this->context->customer->validateController());
|
||||
@@ -125,18 +137,9 @@ class OrderOpcControllerCore extends ParentOrderController
|
||||
if ($idAddressDelivery = Tools::getValue('opc_id_address_delivery')) {
|
||||
$objAddress = new Address($idAddressDelivery);
|
||||
if (Validate::isLoadedObject($objAddress)) {
|
||||
$phoneMobile = Tools::getValue('phone_mobile');
|
||||
|
||||
if (Configuration::get('PS_ONE_PHONE_AT_LEAST') && !$phoneMobile) {
|
||||
$this->errors[] = Tools::displayError('Mobile phone number is a required field.', false);
|
||||
}
|
||||
|
||||
if (!Validate::isPhoneNumber($phoneMobile)) {
|
||||
$this->errors[] = Tools::displayError('Please enter a valid Mobile phone number.', false);
|
||||
}
|
||||
|
||||
if (!count($this->errors)) {
|
||||
$objAddress->phone_mobile = $phoneMobile;
|
||||
$objAddress->phone_mobile = $phone;
|
||||
$objAddress->firstname = $this->context->customer->firstname;
|
||||
$objAddress->lastname = $this->context->customer->lastname;
|
||||
if (!$objAddress->save()) {
|
||||
@@ -154,6 +157,8 @@ class OrderOpcControllerCore extends ParentOrderController
|
||||
);
|
||||
if (!count($this->errors)) {
|
||||
$return['isSaved'] = (bool)$this->context->customer->update();
|
||||
CartCustomerGuestDetail::updateCustomerPhoneNumber($this->context->customer->email, $phone);
|
||||
|
||||
} else {
|
||||
$return['isSaved'] = false;
|
||||
}
|
||||
@@ -686,6 +691,7 @@ class OrderOpcControllerCore extends ParentOrderController
|
||||
'id_country' => (int)$address_delivery->id_country,
|
||||
'id_state' => (int)$address_delivery->id_state,
|
||||
'id_gender' => (int)$customer->id_gender,
|
||||
'phone' => (int)$customer->phone,
|
||||
'sl_year' => $birthday[0],
|
||||
'sl_month' => $birthday[1],
|
||||
'sl_day' => $birthday[2],
|
||||
|
||||
@@ -423,25 +423,6 @@ class ParentOrderControllerCore extends FrontController
|
||||
|
||||
$customerAddresses = array_values($customerAddresses);
|
||||
|
||||
if (!count($customerAddresses) && !Tools::isSubmit('ajax')) {
|
||||
$bad_delivery = false;
|
||||
if (($bad_delivery = (bool)!Address::isCountryActiveById((int)$this->context->cart->id_address_delivery)) || !Address::isCountryActiveById((int)$this->context->cart->id_address_invoice)) {
|
||||
$params = array();
|
||||
if ($this->step) {
|
||||
$params['step'] = (int)$this->step;
|
||||
}
|
||||
if ($multi = (int)Tools::getValue('multi-shipping')) {
|
||||
$params['multi-shipping'] = $multi;
|
||||
}
|
||||
$back_url = $this->context->link->getPageLink('order', true, (int)$this->context->language->id, $params);
|
||||
|
||||
$params = array('back' => $back_url, 'id_address' => ($bad_delivery ? (int)$this->context->cart->id_address_delivery : (int)$this->context->cart->id_address_invoice));
|
||||
if ($multi) {
|
||||
$params['multi-shipping'] = $multi;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
$this->context->smarty->assign(array(
|
||||
'addresses' => $customerAddresses,
|
||||
'formatedAddressFieldsValuesList' => $formatedAddressFieldsValuesList)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
14
install/fixtures/fashion/data/cart_customer_guest_detail.xml
Normal file
14
install/fixtures/fashion/data/cart_customer_guest_detail.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<entity_cart_customer_guest_detail>
|
||||
<fields id="email" class="CartCustomerGuestDetail">
|
||||
<field name="id_cart" />
|
||||
<field name="id_gender" />
|
||||
<field name="firstname" />
|
||||
<field name="lastname" />
|
||||
<field name="email"/>
|
||||
<field name="phone" />
|
||||
</fields>
|
||||
<entities>
|
||||
<cart_customer_guest_detail id="customer_guest_1" id_cart="0" id_gender="1" firstname="John" lastname="Doe" email="pub@qloapps.com" phone="1234567890" />
|
||||
</entities>
|
||||
</entity_cart_customer_guest_detail>
|
||||
@@ -317,36 +317,6 @@
|
||||
<tr>
|
||||
<td class="space_footer" style="padding:0!important"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding:7px 0">
|
||||
<table class="table" style="width:100%">
|
||||
<tr>
|
||||
<td width="20" class="space_address" style="padding:7px 0"> </td>
|
||||
<td class="box address" width="310" style="border:1px solid #D6D4D4;background-color:#f8f8f8;padding:7px 0">
|
||||
<table class="table" style="width:100%">
|
||||
<tr>
|
||||
<td width="10" style="padding:7px 0"> </td>
|
||||
<td style="padding:7px 0">
|
||||
<font size="2" face="Open-sans, sans-serif" color="#555454">
|
||||
<p data-html-only="1" style="border-bottom:1px solid #D6D4D4;margin:3px 0 7px;text-transform:uppercase;font-weight:500;font-size:18px;padding-bottom:10px">
|
||||
Customer address </p>
|
||||
<span data-html-only="1" style="color:#777">
|
||||
{invoice_block_html}
|
||||
</span>
|
||||
|
||||
</font>
|
||||
</td>
|
||||
<td width="10" style="padding:7px 0"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="space_footer" style="padding:0!important"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="linkbelow" style="padding:7px 0">
|
||||
<font size="2" face="Open-sans, sans-serif" color="#555454">
|
||||
|
||||
@@ -37,9 +37,6 @@ Extra Services Tax
|
||||
Final Booking Amount
|
||||
{total_paid}
|
||||
|
||||
Customer address
|
||||
{invoice_block_html}
|
||||
|
||||
You can review your order and download your invoice from the
|
||||
"Order history" [{history_url}] section of your
|
||||
customer account by clicking "My account"
|
||||
|
||||
@@ -318,35 +318,6 @@
|
||||
<tr>
|
||||
<td class="space_footer" style="padding:0!important"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding:7px 0">
|
||||
<table class="table" style="width:100%">
|
||||
<tr>
|
||||
<td class="box address" width="310" style="border:1px solid #D6D4D4;background-color:#f8f8f8;padding:7px 0">
|
||||
<table class="table" style="width:100%">
|
||||
<tr>
|
||||
<td width="10" style="padding:7px 0"> </td>
|
||||
<td style="padding:7px 0">
|
||||
<font size="2" face="Open-sans, sans-serif" color="#555454">
|
||||
<p data-html-only="1" style="border-bottom:1px solid #D6D4D4;margin:3px 0 7px;text-transform:uppercase;font-weight:500;font-size:18px;padding-bottom:10px">
|
||||
Customer address </p>
|
||||
<span data-html-only="1" style="color:#777">
|
||||
{invoice_block_html}
|
||||
</span>
|
||||
|
||||
</font>
|
||||
</td>
|
||||
<td width="10" style="padding:7px 0"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="space_footer" style="padding:0!important"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="linkbelow" style="padding:7px 0">
|
||||
<font size="2" face="Open-sans, sans-serif" color="#555454">
|
||||
|
||||
@@ -43,9 +43,6 @@ Extra Services Tax
|
||||
Final Booking Amount
|
||||
{total_paid}
|
||||
|
||||
Customer address
|
||||
{invoice_block_html}
|
||||
|
||||
You can review your order and download your invoice from the
|
||||
"Order history" [{history_url}] section of your
|
||||
customer account by clicking "My account"
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
{if $invoice_address}
|
||||
<table id="addresses-tab" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<!-- <td width="33%"><span class="bold"> </span><br/><br/>
|
||||
@@ -34,9 +33,15 @@
|
||||
</td> -->
|
||||
<td width="33%"></td>
|
||||
<td width="33%"></td>
|
||||
<td width="33%"><span class="bold">{l s='Customer Address' pdf='true'}</span><br/><br/>
|
||||
<td width="33%">
|
||||
<span class="bold">{l s='Customer Detail' pdf='true'}</span><br/><br/>
|
||||
{if $invoice_address}
|
||||
{$invoice_address}
|
||||
{else}
|
||||
{$customer->firstname} {$customer->lastname}
|
||||
<br>
|
||||
{$customer->phone}
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
{/if}
|
||||
</table>
|
||||
@@ -461,6 +461,10 @@
|
||||
<label for="email">{l s='Email'} <sup>*</sup></label>
|
||||
<input type="email" class="is_required validate form-control" data-validate="isEmail" id="email" name="email" value="{if isset($smarty.post.email)}{$smarty.post.email}{/if}" />
|
||||
</div>
|
||||
<div class="required form-group">
|
||||
<label for="customer_phone">{l s='Phone'}</label>
|
||||
<input onkeyup="$('#phone').val(this.value);" class="is_required validate form-control" data-validate="isPhoneNumber" type="phone" name="customer_phone" id="customer_phone" value="{if isset($smarty.post.customer_phone)}{$smarty.post.customer_phone}{/if}" />
|
||||
</div>
|
||||
<div class="required password form-group">
|
||||
<label for="passwd">{l s='Password'} <sup>*</sup></label>
|
||||
<input type="password" class="is_required validate form-control" data-validate="isPasswd" name="passwd" id="passwd" />
|
||||
|
||||
@@ -84,6 +84,12 @@
|
||||
</label>
|
||||
<input class="is_required validate form-control" data-validate="isEmail" type="email" name="email" id="email" value="{$smarty.post.email}" />
|
||||
</div>
|
||||
<div class="required form-group">
|
||||
<label for="phone" class="required">
|
||||
{l s='Phone'}
|
||||
</label>
|
||||
<input class="is_required validate form-control" data-validate="isPhoneNumber" type="phone" name="phone" id="phone" value="{$smarty.post.phone}" />
|
||||
</div>
|
||||
{if isset($birthday) && $birthday}
|
||||
<div class="form-group">
|
||||
<label>
|
||||
|
||||
@@ -349,6 +349,13 @@
|
||||
<td class="text-right">{$guestInformations['email']|escape:'html':'UTF-8'}</td>
|
||||
</tr>
|
||||
|
||||
{if isset($guestInformations['phone']) && $guestInformations['phone']}
|
||||
<tr>
|
||||
<td>{l s='Phone'}</td>
|
||||
<td class="text-right">{$guestInformations['phone']|escape:'html':'UTF-8'} </td>
|
||||
</tr>
|
||||
{/if}
|
||||
|
||||
{if isset($address_invoice->phone_mobile) && $address_invoice->phone_mobile}
|
||||
<tr>
|
||||
<td>{l s='Mobile'}</td>
|
||||
@@ -687,7 +694,12 @@
|
||||
<td>{l s='Email'}</td>
|
||||
<td class="text-right">{$guestInformations['email']|escape:'html':'UTF-8'}</td>
|
||||
</tr>
|
||||
|
||||
{if isset($guestInformations['phone']) && $guestInformations['phone']}
|
||||
<tr>
|
||||
<td>{l s='Phone'}</td>
|
||||
<td class="text-right">{$guestInformations['phone']|escape:'html':'UTF-8'} </td>
|
||||
</tr>
|
||||
{/if}
|
||||
{if isset($address_invoice->phone_mobile) && $address_invoice->phone_mobile}
|
||||
<tr>
|
||||
<td>{l s='Mobile'}</td>
|
||||
|
||||
@@ -86,8 +86,8 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="{if isset($one_phone_at_least) && $one_phone_at_least}required {/if}form-group col-sm-6">
|
||||
<label for="phone_mobile">{l s='Mobile phone'}{if isset($one_phone_at_least) && $one_phone_at_least} <sup>**</sup>{/if}</label>
|
||||
<input type="text" class="text form-control validate" name="phone_mobile" id="phone_mobile" data-validate="isPhoneNumber" value="{if isset($guestInformations) && isset($guestInformations.phone_mobile) && $guestInformations.phone_mobile}{$guestInformations.phone_mobile}{/if}" />
|
||||
<label for="phone">{l s='Phone Number'}{if isset($one_phone_at_least) && $one_phone_at_least} <sup>**</sup>{/if}</label>
|
||||
<input type="text" class="text form-control validate" name="phone" id="phone" data-validate="isPhoneNumber" value="{if isset($guestInformations) && isset($guestInformations.phone) && $guestInformations.phone}{$guestInformations.phone}{/if}" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -313,8 +313,5 @@
|
||||
{else}
|
||||
{addJsDef idSelectedCountryInvoice=false}
|
||||
{/if}
|
||||
{if isset($countries)}
|
||||
{addJsDef countries=$countries}
|
||||
{/if}
|
||||
{addJsDef PS_REGISTRATION_PROCESS_TYPE=$PS_REGISTRATION_PROCESS_TYPE|intval}
|
||||
|
||||
{/strip}
|
||||
|
||||
@@ -101,8 +101,8 @@
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="{if isset($one_phone_at_least) && $one_phone_at_least}required {/if}form-group col-sm-6">
|
||||
<label for="phone_mobile">{l s='Mobile phone'}{if isset($one_phone_at_least) && $one_phone_at_least} <sup>**</sup>{/if}</label>
|
||||
<input type="text" class="text form-control validate" name="phone_mobile" id="phone_mobile" data-validate="isPhoneNumber" value="{if isset($guestInformations) && isset($guestInformations.phone_mobile) && $guestInformations.phone_mobile}{$guestInformations.phone_mobile}{/if}" />
|
||||
<label for="customer_phone">{l s='Phone'}{if isset($one_phone_at_least) && $one_phone_at_least} <sup>*</sup>{/if}</label>
|
||||
<input type="text" class="text form-control validate" name="customer_phone" id="customer_phone" data-validate="isPhoneNumber" value="{if isset($guestInformations) && isset($guestInformations.phone_mobile) && $guestInformations.phone_mobile}{$guestInformations.phone_mobile}{/if}" onblur="$('#phone').val($(this).val());"/>
|
||||
</div>
|
||||
</div>
|
||||
{if isset($PS_REGISTRATION_PROCESS_TYPE) && $PS_REGISTRATION_PROCESS_TYPE}
|
||||
@@ -396,3 +396,8 @@
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
{strip}
|
||||
{if isset($countries)}
|
||||
{addJsDef countries=$countries}
|
||||
{/if}
|
||||
{/strip}
|
||||
@@ -125,31 +125,23 @@
|
||||
<div class="col-sm-3 col-xs-5 info-head">{l s='Name'}</div>
|
||||
<div class="col-sm-9 col-xs-7 info-value">
|
||||
{if $isGuest}
|
||||
{$guestInformations['customer_firstname']} {$guestInformations['customer_lastname']}
|
||||
{$guestInformations['customer_firstname']|escape:'html':'UTF-8'} {$guestInformations['customer_lastname']|escape:'html':'UTF-8'}
|
||||
{else}
|
||||
{$guestInformations['firstname']} {$guestInformations['lastname']}
|
||||
{$guestInformations['firstname']|escape:'html':'UTF-8'} {$guestInformations['lastname']|escape:'html':'UTF-8'}
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row margin-btm-10">
|
||||
<div class="col-sm-3 col-xs-5 info-head">{l s='Email'}</div>
|
||||
<div class="col-sm-9 col-xs-7 info-value">{$guestInformations['email']}</div>
|
||||
<div class="col-sm-9 col-xs-7 info-value">{$guestInformations['email']|escape:'html':'UTF-8'}</div>
|
||||
</div>
|
||||
{if (isset($delivery->phone_mobile) && $delivery->phone_mobile) || (isset($delivery->phone) && $delivery->phone)}
|
||||
{if (isset({$guestInformations['phone']}) && {$guestInformations['phone']})}
|
||||
<div class="row margin-btm-10">
|
||||
<div class="col-sm-3 col-xs-5 info-head">
|
||||
{if isset($delivery->phone_mobile) && $delivery->phone_mobile}
|
||||
{l s='Mobile Number'}
|
||||
{else}
|
||||
{l s='Phone Number'}
|
||||
{/if}
|
||||
</div>
|
||||
<div class="col-sm-9 col-xs-7 info-value">
|
||||
{if isset($delivery->phone_mobile) && $delivery->phone_mobile}
|
||||
{$delivery->phone_mobile|escape:'html':'UTF-8'}
|
||||
{else}
|
||||
{$delivery->phone|escape:'html':'UTF-8'}
|
||||
{/if}
|
||||
{$guestInformations['phone']|escape:'html':'UTF-8'}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
@@ -180,9 +172,11 @@
|
||||
{include file="$tpl_dir./order-opc-new-account.tpl"}
|
||||
{/if}
|
||||
</div>
|
||||
<div class="card-body hidden" id="order-opc-edit-guest-info">
|
||||
{include file="./order-opc-edit-guest-info.tpl"}
|
||||
</div>
|
||||
{if $is_logged || $isGuest}
|
||||
<div class="card-body hidden" id="order-opc-edit-guest-info">
|
||||
{include file="./order-opc-edit-guest-info.tpl"}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
@@ -477,6 +471,7 @@
|
||||
{addJsDef addresses=array()}
|
||||
{addJsDef isVirtualCart=$isVirtualCart|intval}
|
||||
{addJsDef isPaymentStep=$isPaymentStep|intval}
|
||||
{addJsDef PS_REGISTRATION_PROCESS_TYPE=$PS_REGISTRATION_PROCESS_TYPE|intval}
|
||||
{addJsDefL name=txtWithTax}{l s='(tax incl.)' js=1}{/addJsDefL}
|
||||
{addJsDefL name=txtWithoutTax}{l s='(tax excl.)' js=1}{/addJsDefL}
|
||||
{addJsDefL name=txtHasBeenSelected}{l s='has been selected' js=1}{/addJsDefL}
|
||||
|
||||
Reference in New Issue
Block a user