diff --git a/admin-dev/tabs/AdminGeolocation.php b/admin-dev/tabs/AdminGeolocation.php deleted file mode 100755 index 995acff10..000000000 --- a/admin-dev/tabs/AdminGeolocation.php +++ /dev/null @@ -1,187 +0,0 @@ - -* @copyright 2007-2011 PrestaShop SA -* @version Release: $Revision: 6844 $ -* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) -* International Registered Trademark & Property of PrestaShop SA -*/ - -class AdminGeolocation extends AdminTab -{ - public function display() - { - $this->context = Context::getContext(); - echo ' -

'.$this->l('Geolocation').'

- '; - - if (!$this->_isGeoLiteCityAvailable()) - $this->displayWarning($this->l('In order to use Geolocation, please download').' '.$this->l('this file').' '.$this->l('and decompress it into tools/geoip/ directory')); - - echo ' -
-
- '.$this->l('Geolocation by IP').' - - -
- - -

'.$this->l('This option allows you, among other things, to restrict access to your shop for many countries. See below.').'

-
- -
- -
-
-
- '; - $allowedCountries = explode(';', Configuration::get('PS_ALLOWED_COUNTRIES')); - echo ' -
-
- '.$this->l('Options').' - -
- '.$this->l('The following features are only available if you enable the Geolocation by IP feature.').' -
- - -
- -
- -
- - -
- -
- -
- - -
- - - - - - - - - '; - foreach (Country::getCountries($this->context->language->id) AS $country) - echo ' - - - - - '; - echo ' - -
'.$this->l('Name').'
'.Tools::htmlentitiesUTF8($country['name']).'
-
-
-
-
- -
-
-
- -
-
- '.$this->l('Whitelist of IP addresses').' - -
- '.$this->l('You can add many IP addresses, these addresses will always be allowed to access your shop (e.g. Google bots IP).').' -
- - -
- -
- -
- -
-
-
- '; - } - - public function postProcess() - { - if (Tools::isSubmit('submitGeolocationConfiguration')) - { - if ($this->_isGeoLiteCityAvailable()) - { - Configuration::updateValue('PS_GEOLOCATION_ENABLED', intval(Tools::getValue('PS_GEOLOCATION_ENABLED'))); - Tools::redirectAdmin(self::$currentIndex.'&token='.Tools::getValue('token').'&conf=4'); - } - else - $this->_errors[] = Tools::displayError('Geolocation database is unavailable.'); - } - - if (Tools::isSubmit('submitGeolocationCountries')) - { - if (!is_array(Tools::getValue('countries')) OR !sizeof(Tools::getValue('countries'))) - $this->_errors[] = Tools::displayError('Country selection is invalid'); - else - { - Configuration::updateValue('PS_GEOLOCATION_BEHAVIOR', (!(int)(Tools::getValue('PS_GEOLOCATION_BEHAVIOR')) ? _PS_GEOLOCATION_NO_CATALOG_ : _PS_GEOLOCATION_NO_ORDER_)); - Configuration::updateValue('PS_GEOLOCATION_NA_BEHAVIOR', (int)Tools::getValue('PS_GEOLOCATION_NA_BEHAVIOR')); - Configuration::updateValue('PS_ALLOWED_COUNTRIES', implode(';', Tools::getValue('countries'))); - Tools::redirectAdmin(self::$currentIndex.'&token='.Tools::getValue('token').'&conf=4'); - } - } - - if (Tools::isSubmit('submitGeolocationWhitelist')) - { - if (!Validate::isCleanHtml(Tools::getValue('PS_GEOLOCATION_WHITELIST'))) - $this->_errors[] = Tools::displayError('Invalid whitelist'); - else - { - Configuration::updateValue('PS_GEOLOCATION_WHITELIST', str_replace("\n", ';', str_replace("\r", '', Tools::getValue('PS_GEOLOCATION_WHITELIST')))); - Tools::redirectAdmin(self::$currentIndex.'&token='.Tools::getValue('token').'&conf=4'); - } - } - - return parent::postProcess(); - } - - private function _isGeoLiteCityAvailable() - { - if (file_exists(_PS_GEOIP_DIR_.'GeoLiteCity.dat')) - return true; - return false; - } -} - diff --git a/admin-dev/themes/template/options.tpl b/admin-dev/themes/template/options.tpl index 1bc4b78ab..2cdb05b77 100644 --- a/admin-dev/themes/template/options.tpl +++ b/admin-dev/themes/template/options.tpl @@ -46,6 +46,7 @@ {/if} {foreach $categoryData['fields'] AS $key => $field} + {if $field['type'] == 'hidden'} {else} @@ -57,8 +58,9 @@ {/if} {$field['title']} {/if} -
- + {block name="start_field_block"} +
+ {/block} {if $field['type'] == 'select'}