Merge pull request #414 from abhishek-webkul/gli-719

Fix guest can not edit personal info on checkout page issue
This commit is contained in:
Rohit Jain
2022-12-22 17:00:19 +05:30
committed by GitHub
6 changed files with 535 additions and 114 deletions

View File

@@ -135,6 +135,34 @@ class OrderOpcControllerCore extends ParentOrderController
$this->ajaxDie(json_encode($return));
break;
case 'transformGuestAccount':
$passwd = Tools::getValue('passwd');
if (!$passwd) {
$this->errors[] = Tools::displayError('Please enter a password.');
}
if ($passwd && !Validate::isPasswd($passwd)) {
$this->errors[] = Tools::displayError('Please enter a valid password.');
}
if (!count($this->errors)) {
$customer = new Customer($this->context->customer->id);
if ($customer->transformToCustomer($this->context->language->id, $passwd)) {
$this->updateContext($customer);
} else {
$this->errors[] = Tools::displayError('An error occurred while transforming your account into a registered customer.');
}
}
$return = array(
'hasError' => !empty($this->errors),
'errors' => $this->errors,
);
$this->ajaxDie(json_encode($return));
break;
case 'getAddressBlockAndCarriersAndPayments':
if ($this->context->customer->isLogged() || $this->context->customer->isGuest()) {
// check if customer have addresses
@@ -964,4 +992,20 @@ class OrderOpcControllerCore extends ParentOrderController
}
die('0');
}
public function updateContext(Customer $customer)
{
$this->context->cookie->id_customer = (int)$customer->id;
$this->context->cookie->customer_lastname = $customer->lastname;
$this->context->cookie->customer_firstname = $customer->firstname;
$this->context->cookie->passwd = $customer->passwd;
$this->context->cookie->logged = 1;
$this->context->cookie->email = $customer->email;
$this->context->cookie->is_guest = 0;
$this->context->cart->secure_key = $customer->secure_key;
$customer->logged = 1;
$this->context->customer = $customer;
}
}

View File

@@ -91,6 +91,20 @@
/* By Webkul */
.strikethrough {
width: 100%;
text-align: center;
border-bottom: 1px solid #777;
line-height: 0.1em;
margin: 10px 0 25px;
}
.strikethrough span {
background: #fff;
color: #333;
padding:0 10px;
}
#title {
font-size: 13px;
color: #3C3C3C;
@@ -264,6 +278,9 @@
.order-detail-content .room_remove_block i {
font-size: 18px;
}
#order-opc #guest-info-block {
position: relative;
}
#order-opc #guest-info-block div.info-head {
font-size: 14px;
color: #555555;
@@ -312,6 +329,16 @@
font-weight: 600;
}
#order-opc #login_form_content .text-secondary {
color: #333;
font-size: 14px;
}
#order-opc #login_form_content #idAccountChoice {
color: #003AEF;
font-weight: 600;
}
#new_account_form #opc_guestCheckout {
padding: 14px 25px;
}
@@ -552,6 +579,10 @@
padding-top: 0px;
}
#order-opc #opc_account_errors {
margin-top: 10px
}
/* buttons css */
#order-opc .opc-button-small {
border: none;
@@ -570,7 +601,7 @@
color: #1292FF;
}
#order-opc .opc-button {
padding: 11px 0 0 0;
padding: 2px 0 0 0;
}
#order-opc .button-medium {
background-color: #1292FF;
@@ -641,3 +672,29 @@
content: "";}
#order-opc .fancybox-skin .fancybox-close {
background-image: url(../img/icon/icon-close.svg);}
.btn-edit-guest-info {
padding: 0px 50px;
font-size: 17px;
line-height: 23px;
border-radius: 2px;
background-color: #D9D9D9;
border: 1px solid #D9D9D9;
margin-right: 10px; }
.btn-edit-guest-info span {
display: block;
font-size: 14px;
padding: 11px;
font-weight: 600;
text-transform: uppercase;
text-align: center; }
.transform-to-customer-block {
margin-top: 25px; }
.transform-to-customer-block .text-secondary {
font-size: 14px;
line-height: 19px;
color: #333;
margin-bottom: 15px; }

View File

@@ -63,7 +63,6 @@ $(document).ready(function()
$('.is_customer_param').show();
$('#opc_account_form').slideDown('slow');
$('#is_new_customer').val('1');
$('#opc_account_choice, #opc_invoice_address').hide();
if (typeof bindUniform !=='undefined')
bindUniform();
});
@@ -72,7 +71,6 @@ $(document).ready(function()
$('.is_customer_param').hide();
$('#opc_account_form').slideDown('slow');
$('#is_new_customer').val('0');
$('#opc_account_choice, #opc_invoice_address').hide();
$('#new_account_title').html(txtInstantCheckout);
$('#submitAccount').attr({id : 'submitGuestAccount', name : 'submitGuestAccount'});
if (typeof bindUniform !=='undefined')
@@ -98,11 +96,19 @@ $(document).ready(function()
// LOGIN FORM
$(document).on('click', '#openLoginFormBlock', function(e){
e.preventDefault();
$('#openNewAccountBlock').show();
$('.already_registered_block').hide();
$('#login_form_content').slideDown('slow');
$('#new_account_form').slideUp('slow');
$('#openNewAccountBlock').show(200);
$('.already_registered_block').hide(200);
$('#login_form_content').slideDown(200);
$('#new_account_form').slideUp(200);
});
$(document).on('click', '#idAccountChoice', function(e) {
e.preventDefault();
$('#login_form_content').slideUp(200);
$('#new_account_form').slideDown(200);
$('.already_registered_block').show(200);
});
// LOGIN FORM SENDING
$(document).on('click', '#SubmitLogin', function(e)
{
@@ -162,9 +168,10 @@ $(document).ready(function()
e.preventDefault();
$('#opc_new_account-overlay, #opc_delivery_methods-overlay, #opc_payment_methods-overlay').fadeIn('slow')
var callingFile = '';
var callingFile = '';
var advApiParam = '';
var params = '';
var isTransforming = false;
if ($(this).attr('data-adv-api')) {
advApiParam = '&isAdvApi=1';
@@ -177,8 +184,12 @@ $(document).ready(function()
}
else
{
callingFile = orderOpcUrl;
params = 'method=editCustomer&';
if ($('#opc_account_form #passwd').val().length > 0) {
params = 'method=transformGuestAccount&';
isTransforming = true;
} else {
params = 'method=editCustomer&';
}
}
$('#opc_account_form input:visible, #opc_account_form input[type=hidden]').each(function() {
@@ -199,8 +210,6 @@ $(document).ready(function()
$('#opc_account_form select:visible').each(function() {
params += encodeURIComponent($(this).attr('name'))+'='+encodeURIComponent($(this).val())+'&';
});
params += 'customer_lastname='+encodeURIComponent($('#customer_lastname').val())+'&';
params += 'customer_firstname='+encodeURIComponent($('#customer_firstname').val())+'&';
params += 'alias='+encodeURIComponent($('#alias').val())+'&';
params += 'other='+encodeURIComponent($('#other').val())+'&';
params += 'is_new_customer='+encodeURIComponent($('#is_new_customer').val())+'&';
@@ -214,7 +223,7 @@ $(document).ready(function()
async: false,
cache: false,
dataType : "json",
data: 'ajax=true&'+params+'&token=' + static_token ,
data: 'ajax=true&'+params+'&token=' + static_token,
success: function(jsonData)
{
if (jsonData.hasError)
@@ -241,6 +250,10 @@ $(document).ready(function()
$('#opc_account_errors').slideUp('slow', function(){
$(this).html('');
});
if (isTransforming) {
location.reload();
}
}
isGuest = parseInt($('#is_new_customer').val()) == 1 ? 0 : 1;
@@ -256,32 +269,13 @@ $(document).ready(function()
static_token = jsonData.token;
// It's not a new customer
if ($('#opc_id_customer').val() !== '0')
if (!saveAddress('delivery'))
return false;
// update id_customer
$('#opc_id_customer').val(jsonData.id_customer);
if ($('#invoice_address:checked').length !== 0)
{
if (!saveAddress('invoice'))
return false;
if (PS_CUSTOMER_ADDRESS_CREATION && $('#opc_id_customer').val() !== '0') {
saveAddress('delivery', function() {
location.reload();
});
}
// update id_customer
$('#opc_id_customer').val(jsonData.id_customer);
// force to refresh carrier list
if (isGuest)
{
isLogged = 1;
$('#opc_account_saved').fadeIn('slow');
$('#submitAccount').hide();
updateAddressSelection(advApiParam);
}
else
updateNewAccountToAddressBlock(advApiParam);
location.reload();
}
//$('#guest-info-block, #opc_new_account-overlay, #opc_delivery_methods-overlay, #opc_payment_methods-overlay').fadeIn('slow');
},
@@ -831,7 +825,7 @@ function confirmFreeOrder()
});
}
function saveAddress(type)
function saveAddress(type, callback)
{
if (type !== 'delivery' && type !== 'invoice')
return false;
@@ -868,8 +862,6 @@ function saveAddress(type)
// Clean the last &
params = params.substr(0, params.length-1);
var result = false;
$.ajax({
type: 'POST',
headers: { "cache-control": "no-cache" },
@@ -899,14 +891,16 @@ function saveAddress(type)
});
});
$('#guest-info-block, #opc_account-overlay, #opc_delivery_methods-overlay, #opc_payment_methods-overlay').fadeOut('slow');
result = false;
}
else
{
// update addresses id
$('input#opc_id_address_delivery').val(jsonData.id_address_delivery);
$('input#opc_id_address_invoice').val(jsonData.id_address_invoice);
result = true;
if (typeof callback === 'function') {
callback();
}
}
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
@@ -930,8 +924,6 @@ function saveAddress(type)
$('#guest-info-block, #opc_account-overlay, #opc_delivery_methods-overlay, #opc_payment_methods-overlay').fadeOut('slow');
}
});
return result;
}
function updateNewAccountToAddressBlock(is_adv_api)
@@ -1200,3 +1192,9 @@ function multishippingMode(it)
bindUniform();
}
}
$(document).on('click', '.btn-edit-guest-info', function(e) {
e.preventDefault();
$('#collapse-guest-info .card-body:nth-child(1)').hide();
$('#collapse-guest-info .card-body:nth-child(2)').toggleClass('hidden');
});

View File

@@ -0,0 +1,323 @@
{**
* 2010-2022 Webkul.
*
* NOTICE OF LICENSE
*
* All right is reserved,
* Please go through LICENSE.txt file inside our module
*
* 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 CustomizationPolicy.txt file inside our module for more information.
*
* @author Webkul IN
* @copyright 2010-2022 Webkul IN
* @license LICENSE.txt
*}
<div id="opc_new_account" class="opc-main-block">
<div id="opc_new_account-overlay" class="opc-overlay" style="display: none;"></div>
<form action="{$link->getPageLink('authentication', true, NULL, "back=order-opc")|escape:'html':'UTF-8'}" method="post" id="login_form">
<fieldset>
<div id="login_form_content" style="display:none;">
<!-- Error return block -->
<div id="opc_login_errors" class="alert alert-danger" style="display:none;"></div>
<!-- END Error return block -->
<p class="form-group">
<label for="login_email">{l s='Email address'}</label>
<input type="email" class="form-control validate" id="login_email" name="email" data-validate="isEmail" />
</p>
<p class="form-group">
<label for="login_passwd">{l s='Password'}</label>
<input class="form-control validate" type="password" id="login_passwd" name="login_passwd" data-validate="isPasswd" />
</p>
<a href="{$link->getPageLink('password', true)|escape:'html':'UTF-8'}" class="lost_password pull-right">{l s='Forgot your password?'}</a>
<div style="clear:both"></div>
<p class="submit">
{if isset($back)}<input type="hidden" class="hidden" name="back" value="{$back|escape:'html':'UTF-8'}" />{/if}
<button type="submit" id="SubmitLogin" name="SubmitLogin" class="button btn btn-default button-medium pull-right"><span><i class="icon-lock left"></i>{l s='Sign in'}</span></button>
</p>
</div>
</fieldset>
</form>
<form action="{$link->getPageLink('authentication', true)|escape:'html':'UTF-8'}" method="post" id="new_account_form" class="std" autocomplete="on" autofill="on">
<div id="opc_account_form" class="unvisible">
{$HOOK_CREATE_ACCOUNT_TOP}
<div style="display: none;" id="opc_account_saved" class="alert alert-success">
{l s='Account information saved successfully.'}
</div>
<!-- Error return block -->
<div id="opc_account_errors" class="alert alert-danger" style="display:none;"></div>
<!-- END Error return block -->
<!-- Account -->
<input type="hidden" id="is_new_customer" name="is_new_customer" value="0" />
<input type="hidden" id="opc_id_customer" name="opc_id_customer" value="{if isset($guestInformations) && isset($guestInformations.id_customer) && $guestInformations.id_customer}{$guestInformations.id_customer}{else}0{/if}" />
<input type="hidden" id="opc_id_address_delivery" name="opc_id_address_delivery" value="{if isset($guestInformations) && isset($guestInformations.id_address_delivery) && $guestInformations.id_address_delivery}{$guestInformations.id_address_delivery}{else}0{/if}" />
<input type="hidden" id="opc_id_address_invoice" name="opc_id_address_invoice" value="{if isset($guestInformations) && isset($guestInformations.id_address_delivery) && $guestInformations.id_address_delivery}{$guestInformations.id_address_delivery}{else}0{/if}" />
<p class="required"><sup>*</sup>{l s='Required field'}</p>
<div class="row">
<div class="required clearfix gender-line col-sm-2">
<label>{l s='Social title'}</label>
<select name="id_gender" id="id_gender">
{foreach from=$genders key=k item=gender}
<option value="{$gender->id_gender}"{if isset($smarty.post.id_gender) && $smarty.post.id_gender == $gender->id_gender || (isset($guestInformations) && $guestInformations.id_gender == $gender->id_gender)} selected="selected"{/if}>{$gender->name}</option>
{/foreach}
</select>
</div>
<div class="required form-group col-sm-5">
<label for="firstname">{l s='First name'} <sup>*</sup></label>
<input type="text" class="text form-control validate" id="customer_firstname" name="customer_firstname" onblur="$('#firstname').val($(this).val());" data-validate="isName" value="{if isset($guestInformations) && isset($guestInformations.customer_firstname) && $guestInformations.customer_firstname}{$guestInformations.customer_firstname}{/if}" />
</div>
<div class="required form-group col-sm-5">
<label for="lastname">{l s='Last name'} <sup>*</sup></label>
<input type="text" class="form-control validate" id="customer_lastname" name="customer_lastname" onblur="$('#lastname').val($(this).val());" data-validate="isName" value="{if isset($guestInformations) && isset($guestInformations.customer_lastname) && $guestInformations.customer_lastname}{$guestInformations.customer_lastname}{/if}" />
</div>
</div>
<div class="row">
<div class="required text form-group col-sm-6">
<label for="email">{l s='Email'} <sup>*</sup></label>
<input type="email" class="text form-control validate" id="email" name="email" data-validate="isEmail" value="{if isset($guestInformations) && isset($guestInformations.email) && $guestInformations.email}{$guestInformations.email}{/if}" />
</div>
</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}" />
</div>
</div>
<div class="row">
<div class="col-sm-6">
<div class="transform-to-customer-block">
<p class="strikethrough"><span>{l s='OR'}</span></p>
<p class="text-secondary">{l s='Create a customer account using above details.'}</p>
<div class="row">
<div class="required password form-group col-sm-12">
<label for="passwd">{l s='Password'} <sup>*</sup></label>
<input type="password" class="text form-control validate" name="passwd" id="passwd" data-validate="isPasswd" />
<span class="form_info">{l s='(five characters min.)'}</span>
</div>
</div>
</div>
</div>
</div>
{if $PS_CUSTOMER_ADDRESS_CREATION}
<div class="row">
<div class="select form-group date-select col-sm-12">
<label>{l s='Date of Birth'}</label>
<div class="row">
<div class="col-xs-4">
<select id="days" name="days">
<option value="">-</option>
{foreach from=$days item=day}
<option value="{$day|escape:'html':'UTF-8'}" {if isset($guestInformations) && isset($guestInformations.sl_day) && ($guestInformations.sl_day == $day)} selected="selected"{/if}>{$day|escape:'html':'UTF-8'}&nbsp;&nbsp;</option>
{/foreach}
</select>
</div>
<div class="col-xs-4">
<select id="months" name="months">
<option value="">-</option>
{foreach from=$months key=k item=month}
<option value="{$k|escape:'html':'UTF-8'}" {if isset($guestInformations) && isset($guestInformations.sl_month) && ($guestInformations.sl_month == $k)} selected="selected"{/if}>{l s=$month}&nbsp;</option>
{/foreach}
</select>
</div>
<div class="col-xs-4">
<select id="years" name="years">
<option value="">-</option>
{foreach from=$years item=year}
<option value="{$year|escape:'html':'UTF-8'}" {if isset($guestInformations) && isset($guestInformations.sl_year) && ($guestInformations.sl_year == $year)} selected="selected"{/if}>{$year|escape:'html':'UTF-8'}&nbsp;&nbsp;</option>
{/foreach}
</select>
</div>
</div>
</div>
</div>
{if isset($newsletter) && $newsletter}
<div class="checkbox">
<label for="newsletter">
<input type="checkbox" name="newsletter" id="newsletter" value="1"{if isset($guestInformations) && isset($guestInformations.newsletter) && $guestInformations.newsletter} checked="checked"{/if} autocomplete="off"/>
{l s='Sign up for our newsletter!'}</label>
{if array_key_exists('newsletter', $field_required)}
<sup> *</sup>
{/if}
</div>
{/if}
{if isset($optin) && $optin}
<div class="checkbox">
<label for="optin">
<input type="checkbox" name="optin" id="optin" value="1"{if isset($guestInformations) && isset($guestInformations.optin) && $guestInformations.optin} checked="checked"{/if} autocomplete="off"/>
{l s='Receive special offers from our partners!'}</label>
{if array_key_exists('optin', $field_required)}
<sup> *</sup>
{/if}
</div>
{/if}
<p class="block-small-header margin-top-20 margin-btm-10">{l s='RESIDENTIAL ADDRESS'}</p>
{$stateExist = false}
{$postCodeExist = false}
{$dniExist = false}
<div class="row">
{foreach from=$dlv_all_fields item=field_name}
{if $field_name eq "firstname"}
<div class="required text form-group col-sm-6">
<label for="firstname">{l s='First name'} <sup>*</sup></label>
<input type="text" class="text form-control validate" id="firstname" name="firstname" data-validate="isName" value="{if isset($guestInformations) && isset($guestInformations.firstname) && $guestInformations.firstname}{$guestInformations.firstname}{/if}" />
</div>
{elseif $field_name eq "lastname"}
<div class="required text form-group col-sm-6">
<label for="lastname">{l s='Last name'} <sup>*</sup></label>
<input type="text" class="text form-control validate" id="lastname" name="lastname" data-validate="isName" value="{if isset($guestInformations) && isset($guestInformations.lastname) && $guestInformations.lastname}{$guestInformations.lastname}{/if}" />
</div>
{elseif $field_name eq "address1"}
<div class="required text form-group col-sm-6">
<label for="address1">{l s='Address'} <sup>*</sup></label>
<input type="text" class="text form-control validate" name="address1" id="address1" data-validate="isAddress" value="{if isset($guestInformations) && isset($guestInformations.address1) && isset($guestInformations) && isset($guestInformations.address1) && $guestInformations.address1}{$guestInformations.address1}{/if}" />
</div>
{elseif $field_name eq "address2"}
<div class="text{if !in_array($field_name, $required_fields)} is_customer_param{/if} form-group col-sm-6">
<label for="address2">{l s='Address (Line 2)'}{if in_array($field_name, $required_fields)} <sup>*</sup>{/if}</label>
<input type="text" class="text form-control validate" name="address2" id="address2" data-validate="isAddress" value="{if isset($guestInformations) && isset($guestInformations.address2) && isset($guestInformations) && isset($guestInformations.address2) && $guestInformations.address2}{$guestInformations.address2}{/if}" />
</div>
{elseif $field_name eq "city"}
<div class="required text form-group col-sm-6">
<label for="city">{l s='City'} <sup>*</sup></label>
<input type="text" class="text form-control validate" name="city" id="city" data-validate="isCityName" value="{if isset($guestInformations) && isset($guestInformations.city) && $guestInformations.city}{$guestInformations.city}{/if}" />
</div>
{elseif $field_name eq "postcode"}
{$postCodeExist = true}
<div class="required postcode text form-group col-sm-6">
<label for="postcode">{l s='Zip/Postal code'} <sup>*</sup></label>
<input type="text" class="text form-control validate" name="postcode" id="postcode" data-validate="isPostCode" value="{if isset($guestInformations) && isset($guestInformations.postcode) && $guestInformations.postcode}{$guestInformations.postcode}{/if}"/>
</div>
{elseif $field_name eq "company"}
<div class="text form-group col-sm-6">
<label for="company">{l s='Company'}{if in_array($field_name, $required_fields)} <sup>*</sup>{/if}</label>
<input type="text" class="text form-control validate" id="company" name="company" data-validate="isGenericName" value="{if isset($guestInformations) && isset($guestInformations.company) && $guestInformations.company}{$guestInformations.company}{/if}" />
</div>
{elseif $field_name eq "vat_number"}
<div id="vat_number_block" style="display:none;">
<div class="form-group col-sm-6">
<label for="vat_number">{l s='VAT number'}{if in_array($field_name, $required_fields)} <sup>*</sup>{/if}</label>
<input type="text" class="text form-control" name="vat_number" id="vat_number" value="{if isset($guestInformations) && isset($guestInformations.vat_number) && $guestInformations.vat_number}{$guestInformations.vat_number}{/if}" />
</div>
</div>
{elseif $field_name eq "dni"}
{assign var='dniExist' value=true}
<div class="required dni form-group col-sm-6">
<label for="dni">{l s='Identification number'} <sup>*</sup></label>
<input type="text" class="text form-control validate" name="dni" id="dni" data-validate="isDniLite" value="{if isset($guestInformations) && isset($guestInformations.dni) && $guestInformations.dni}{$guestInformations.dni}{/if}" />
<span class="form_info">{l s='DNI / NIF / NIE'}</span>
</div>
{elseif $field_name eq "country" || $field_name eq "Country:name"}
<div class="required select form-group col-sm-6">
<label for="id_country">{l s='Country'} <sup>*</sup></label>
<select name="id_country" id="id_country">
{foreach from=$countries item=v}
<option value="{$v.id_country}"{if (isset($guestInformations) && isset($guestInformations.id_country) && $guestInformations.id_country == $v.id_country) || (!isset($guestInformations) && $sl_country == $v.id_country)} selected="selected"{/if}>{$v.name|escape:'html':'UTF-8'}</option>
{/foreach}
</select>
</div>
{elseif $field_name eq "state" || $field_name eq 'State:name'}
{$stateExist = true}
<div class="required id_state form-group col-sm-6" style="display:none;">
<label for="id_state">{l s='State'} <sup>*</sup></label>
<select name="id_state" id="id_state">
<option value="">-</option>
</select>
</div>
{/if}
{/foreach}
{if !$postCodeExist}
<div class="required postcode form-group col-sm-6 unvisible">
<label for="postcode">{l s='Zip/Postal code'} <sup>*</sup></label>
<input type="text" class="text form-control validate" name="postcode" id="postcode" data-validate="isPostCode" value="{if isset($guestInformations) && isset($guestInformations.postcode) && $guestInformations.postcode}{$guestInformations.postcode}{/if}"/>
</div>
{/if}
{if !$stateExist}
<div class="required id_state form-group col-sm-6 unvisible">
<label for="id_state">{l s='State'} <sup>*</sup></label>
<select name="id_state" id="id_state">
<option value="">-</option>
</select>
</div>
{/if}
{if !$dniExist}
<div class="required dni form-group col-sm-6">
<label for="dni">{l s='Identification number'} <sup>*</sup></label>
<input type="text" class="text form-control validate" name="dni" id="dni" data-validate="isDniLite" value="{if isset($guestInformations) && isset($guestInformations.dni) && $guestInformations.dni}{$guestInformations.dni}{/if}" />
<span class="form_info">{l s='DNI / NIF / NIE'}</span>
</div>
{/if}
<div class="form-group is_customer_param col-sm-6">
<label for="phone">{l s='Home 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" id="phone" data-validate="isPhoneNumber" value="{if isset($guestInformations) && isset($guestInformations.phone) && $guestInformations.phone}{$guestInformations.phone}{/if}" />
</div>
<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}" />
</div>
<div class="form-group is_customer_param col-sm-6">
<label for="other">{l s='Additional information'}</label>
<textarea class="form-control" name="other" id="other" cols="26" rows="7"></textarea>
</div>
</div>
<div class="row">
<div class="col-sm-12">
{if isset($one_phone_at_least) && $one_phone_at_least}
{assign var="atLeastOneExists" value=true}
<p class="inline-infos required">** {l s='You must register at least one phone number.'}</p>
{/if}
<input type="hidden" name="alias" id="alias" value="{l s='My address'}"/>
<p class="required opc-required">
<sup>*</sup>{l s='Required field'}
</p>
</div>
</div>
{/if}
{$HOOK_CREATE_ACCOUNT_FORM}
<div class="submit opc-add-save clearfix">
<button type="submit" name="submitAccount" id="submitAccount" class="btn btn-default button button-medium pull-right"><span>{l s='Save'}<i class="icon-chevron-right right"></i></span></button>
</div>
<!-- END Account -->
</div>
</form>
</div>
{strip}
{if isset($guestInformations) && isset($guestInformations.id_state) && $guestInformations.id_state}
{addJsDef idSelectedState=$guestInformations.id_state|intval}
{else}
{addJsDef idSelectedState=false}
{/if}
{if isset($guestInformations) && isset($guestInformations.id_state_invoice) && $guestInformations.id_state_invoice}
{addJsDef idSelectedStateInvoice=$guestInformations.id_state_invoice|intval}
{else}
{addJsDef idSelectedStateInvoice=false}
{/if}
{if isset($guestInformations) && isset($guestInformations.id_country) && $guestInformations.id_country}
{addJsDef idSelectedCountry=$guestInformations.id_country|intval}
{else}
{addJsDef idSelectedCountry=false}
{/if}
{if isset($guestInformations) && isset($guestInformations.id_country_invoice) && $guestInformations.id_country_invoice}
{addJsDef idSelectedCountryInvoice=$guestInformations.id_country_invoice|intval}
{else}
{addJsDef idSelectedCountryInvoice=false}
{/if}
{if isset($countries)}
{addJsDef countries=$countries}
{/if}
{if isset($vatnumber_ajax_call) && $vatnumber_ajax_call}
{addJsDef vatnumber_ajax_call=$vatnumber_ajax_call}
{/if}
{addJsDef PS_CUSTOMER_ADDRESS_CREATION=$PS_CUSTOMER_ADDRESS_CREATION|intval}
{/strip}

View File

@@ -4,28 +4,32 @@
<fieldset>
<div class="already_registered_block">
<p>
{l s='Already have an account? '} <a href="{$link->getPageLink('authentication', true)|escape:'html':'UTF-8'}" id="openLoginFormBlock"> {l s='Login Now'}</a> {l s='to make check process faster and time saving.'}
{l s='Already have an account?'} <a href="{$link->getPageLink('authentication', true)|escape:'html':'UTF-8'}" id="openLoginFormBlock"> {l s='Login now'}</a> {l s='to make checkout process faster and time saving.'}
</p>
<p>{l s='Or'}</p>
</div>
<p><a href="{$link->getPageLink('authentication', true)|escape:'html':'UTF-8'}" id="openLoginFormBlock"></a></p>
<div id="login_form_content" style="display:none;">
<p class="text-secondary"><a href="#" id="idAccountChoice"> {l s='Return'}</a> {l s='to other checkout options.'}</p>
<!-- Error return block -->
<div id="opc_login_errors" class="alert alert-danger" style="display:none;"></div>
<!-- END Error return block -->
<p class="form-group">
<label for="login_email">{l s='Email address'}</label>
<input type="email" class="form-control validate" id="login_email" name="email" data-validate="isEmail" />
</p>
<p class="form-group">
<label for="login_passwd">{l s='Password'}</label>
<input class="form-control validate" type="password" id="login_passwd" name="login_passwd" data-validate="isPasswd" />
</p>
<div class="row">
<div class="form-group col-sm-6">
<label for="login_email">{l s='Email address'}</label>
<input type="email" class="form-control validate" id="login_email" name="email" data-validate="isEmail" />
</div>
</div>
<div class="row">
<div class="form-group col-sm-6">
<label for="login_passwd">{l s='Password'}</label>
<input class="form-control validate" type="password" id="login_passwd" name="login_passwd" data-validate="isPasswd" />
</div>
</div>
<a href="{$link->getPageLink('password', true)|escape:'html':'UTF-8'}" class="lost_password pull-right">{l s='Forgot your password?'}</a>
<div style="clear:both"></div>
<p class="submit">
{if isset($back)}<input type="hidden" class="hidden" name="back" value="{$back|escape:'html':'UTF-8'}" />{/if}
<button type="submit" id="SubmitLogin" name="SubmitLogin" class="button btn btn-default button-medium pull-right"><span><i class="icon-lock left"></i>{l s='Sign in'}</span></button>
<button type="submit" id="SubmitLogin" name="SubmitLogin" class="button btn btn-default button-medium pull-right"><span>{l s='Sign in'}</span></button>
</p>
</div>
</fieldset>
@@ -51,6 +55,9 @@
<!-- Error return block -->
<div id="opc_account_errors" class="alert alert-danger" style="display:none;"></div>
<!-- END Error return block -->
<div style="display: none; margin-top: 15px;" id="opc_account_saved" class="alert alert-success">
{l s='Account information saved successfully.'}
</div>
<!-- Account -->
<input type="hidden" id="is_new_customer" name="is_new_customer" value="0" />
<input type="hidden" id="opc_id_customer" name="opc_id_customer" value="{if isset($guestInformations) && isset($guestInformations.id_customer) && $guestInformations.id_customer}{$guestInformations.id_customer}{else}0{/if}" />
@@ -381,34 +388,8 @@
{$HOOK_CREATE_ACCOUNT_FORM}
<div class="submit opc-add-save clearfix">
<button type="submit" name="submitAccount" id="submitAccount" class="btn btn-default button button-medium pull-right"><span>{l s='Save'}<i class="icon-chevron-right right"></i></span></button>
</div>
<!-- END Account -->
</div>
</form>
</div>
{strip}
{if isset($guestInformations) && isset($guestInformations.id_state) && $guestInformations.id_state}
{addJsDef idSelectedState=$guestInformations.id_state|intval}
{else}
{addJsDef idSelectedState=false}
{/if}
{if isset($guestInformations) && isset($guestInformations.id_state_invoice) && $guestInformations.id_state_invoice}
{addJsDef idSelectedStateInvoice=$guestInformations.id_state_invoice|intval}
{else}
{addJsDef idSelectedStateInvoice=false}
{/if}
{if isset($guestInformations) && isset($guestInformations.id_country) && $guestInformations.id_country}
{addJsDef idSelectedCountry=$guestInformations.id_country|intval}
{else}
{addJsDef idSelectedCountry=false}
{/if}
{if isset($guestInformations) && isset($guestInformations.id_country_invoice) && $guestInformations.id_country_invoice}
{addJsDef idSelectedCountryInvoice=$guestInformations.id_country_invoice|intval}
{else}
{addJsDef idSelectedCountryInvoice=false}
{/if}
{if isset($countries)}
{addJsDef countries=$countries}
{/if}
{/strip}

View File

@@ -78,51 +78,69 @@
<div id="collapse-guest-info" class="opc-collapse {if !$step->step_is_current}collapse{/if}" aria-labelledby="guest-info-head" data-parent="#oprder-opc-accordion">
<div class="card-body">
{if $is_logged || $isGuest}
<div class="row margin-btm-10">
<div class="col-sm-3 col-xs-5 info-head">{l s='Name'}</div>
<div class="col-sm-9 col-xs-7 info-value">{$guestInformations['firstname']} {$guestInformations['lastname']}</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>
{if (isset($delivery->phone_mobile) && $delivery->phone_mobile) || (isset($delivery->phone) && $delivery->phone)}
<div class="checkout-guest-info-block">
<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-3 col-xs-5 info-head">{l s='Name'}</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'}
{if $isGuest}
{$guestInformations['customer_firstname']} {$guestInformations['customer_lastname']}
{else}
{$delivery->phone|escape:'html':'UTF-8'}
{$guestInformations['firstname']} {$guestInformations['lastname']}
{/if}
</div>
</div>
{/if}
{* proceed only if no order restrict errors are there *}
{if !$orderRestrictErr}
<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">
<span>
{l s='Proceed'}
</span>
</a>
</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>
{/if}
{if (isset($delivery->phone_mobile) && $delivery->phone_mobile) || (isset($delivery->phone) && $delivery->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}
</div>
</div>
{/if}
{* proceed only if no order restrict errors are there *}
{if !$orderRestrictErr}
<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">
<span>
{l s='Proceed'}
</span>
</a>
{if $isGuest}
<a class="btn btn-default btn-edit-guest-info pull-right" href="#" rel="nofollow">
<span>
{l s='Edit'}
</span>
</a>
{/if}
</div>
</div>
{/if}
</div>
{else}
<!-- Create account / Guest account / Login block -->
{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>
</div>
{/if}
</div>