diff --git a/controllers/admin/AdminStatesController.php b/controllers/admin/AdminStatesController.php
index c1b95db7b..57d5f42cc 100644
--- a/controllers/admin/AdminStatesController.php
+++ b/controllers/admin/AdminStatesController.php
@@ -244,4 +244,35 @@ class AdminStatesControllerCore extends AdminController
if (!count($this->errors))
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);
+ }
+ }
+
}