[-] FO : standardize behavior of selected country in the list when create a new address

This commit is contained in:
vAugagneur
2013-04-11 10:30:22 +02:00
parent f43aee9a25
commit 7a27fa2f64
+11 -2
View File
@@ -104,12 +104,21 @@ class AuthControllerCore extends FrontController
$countries = Carrier::getDeliveredCountries($this->context->language->id, true, true);
else
$countries = Country::getCountries($this->context->language->id, true);
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE']))
{
$array = preg_split('/,|-/', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
if (!Validate::isLanguageIsoCode($array[0]) || !($sl_country = Country::getByIso($array[0])))
$sl_country = (int)Configuration::get('PS_COUNTRY_DEFAULT');
}
else
$sl_country = (int)Tools::getValue('id_country', Configuration::get('PS_COUNTRY_DEFAULT'));
$this->context->smarty->assign(array(
'inOrderProcess' => true,
'PS_GUEST_CHECKOUT_ENABLED' => Configuration::get('PS_GUEST_CHECKOUT_ENABLED'),
'PS_REGISTRATION_PROCESS_TYPE' => Configuration::get('PS_REGISTRATION_PROCESS_TYPE'),
'sl_country' => (int)Tools::getValue('id_country', Configuration::get('PS_COUNTRY_DEFAULT')),
'sl_country' => (int)$sl_country,
'countries' => $countries
));
}