// Set a default country/timezone in installer, checking HTTP_ACCEPT_LANGUAGE #PSTEST-890

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@13714 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
rMalie
2012-02-29 09:02:36 +00:00
parent bae15bcbcc
commit d97ecb2315
3 changed files with 45 additions and 35 deletions
+15 -15
View File
@@ -266,21 +266,11 @@ class InstallControllerHttpConfigure extends InstallControllerHttp
$this->list_countries = array();
$countries = $this->language->getCountries();
$top_countries = array(
'fr',
'es',
'us',
'gb',
'it',
'de',
'nl',
'pl',
'id',
'be',
'br',
'se',
'ca',
'ru',
'cn',
'fr', 'es', 'us',
'gb', 'it', 'de',
'nl', 'pl', 'id',
'be', 'br', 'se',
'ca', 'ru', 'cn',
);
foreach ($top_countries as $iso)
@@ -291,6 +281,16 @@ class InstallControllerHttpConfigure extends InstallControllerHttp
if (!in_array($iso, $top_countries))
$this->list_countries[] = array('iso' => $iso, 'name' => $lang);
// Try to detect default country
if (!$this->session->shop_country)
{
$detect_language = $this->language->detectLanguage();
if (isset($detect_language['primarytag']))
{
$this->session->shop_country = (isset($detect_language['subtag'])) ? $detect_language['subtag'] : $detect_language['primarytag'];
$this->session->shop_timezone = $this->getTimezoneByIso($this->session->shop_country);
}
}
// Install type
$this->install_type = ($this->session->install_type) ? $this->session->install_type : 'full';