diff --git a/admin-dev/themes/template/helper/options/options.tpl b/admin-dev/themes/template/helper/options/options.tpl index c8c330e1f..efe8b945b 100644 --- a/admin-dev/themes/template/helper/options/options.tpl +++ b/admin-dev/themes/template/helper/options/options.tpl @@ -207,3 +207,4 @@
{/foreach} +{block name="after"}{/block} diff --git a/admin-dev/themes/template/localization/options.tpl b/admin-dev/themes/template/localization/options.tpl new file mode 100644 index 000000000..66fc8879e --- /dev/null +++ b/admin-dev/themes/template/localization/options.tpl @@ -0,0 +1,37 @@ +{extends file="helper/options/options.tpl"} +{block name="after"} +
+{if $localizations_pack} +
+
+ {l s='Localization pack import'} +
+ + +
+ +
+
+ +
+ {l s='States'}
+ {l s='Taxes'}
+ {l s='Currencies'}
+ {l s='Languages'}
+ {l s='Units (e.g., weight, volume, distance)'} +
+
+ +
+
+
+
+
+{else} +

{l s='Cannot connect to prestashop.com'}

+{/if} +{/block} diff --git a/admin-dev/tabs/AdminLocalization.php b/controllers/admin/AdminLocalizationController.php similarity index 63% rename from admin-dev/tabs/AdminLocalization.php rename to controllers/admin/AdminLocalizationController.php index cc1d409ce..493386c13 100644 --- a/admin-dev/tabs/AdminLocalization.php +++ b/controllers/admin/AdminLocalizationController.php @@ -25,9 +25,7 @@ * International Registered Trademark & Property of PrestaShop SA */ -include_once(_PS_ADMIN_DIR_.'/tabs/AdminPreferences.php'); - -class AdminLocalization extends AdminPreferences +class AdminLocalizationController extends AdminController { public function __construct() { @@ -36,7 +34,7 @@ class AdminLocalization extends AdminPreferences parent::__construct(); - $this->optionsList = array( + $this->options = array( 'localization' => array( 'title' => $this->l('Localization'), 'width' => 'width2', @@ -47,6 +45,7 @@ class AdminLocalization extends AdminPreferences 'PS_VOLUME_UNIT' => array('title' => $this->l('Volume unit:'), 'desc' => $this->l('The volume unit of your shop'), 'validation' => 'isWeightUnit', 'required' => true, 'type' => 'text'), 'PS_DIMENSION_UNIT' => array('title' => $this->l('Dimension unit:'), 'desc' => $this->l('The dimension unit of your shop (eg. cm or in)'), 'validation' => 'isDistanceUnit', 'required' => true, 'type' => 'text'), ), + 'submit' => array('title' => $this->l(' Save '), 'class' => 'button') ), 'options' => array( 'title' => $this->l('Advanced'), @@ -56,6 +55,7 @@ class AdminLocalization extends AdminPreferences 'PS_LOCALE_LANGUAGE' => array('title' => $this->l('Language locale:'), 'desc' => $this->l('Your server\'s language locale.'), 'validation' => 'isLanguageIsoCode', 'type' => 'text', 'visibility' => Shop::CONTEXT_ALL), 'PS_LOCALE_COUNTRY' => array('title' => $this->l('Country locale:'), 'desc' => $this->l('Your server\'s country locale.'), 'validation' => 'isLanguageIsoCode', 'type' => 'text', 'visibility' => Shop::CONTEXT_ALL) ), + 'submit' => array('title' => $this->l(' Save '), 'class' => 'button') ), ); } @@ -87,46 +87,24 @@ class AdminLocalization extends AdminPreferences parent::postProcess(); } - public function display() + public function initContent() { - $this->displayOptionsList(); + $localizations_pack = false; + $this->tpl_option_vars['options_content'] = $this->initOptions(); - echo '
-
-
- '.$this->l('Localization pack import').' -
- -
-
-
- -
- '.$this->l('States').'
- '.$this->l('Taxes').'
- '.$this->l('Currencies').'
- '.$this->l('Languages').'
- '.$this->l('Units (e.g., weight, volume, distance)').' -
-
- -
-
-
-
-
'; + $xml_localization = Tools::simplexml_load_file('http://www.prestashop.com/rss/localization.xml'); + if (!$xml_localization) + { + $localizationFile = dirname(__FILE__).'/../../localization/localization.xml'; + if (file_exists($localizationFile)) + $xml_localization = simplexml_load_file($localizationFile); + } + + if ($xml_localization) + foreach($xml_localization->pack as $pack) + $localizations_pack[(string)$pack->iso] = (string)$pack->name; + + $this->tpl_option_vars['localizations_pack'] = $localizations_pack; + parent::initContent(); } }