[-] FO : Fix bug #PSCFV-8412 no zipcode for countries when default country has no zip code in adress format

This commit is contained in:
gRoussac
2013-06-25 16:17:58 +02:00
parent 4627768092
commit 699053da27
7 changed files with 70 additions and 13 deletions
+5 -2
View File
@@ -433,8 +433,11 @@ class ToolsCore
{
// get currency from context
$currency = Shop::getEntityIds('currency', Context::getContext()->shop->id);
$cookie->id_currency = $currency[0]['id_currency'];
return Currency::getCurrencyInstance((int)$cookie->id_currency);
if (isset($currency[0]) && $currency[0]['id_currency'])
{
$cookie->id_currency = $currency[0]['id_currency'];
return Currency::getCurrencyInstance((int)$cookie->id_currency);
}
}
}
$currency = Currency::getCurrencyInstance(Configuration::get('PS_CURRENCY_DEFAULT'));
+8
View File
@@ -95,6 +95,7 @@ $(function(){ldelim}
<span class="form_info">{l s='DNI / NIF / NIE'}</span>
</p>
{assign var="stateExist" value="false"}
{assign var="postCodeExist" value="false"}
{foreach from=$ordered_adr_fields item=field_name}
{if $field_name eq 'company'}
<p class="text">
@@ -138,6 +139,7 @@ $(function(){ldelim}
</p>
{/if}
{if $field_name eq 'postcode'}
{assign var="postCodeExist" value="true"}
<p class="required postcode text">
<label for="postcode">{l s='Zip / Postal Code'} <sup>*</sup></label>
<input 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());" />
@@ -195,6 +197,12 @@ $(function(){ldelim}
</p>
{/if}
{/foreach}
{if $postCodeExist eq "false"}
<p class="required postcode text hidden">
<label for="postcode">{l s='Zip / Postal Code'} <sup>*</sup></label>
<input 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());" />
</p>
{/if}
{if $stateExist eq "false"}
<p class="required id_state select">
<label for="id_state">{l s='State'} <sup>*</sup></label>
+17 -3
View File
@@ -78,6 +78,7 @@ $(document).ready(function() {
{if !isset($back) || $back != 'my-account'}{assign var='current_step' value='login'}{include file="$tpl_dir./order-steps.tpl"}{/if}
{include file="$tpl_dir./errors.tpl"}
{assign var='stateExist' value=false}
{assign var="postCodeExist" value=false}
{if !isset($email_create)}
<script type="text/javascript">
{literal}
@@ -287,6 +288,7 @@ $(document).ready(function() {
<input type="text" class="text" name="address1" id="address1" value="{if isset($smarty.post.address1)}{$smarty.post.address1}{/if}" />
</p>
{elseif $field_name eq "postcode"}
{assign var='postCodeExist' value=true}
<p class="required postcode text">
<label for="postcode">{l s='Zip / Postal Code'} <sup>*</sup></label>
<input type="text" class="text" name="postcode" id="postcode" value="{if isset($smarty.post.postcode)}{$smarty.post.postcode}{/if}" onblur="$('#postcode').val($('#postcode').val().toUpperCase());" />
@@ -312,7 +314,6 @@ $(document).ready(function() {
</p>
{elseif $field_name eq "State:name"}
{assign var='stateExist' value=true}
<p class="required id_state select">
<label for="id_state">{l s='State'} <sup>*</sup></label>
<select name="id_state" id="id_state">
@@ -327,13 +328,19 @@ $(document).ready(function() {
{/if}
{/foreach}
{if $stateExist eq false}
<p class="required id_state select">
<p class="required id_state select hidden">
<label for="id_state">{l s='State'} <sup>*</sup></label>
<select name="id_state" id="id_state">
<option value="">-</option>
</select>
</p>
{/if}
{if $postCodeExist eq false}
<p class="required postcode text hidden">
<label for="postcode">{l s='Zip / Postal Code'} <sup>*</sup></label>
<input type="text" class="text" name="postcode" id="postcode" value="{if isset($smarty.post.postcode)}{$smarty.post.postcode}{/if}" onblur="$('#postcode').val($('#postcode').val().toUpperCase());" />
</p>
{/if}
<input type="hidden" name="alias" id="alias" value="{l s='My address'}" />
<input type="hidden" name="is_new_customer" id="is_new_customer" value="0" />
<!-- END Account -->
@@ -506,6 +513,7 @@ $(document).ready(function() {
<span class="inline-infos">{l s='Apartment, suite, unit, building, floor, etc...'}</span>
</p>
{elseif $field_name eq "postcode"}
{assign var='postCodeExist' value=true}
<p class="required postcode text">
<label for="postcode">{l s='Zip / Postal Code'} <sup>*</sup></label>
<input type="text" class="text" name="postcode" id="postcode" value="{if isset($smarty.post.postcode)}{$smarty.post.postcode}{/if}" onkeyup="$('#postcode').val($('#postcode').val().toUpperCase());" />
@@ -539,8 +547,14 @@ $(document).ready(function() {
</p>
{/if}
{/foreach}
{if $postCodeExist eq false}
<p class="required postcode text hidden">
<label for="postcode">{l s='Zip / Postal Code'} <sup>*</sup></label>
<input type="text" class="text" name="postcode" id="postcode" value="{if isset($smarty.post.postcode)}{$smarty.post.postcode}{/if}" onkeyup="$('#postcode').val($('#postcode').val().toUpperCase());" />
</p>
{/if}
{if $stateExist eq false}
<p class="required id_state select">
<p class="required id_state select hidden">
<label for="id_state">{l s='State'} <sup>*</sup></label>
<select name="id_state" id="id_state">
<option value="">-</option>
+10 -2
View File
@@ -106,6 +106,7 @@ $(document).ready(function() {
</div>
</div>
{assign var="stateExist" value="false"}
{assign var="postCodeExist" value="false"}
{foreach from=$ordered_adr_fields item=field_name}
{if $field_name eq 'company'}
<div class="text">
@@ -139,6 +140,7 @@ $(document).ready(function() {
</div>
{/if}
{if $field_name eq 'postcode'}
{assign var="postCodeExist" value="true"}
<div class="required postcode text">
<label for="postcode">{l s='Zip / Postal Code'} <sup>*</sup></label>
<input type="text" id="postcode" name="postcode" value="{if isset($smarty.post.postcode)}{$smarty.post.postcode}{else}{if isset($address->postcode)}{$address->postcode|escape:'htmlall':'UTF-8'}{/if}{/if}" onkeyup="$('#postcode').val($('#postcode').val().toUpperCase());" />
@@ -192,14 +194,20 @@ $(document).ready(function() {
</div>
{/if}
{/foreach}
{if $postCodeExist eq "false"}
<div class="required postcode text hidden">
<label for="postcode">{l s='Zip / Postal Code'} <sup>*</sup></label>
<input type="text" id="postcode" name="postcode" value="{if isset($smarty.post.postcode)}{$smarty.post.postcode}{else}{if isset($address->postcode)}{$address->postcode|escape:'htmlall':'UTF-8'}{/if}{/if}" onkeyup="$('#postcode').val($('#postcode').val().toUpperCase());" />
</div>
{/if}
{if $stateExist eq "false"}
<div class="required id_state select">
<div class="required id_state select hidden">
<label for="id_state">{l s='State'} <sup>*</sup></label>
<select name="id_state" id="id_state">
<option value="">-</option>
</select>
</div>
{/if}
{/if}
<div class="textarea">
<label for="other">{l s='Additional information'}</label>
<textarea id="other" name="other" cols="26" rows="3">{if isset($smarty.post.other)}{$smarty.post.other}{else}{if isset($address->other)}{$address->other|escape:'htmlall':'UTF-8'}{/if}{/if}</textarea>
@@ -132,6 +132,7 @@
<span class="inline-infos">{l s='Apartment, suite, unit, building, floor, etc...'}</span>
</p>
{elseif $field_name eq "postcode"}
{assign var='postCodeExist' value=true}
<p class="required postcode text">
<label for="postcode">{l s='Zip / Postal Code'} <sup>*</sup></label>
<input type="text" class="text" name="postcode" id="postcode" value="{if isset($smarty.post.postcode)}{$smarty.post.postcode}{/if}" onkeyup="$('#postcode').val($('#postcode').val().toUpperCase());" />
@@ -165,14 +166,20 @@
</p>
{/if}
{/foreach}
{if $postCodeExist eq false}
<p class="required postcode text hidden">
<label for="postcode">{l s='Zip / Postal Code'} <sup>*</sup></label>
<input type="text" class="text" name="postcode" id="postcode" value="{if isset($smarty.post.postcode)}{$smarty.post.postcode}{/if}" onkeyup="$('#postcode').val($('#postcode').val().toUpperCase());" />
</p>
{/if}
{if $stateExist eq false}
<p class="required id_state select">
<p class="required id_state select hidden">
<label for="id_state">{l s='State'} <sup>*</sup></label>
<select name="id_state" id="id_state">
<option value="">-</option>
</select>
</p>
{/if}
{/if}
<p class="textarea">
<label for="other">{l s='Additional information'}</label>
<textarea name="other" id="other" cols="26" rows="3">{if isset($smarty.post.other)}{$smarty.post.other}{/if}</textarea>
+1
View File
@@ -71,6 +71,7 @@ $(document).ready(function() {
</script>
{assign var='stateExist' value=false}
{assign var='postCodeExist' value=false}
{if !isset($email_create)}
{include file="./authentication-choice.tpl"}
{else}
+20 -4
View File
@@ -178,6 +178,7 @@
{/if}
<h3>{l s='Delivery address'}</h3>
{$stateExist = false}
{$postCodeExist = false}
{foreach from=$dlv_all_fields item=field_name}
{if $field_name eq "company"}
{if $b2b_enable}
@@ -207,6 +208,7 @@
<input type="text" class="text" name="address2" id="address2" value="" />
</p>
{elseif $field_name eq "postcode"}
{$postCodeExist = true}
<p class="required postcode text">
<label for="postcode">{l s='Zip / Postal code'} <sup>*</sup></label>
<input type="text" class="text" name="postcode" id="postcode" value="{if isset($guestInformations) && $guestInformations.postcode}{$guestInformations.postcode}{/if}" onkeyup="$('#postcode').val($('#postcode').val().toUpperCase());" />
@@ -248,14 +250,20 @@
<input type="text" class="text" name="dni" id="dni" value="{if isset($guestInformations) && $guestInformations.dni}{$guestInformations.dni}{/if}" />
<span class="form_info">{l s='DNI / NIF / NIE'}</span>
</p>
{if !$postCodeExist}
<p class="required postcode text hidden">
<label for="postcode">{l s='Zip / Postal code'} <sup>*</sup></label>
<input type="text" class="text" name="postcode" id="postcode" value="{if isset($guestInformations) && $guestInformations.postcode}{$guestInformations.postcode}{/if}" onkeyup="$('#postcode').val($('#postcode').val().toUpperCase());" />
</p>
{/if}
{if !$stateExist}
<p class="required id_state select">
<p class="required id_state select hidden">
<label for="id_state">{l s='State'} <sup>*</sup></label>
<select name="id_state" id="id_state">
<option value="">-</option>
</select>
</p>
{/if}
{/if}
<p class="textarea is_customer_param">
<label for="other">{l s='Additional information'}</label>
<textarea name="other" id="other" cols="26" rows="3"></textarea>
@@ -280,6 +288,7 @@
<div id="opc_invoice_address" class="is_customer_param">
{assign var=stateExist value=false}
{assign var=postCodeExist value=false}
<h3>{l s='Invoice address'}</h3>
{foreach from=$inv_all_fields item=field_name}
{if $field_name eq "company"}
@@ -320,7 +329,8 @@
<input type="text" class="text" name="address2_invoice" id="address2_invoice" value="" />
</p>
{elseif $field_name eq "postcode"}
<p class="required postcode text">
{$postCodeExist = true}
<p class="required postcode_invoice text">
<label for="postcode_invoice">{l s='Zip / Postal Code'} <sup>*</sup></label>
<input type="text" class="text" name="postcode_invoice" id="postcode_invoice" value="" onkeyup="$('#postcode').val($('#postcode').val().toUpperCase());" />
</p>
@@ -349,8 +359,14 @@
</p>
{/if}
{/foreach}
{if !$postCodeExist}
<p class="required postcode_invoice text hidden">
<label for="postcode_invoice">{l s='Zip / Postal Code'} <sup>*</sup></label>
<input type="text" class="text" name="postcode_invoice" id="postcode_invoice" value="" onkeyup="$('#postcode').val($('#postcode').val().toUpperCase());" />
</p>
{/if}
{if !$stateExist}
<p class="required id_state_invoice select" style="display:none;">
<p class="required id_state_invoice select hidden">
<label for="id_state_invoice">{l s='State'} <sup>*</sup></label>
<select name="id_state_invoice" id="id_state_invoice">
<option value="">-</option>