diff --git a/admin-dev/themes/default/template/controllers/tax_rules/helpers/form/form.tpl b/admin-dev/themes/default/template/controllers/tax_rules/helpers/form/form.tpl index fd3c1f170..9d925f503 100644 --- a/admin-dev/themes/default/template/controllers/tax_rules/helpers/form/form.tpl +++ b/admin-dev/themes/default/template/controllers/tax_rules/helpers/form/form.tpl @@ -62,7 +62,7 @@ $.ajax({ url: "index.php", cache: false, - data: "ajax=1&tab=AdminTaxRulesGroup&token={getAdminToken tab='AdminTaxRulesGroup'}&action=states&id_country="+id_country+"&id_state="+id_state+"&empty_value={l s='All'}", + data: "ajax=1&tab=AdminTaxRulesGroup&token={getAdminToken tab='AdminStates'}&action=states&id_country="+id_country+"&id_state="+id_state+"&empty_value={l s='All'}", success: function(html){ if (html == "false") { diff --git a/admin-dev/themes/default/template/helpers/form/form.tpl b/admin-dev/themes/default/template/helpers/form/form.tpl index 84424ff6f..ee9ee638a 100644 --- a/admin-dev/themes/default/template/helpers/form/form.tpl +++ b/admin-dev/themes/default/template/helpers/form/form.tpl @@ -455,6 +455,7 @@ }); }); + state_token = '{getAdminToken tab='AdminStates'}'; {block name="script"}{/block} {/if} diff --git a/controllers/admin/AdminStatesController.php b/controllers/admin/AdminStatesController.php index 6b2dc99d0..7c90eceb3 100644 --- a/controllers/admin/AdminStatesController.php +++ b/controllers/admin/AdminStatesController.php @@ -236,6 +236,34 @@ class AdminStatesControllerCore extends AdminController else parent::postProcess(); } -} + protected function displayAjaxStates() + { + if ($this->tabAccess['view'] === '1') + { + $states = Db::getInstance()->executeS(' + SELECT s.id_state, s.name + FROM '._DB_PREFIX_.'state s + LEFT JOIN '._DB_PREFIX_.'country c ON (s.`id_country` = c.`id_country`) + WHERE s.id_country = '.(int)(Tools::getValue('id_country')).' AND s.active = 1 AND c.`contains_states` = 1 + ORDER BY s.`name` ASC'); + if (is_array($states) AND !empty($states)) + { + $list = ''; + if (Tools::getValue('no_empty') != true) + { + $empty_value = (Tools::isSubmit('empty_value')) ? Tools::getValue('empty_value') : '----------'; + $list = ''."\n"; + } + + foreach ($states AS $state) + $list .= ''."\n"; + } + else + $list = 'false'; + + die($list); + } + } +} \ No newline at end of file diff --git a/controllers/admin/AdminTaxRulesGroupController.php b/controllers/admin/AdminTaxRulesGroupController.php index 8563d1c63..c36597348 100644 --- a/controllers/admin/AdminTaxRulesGroupController.php +++ b/controllers/admin/AdminTaxRulesGroupController.php @@ -519,35 +519,5 @@ class AdminTaxRulesGroupControllerCore extends AdminController die(Tools::jsonEncode($output)); } } - - protected function displayAjaxStates() - { - if ($this->tabAccess['view'] === '1') - { - $states = Db::getInstance()->executeS(' - SELECT s.id_state, s.name - FROM '._DB_PREFIX_.'state s - LEFT JOIN '._DB_PREFIX_.'country c ON (s.`id_country` = c.`id_country`) - WHERE s.id_country = '.(int)(Tools::getValue('id_country')).' AND s.active = 1 AND c.`contains_states` = 1 - ORDER BY s.`name` ASC'); - - if (is_array($states) AND !empty($states)) - { - $list = ''; - if (Tools::getValue('no_empty') != true) - { - $empty_value = (Tools::isSubmit('empty_value')) ? Tools::getValue('empty_value') : '----------'; - $list = ''."\n"; - } - - foreach ($states AS $state) - $list .= ''."\n"; - } - else - $list = 'false'; - - die($list); - } - } }