From 7a27fa2f64b9f2278b1f753c29d791d145368aad Mon Sep 17 00:00:00 2001 From: vAugagneur Date: Thu, 11 Apr 2013 10:30:22 +0200 Subject: [PATCH] [-] FO : standardize behavior of selected country in the list when create a new address --- controllers/front/AuthController.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/controllers/front/AuthController.php b/controllers/front/AuthController.php index 727945eb2..7c7d6b5ef 100644 --- a/controllers/front/AuthController.php +++ b/controllers/front/AuthController.php @@ -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 )); }