Система регионов

This commit is contained in:
Konstantin
2026-05-30 15:15:57 +03:00
parent 7cd87e901f
commit e843f3019d
18 changed files with 293 additions and 54 deletions
+17 -6
View File
@@ -19,7 +19,7 @@ class ControllerCommonCity extends Controller {
);
}
$data['action'] = $this->url->link('common/city/save');
$data['action'] = $this->url->link('common/city/save', '', true);
$this->response->setOutput($this->load->view('common/city_list', $data));
}
@@ -28,12 +28,23 @@ class ControllerCommonCity extends Controller {
$json = array();
if (isset($this->request->post['city_id'])) {
$this->session->data['city_id'] = (int)$this->request->post['city_id'];
$json['success'] = true;
$this->load->model('localisation/zone');
$zone = $this->model_localisation_zone->getZone($this->session->data['city_id']);
$json['name'] = $zone ? $zone['name'] : '';
$zone = $this->model_localisation_zone->getZone((int)$this->request->post['city_id']);
if (!$zone || (int)$zone['country_id'] !== (int)$this->config->get('config_country_id')) {
$json['success'] = false;
$this->response->addHeader('Content-Type: application/json');
$this->response->setOutput(json_encode($json));
return;
}
$this->session->data['city_id'] = (int)$zone['zone_id'];
$json['success'] = true;
$json['name'] = $zone['name'];
$json['redirect'] = $this->model_localisation_zone->getZoneUrl($zone['zone_id'], isset($this->request->post['redirect']) ? $this->request->post['redirect'] : $this->url->link('common/home'));
} else {
$json['success'] = false;
}
+1 -1
View File
@@ -118,7 +118,7 @@ foreach(['name','email','telephone','address','open', 'comment'] as $item){
}
}
$data['city_list_url'] = $this->url->link('common/city');
$data['city_list_url'] = $this->url->link('common/city', '', true);
return $this->load->view('common/header', $data);
}