gRoussac
2013-05-27 19:06:59 +02:00
parent 9845966a88
commit ea5405a917
5 changed files with 62 additions and 4 deletions
@@ -48,6 +48,21 @@
</div>
{else}
{$smarty.block.parent}
{/if}
{/block}
{block name="label"}
{if $input.name == 'standardization'}
<div id="TAASC" style="display: none;">{$smarty.block.parent}
{else}
{$smarty.block.parent}
{/if}
{/block}
{block name="input"}
{if $input.name == 'standardization'}
{$smarty.block.parent}</div>
{else}
{$smarty.block.parent}
{/if}
{/block}
@@ -85,7 +100,11 @@
$('#need_zip_code_on, #need_zip_code_off').change(function() {
disableZipFormat();
});
$('#iso_code').change(function() {
disableTAASC();
});
disableTAASC();
});
function switchExplanationText(text) {
+29 -2
View File
@@ -251,6 +251,26 @@ class AdminCountriesControllerCore extends AdminController
'encoding_default_layout' => urlencode($default_layout),
'display_valid_fields' => $this->displayValidFields()
),
array(
'type' => 'radio',
'label' => $this->l('Address Standardization:'),
'name' => 'standardization',
'required' => false,
'class' => 't',
'is_bool' => true,
'values' => array(
array(
'id' => 'standardization_on',
'value' => 1,
'label' => $this->l('Enabled')
),
array(
'id' => 'standardization_off',
'value' => 0,
'label' => $this->l('Disabled')
)
),
),
array(
'type' => 'radio',
'label' => $this->l('Active:'),
@@ -271,7 +291,7 @@ class AdminCountriesControllerCore extends AdminController
)
),
'desc' => $this->l('Display this country to your customers (the selected country will always be displayed in the Back Office)')
),
),
array(
'type' => 'radio',
'label' => $this->l('Contains following states:'),
@@ -330,6 +350,7 @@ class AdminCountriesControllerCore extends AdminController
)
)
)
);
if (Shop::isFeatureActive())
@@ -345,7 +366,10 @@ class AdminCountriesControllerCore extends AdminController
'title' => $this->l('Save '),
'class' => 'button'
);
if ($this->object->iso_code == 'US')
$this->object->standardization = Configuration::get('PS_TAASC');
return parent::renderForm();
}
@@ -362,6 +386,9 @@ class AdminCountriesControllerCore extends AdminController
if (!is_null($id_country) && $id_country != Tools::getValue('id_'.$this->table))
$this->errors[] = Tools::displayError('This ISO code already exists.You cannot create two countries with the same ISO code.');
}
if (Tools::isSubmit('standardization'))
Configuration::updateValue('PS_TAASC', (bool)Tools::getValue('standardization', false));
if (!count($this->errors))
$res = parent::postProcess();
+1 -1
View File
@@ -138,7 +138,7 @@ class AddressControllerCore extends FrontController
$this->errors[] = Tools::displayError('This country requires you to chose a State.');
// US customer: normalize the address
if ($address->id_country == Country::getByIso('US'))
if ($address->id_country == Country::getByIso('US') && Configuration::get('PS_TAASC'))
{
include_once(_PS_TAASC_PATH_.'AddressStandardizationSolution.php');
$normalize = new AddressStandardizationSolution;
+4
View File
@@ -489,7 +489,11 @@ class AuthControllerCore extends FrontController
$this->errors = array_unique(array_merge($this->errors, $address->validateController()));
// US customer: normalize the address
<<<<<<< HEAD
if ($address->id_country == Country::getByIso('US') && Configuration::get('PS_TAASC'))
=======
if ($address->id_country == Country::getByIso('US'))
>>>>>>> a04e6b1a67fc34bd1049e546283cb5a938fd2279
{
include_once(_PS_TAASC_PATH_.'AddressStandardizationSolution.php');
$normalize = new AddressStandardizationSolution;
+8
View File
@@ -577,6 +577,14 @@ function disableZipFormat()
$('.zip_code_format').show();
}
function disableTAASC()
{
if ($('#iso_code').val() == 'US')
$('#TAASC').show();
else
$('#TAASC').hide();
}
function spreadFees(id_range)
{
newVal = $('#fees_all_'+id_range).val().replace(/,/g, '.');