// small fix
This commit is contained in:
@@ -43,8 +43,9 @@ class AddressControllerCore extends FrontController
|
||||
public function setMedia()
|
||||
{
|
||||
parent::setMedia();
|
||||
$this->addJS(_THEME_JS_DIR_.'tools/statesManagement.js');
|
||||
$this->addJS(_PS_JS_DIR_.'validate.js');
|
||||
$this->addJS(_THEME_JS_DIR_.'tools/statesManagement.js');
|
||||
$this->addJS(_THEME_JS_DIR_.'validate_fields.js');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -114,41 +114,39 @@ $(function(){ldelim}
|
||||
{/if}
|
||||
{if $field_name eq 'firstname'}
|
||||
<div class="required form-group">
|
||||
|
||||
<label for="firstname">{l s='First name'} <sup>*</sup></label>
|
||||
<input class="form-control" type="text" name="firstname" id="firstname" value="{if isset($smarty.post.firstname)}{$smarty.post.firstname}{else}{if isset($address->firstname)}{$address->firstname|escape:'html'}{/if}{/if}" onkeyup="if (validate_{$address_validation.$field_name.validate}($(this).val())) $(this).parent().removeClass('form-error').addClass('form-ok'); else $(this).parent().addClass('form-error').removeClass('form-ok');" />
|
||||
</div>
|
||||
|
||||
<input class="is_required validate form-control" data-validate="{$address_validation.$field_name.validate}" type="text" name="firstname" id="firstname" value="{if isset($smarty.post.firstname)}{$smarty.post.firstname}{else}{if isset($address->firstname)}{$address->firstname|escape:'html'}{/if}{/if}" />
|
||||
</div>
|
||||
{/if}
|
||||
{if $field_name eq 'lastname'}
|
||||
<div class="required form-group">
|
||||
<label for="lastname">{l s='Last name'} <sup>*</sup></label>
|
||||
<input class="form-control" type="text" id="lastname" name="lastname" value="{if isset($smarty.post.lastname)}{$smarty.post.lastname}{else}{if isset($address->lastname)}{$address->lastname|escape:'html'}{/if}{/if}" onkeyup="if (validate_{$address_validation.$field_name.validate}($(this).val())) $(this).parent().removeClass('form-error').addClass('form-ok'); else $(this).parent().addClass('form-error').removeClass('form-ok');" />
|
||||
<input class="is_required validate form-control" data-validate="{$address_validation.$field_name.validate}" type="text" id="lastname" name="lastname" value="{if isset($smarty.post.lastname)}{$smarty.post.lastname}{else}{if isset($address->lastname)}{$address->lastname|escape:'html'}{/if}{/if}" />
|
||||
</div>
|
||||
{/if}
|
||||
{if $field_name eq 'address1'}
|
||||
<div class="required form-group">
|
||||
<label for="address1">{l s='Address'} <sup>*</sup></label>
|
||||
<input class="form-control" type="text" id="address1" name="address1" value="{if isset($smarty.post.address1)}{$smarty.post.address1}{else}{if isset($address->address1)}{$address->address1|escape:'html'}{/if}{/if}"onkeyup="if (validate_{$address_validation.$field_name.validate}($(this).val())) $(this).parent().removeClass('form-error').addClass('form-ok'); else $(this).parent().addClass('form-error').removeClass('form-ok');" />
|
||||
<input class="is_required validate form-control" data-validate="{$address_validation.$field_name.validate}" type="text" id="address1" name="address1" value="{if isset($smarty.post.address1)}{$smarty.post.address1}{else}{if isset($address->address1)}{$address->address1|escape:'html'}{/if}{/if}" />
|
||||
</div>
|
||||
{/if}
|
||||
{if $field_name eq 'address2'}
|
||||
<div class="required form-group">
|
||||
<label for="address2">{l s='Address (Line 2)'}</label>
|
||||
<input class="form-control" type="text" id="address2" name="address2" value="{if isset($smarty.post.address2)}{$smarty.post.address2}{else}{if isset($address->address2)}{$address->address2|escape:'html'}{/if}{/if}" onkeyup="if($(this).val().length) { if (validate_{$address_validation.$field_name.validate}($(this).val())) $(this).parent().removeClass('form-error').addClass('form-ok'); else $(this).parent().addClass('form-error').removeClass('form-ok'); }" />
|
||||
<input class="validate form-control" data-validate="{$address_validation.$field_name.validate}" type="text" id="address2" name="address2" value="{if isset($smarty.post.address2)}{$smarty.post.address2}{else}{if isset($address->address2)}{$address->address2|escape:'html'}{/if}{/if}" />
|
||||
</div>
|
||||
{/if}
|
||||
{if $field_name eq 'postcode'}
|
||||
{assign var="postCodeExist" value="true"}
|
||||
<div class="required postcode form-group">
|
||||
<label for="postcode">{l s='Zip / Postal Code'} <sup>*</sup></label>
|
||||
<input class="form-control" type="text" id="postcode" name="postcode" value="{if isset($smarty.post.postcode)}{$smarty.post.postcode}{else}{if isset($address->postcode)}{$address->postcode|escape:'html'}{/if}{/if}" onkeyup="if (validate_{$address_validation.$field_name.validate}($(this).val())) $(this).parent().removeClass('form-error').addClass('form-ok'); else $(this).parent().addClass('form-error').removeClass('form-ok');" />
|
||||
<input class="is_required validate form-control" data-validate="{$address_validation.$field_name.validate}" type="text" id="postcode" name="postcode" value="{if isset($smarty.post.postcode)}{$smarty.post.postcode}{else}{if isset($address->postcode)}{$address->postcode|escape:'html'}{/if}{/if}" />
|
||||
</div>
|
||||
{/if}
|
||||
{if $field_name eq 'city'}
|
||||
<div class="required form-group">
|
||||
<label for="city">{l s='City'} <sup>*</sup></label>
|
||||
<input class="form-control" type="text" name="city" id="city" value="{if isset($smarty.post.city)}{$smarty.post.city}{else}{if isset($address->city)}{$address->city|escape:'html'}{/if}{/if}" maxlength="64" onkeyup="if (validate_{$address_validation.$field_name.validate}($(this).val())) $(this).parent().removeClass('form-error').addClass('form-ok'); else $(this).parent().addClass('form-error').removeClass('form-ok');" />
|
||||
<input class="is_required validate form-control" data-validate="{$address_validation.$field_name.validate}" type="text" name="city" id="city" value="{if isset($smarty.post.city)}{$smarty.post.city}{else}{if isset($address->city)}{$address->city|escape:'html'}{/if}{/if}" maxlength="64" />
|
||||
</div>
|
||||
{*
|
||||
if customer hasn't update his layout address, country has to be verified
|
||||
@@ -200,8 +198,7 @@ $(function(){ldelim}
|
||||
{if $postCodeExist eq "false"}
|
||||
<div class="required postcode form-group unvisible">
|
||||
<label for="postcode">{l s='Zip / Postal Code'} <sup>*</sup></label>
|
||||
<input class="form-control" type="text" id="postcode" name="postcode" value="{if isset($smarty.post.postcode)}{$smarty.post.postcode}{else}{if isset($address->postcode)}{$address->postcode|escape:'html'}{/if}{/if}" onkeyup="$('#postcode').val($('#postcode').val().toUpperCase());"
|
||||
onkeyup="if (validate_{$address_validation.$field_name.validate}($(this).val())) $(this).parent().removeClass('form-error').addClass('form-ok'); else $(this).parent().addClass('form-error').removeClass('form-ok');" />
|
||||
<input class="is_required validate form-control" data-validate="{$address_validation.$field_name.validate}" type="text" id="postcode" name="postcode" value="{if isset($smarty.post.postcode)}{$smarty.post.postcode}{else}{if isset($address->postcode)}{$address->postcode|escape:'html'}{/if}{/if}" onkeyup="$('#postcode').val($('#postcode').val().toUpperCase());" />
|
||||
</div>
|
||||
{/if}
|
||||
{if $stateExist eq "false"}
|
||||
@@ -214,12 +211,11 @@ $(function(){ldelim}
|
||||
{/if}
|
||||
<div class="form-group">
|
||||
<label for="other">{l s='Additional information'}</label>
|
||||
<textarea class="form-control" id="other" name="other" cols="26" rows="3" onkeyup="if($(this).val().length) { if (validate_{$address_validation.other.validate}($(this).val())) $(this).parent().removeClass('form-error').addClass('form-ok'); else $(this).parent().addClass('form-error').removeClass('form-ok');
|
||||
}">{if isset($smarty.post.other)}{$smarty.post.other}{else}{if isset($address->other)}{$address->other|escape:'html'}{/if}{/if}</textarea>
|
||||
<textarea class="validate form-control" data-validate="{$address_validation.other.validate}" id="other" name="other" cols="26" rows="3" >{if isset($smarty.post.other)}{$smarty.post.other}{else}{if isset($address->other)}{$address->other|escape:'html'}{/if}{/if}</textarea>
|
||||
</div>
|
||||
<div class="form-group phone-number">
|
||||
<label for="phone">{l s='Home phone'}</label>
|
||||
<input type="tel" id="phone" class="form-control" name="phone" value="{if isset($smarty.post.phone)}{$smarty.post.phone}{else}{if isset($address->phone)}{$address->phone|escape:'html'}{/if}{/if}" onkeyup="if (validate_{$address_validation.phone.validate}($(this).val())) $(this).parent().removeClass('form-error').addClass('form-ok'); else $(this).parent().addClass('form-error').removeClass('form-ok');" />
|
||||
<input class="{if isset($one_phone_at_least) && $one_phone_at_least}is_required{/if} validate form-control" data-validate="{$address_validation.phone.validate}" type="tel" id="phone" name="phone" value="{if isset($smarty.post.phone)}{$smarty.post.phone}{else}{if isset($address->phone)}{$address->phone|escape:'html'}{/if}{/if}" />
|
||||
</div>
|
||||
{if isset($one_phone_at_least) && $one_phone_at_least}
|
||||
<p class="inline-infos required">{l s='You must register at least one phone number.'}</p>
|
||||
@@ -227,11 +223,11 @@ $(function(){ldelim}
|
||||
<div class="clearfix"></div>
|
||||
<div class="{if isset($one_phone_at_least) && $one_phone_at_least}required {/if}form-group">
|
||||
<label for="phone_mobile">{l s='Mobile phone'}{if isset($one_phone_at_least) && $one_phone_at_least} <sup>*</sup>{/if}</label>
|
||||
<input type="tel" id="phone_mobile" class="form-control" name="phone_mobile" value="{if isset($smarty.post.phone_mobile)}{$smarty.post.phone_mobile}{else}{if isset($address->phone_mobile)}{$address->phone_mobile|escape:'html'}{/if}{/if}" onkeyup="if($(this).val().length) { if (validate_{$address_validation.phone_mobile.validate}($(this).val())) $(this).parent().removeClass('form-error').addClass('form-ok'); else $(this).parent().addClass('form-error').removeClass('form-ok'); }" />
|
||||
<input class="validate form-control" data-validate="{$address_validation.phone_mobile.validate}" type="tel" id="phone_mobile" name="phone_mobile" value="{if isset($smarty.post.phone_mobile)}{$smarty.post.phone_mobile}{else}{if isset($address->phone_mobile)}{$address->phone_mobile|escape:'html'}{/if}{/if}" />
|
||||
</div>
|
||||
<div class="required form-group" id="adress_alias">
|
||||
<label for="alias">{l s='Please assign an address title for future reference.'} <sup>*</sup></label>
|
||||
<input type="text" id="alias" class="form-control" name="alias" value="{if isset($smarty.post.alias)}{$smarty.post.alias}{else if isset($address->alias)}{$address->alias|escape:'html'}{elseif !$select_address}{l s='My address'}{/if}" onkeyup="if (validate_{$address_validation.alias.validate}($(this).val())) $(this).parent().removeClass('form-error').addClass('form-ok'); else $(this).parent().addClass('form-error').removeClass('form-ok');" />
|
||||
<input type="text" id="alias" class="is_required validate form-control" data-validate="{$address_validation.alias.validate}" name="alias" value="{if isset($smarty.post.alias)}{$smarty.post.alias}{else if isset($address->alias)}{$address->alias|escape:'html'}{elseif !$select_address}{l s='My address'}{/if}" />
|
||||
</div>
|
||||
</fieldset>
|
||||
<p class="submit2">
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* 2007-2013 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/afl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2013 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
$(document).ready(function() {
|
||||
$('input.validate, textarea.validate').keyup(function() {
|
||||
if ($(this).hasClass('is_required') || $(this).val().length)
|
||||
{
|
||||
if (window['validate_'+$(this).attr('data-validate')]($(this).val()))
|
||||
$(this).parent().removeClass('form-error').addClass('form-ok');
|
||||
else
|
||||
$(this).parent().addClass('form-error').removeClass('form-ok');
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user