is_guest) Tools::redirect('addresses.php'); if (Tools::isSubmit('id_country') AND Tools::getValue('id_country') != NULL AND is_numeric(Tools::getValue('id_country'))) $selectedCountry = (int)Tools::getValue('id_country'); elseif (isset($this->_address) AND isset($this->_address->id_country) AND !empty($this->_address->id_country) AND is_numeric($this->_address->id_country)) $selectedCountry = (int)$this->_address->id_country; elseif (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { $array = preg_split('/,|-/', $_SERVER['HTTP_ACCEPT_LANGUAGE']); if (!Validate::isLanguageIsoCode($array[0]) OR !($selectedCountry = Country::getByIso($array[0]))) $selectedCountry = (int)Configuration::get('PS_COUNTRY_DEFAULT'); } else $selectedCountry = (int)Configuration::get('PS_COUNTRY_DEFAULT'); if (Configuration::get('PS_RESTRICT_DELIVERED_COUNTRIES')) $countries = Carrier::getDeliveredCountries((int)self::$cookie->id_lang, true, true); else $countries = Country::getCountries((int)self::$cookie->id_lang, true); $countriesList = ''; foreach ($countries AS $country) $countriesList .= ''; if ((Configuration::get('VATNUMBER_MANAGEMENT') AND file_exists(_PS_MODULE_DIR_.'vatnumber/vatnumber.php')) && VatNumber::isApplicable(Configuration::get('PS_COUNTRY_DEFAULT'))) self::$smarty->assign('vat_display', 2); elseif (Configuration::get('VATNUMBER_MANAGEMENT')) self::$smarty->assign('vat_display', 1); else self::$smarty->assign('vat_display', 0); self::$smarty->assign('ajaxurl', _MODULE_DIR_); self::$smarty->assign('vatnumber_ajax_call', (int)file_exists(_PS_MODULE_DIR_.'vatnumber/ajax.php')); self::$smarty->assign(array( 'address_ac_token' => (self::$cookie->isLogged()? Tools::encrypt(date('Y-m-d').self::$cookie->id_customer.'Wb62nI1mcPdwyqqt'): ''), 'countries_list' => $countriesList, 'countries' => $countries, 'errors' => $this->errors, 'token' => Tools::getToken(false), 'select_address' => (int)(Tools::getValue('select_address')) )); } }