1: | <?php
|
2: | namespace Opencart\Catalog\Model\Localisation;
|
3: | |
4: | |
5: | |
6: | |
7: |
|
8: | class Zone extends \Opencart\System\Engine\Model {
|
9: | |
10: | |
11: | |
12: | |
13: | |
14: | |
15: |
|
16: | public function getZone(int $zone_id): array {
|
17: | $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "zone` WHERE `zone_id` = '" . (int)$zone_id . "' AND `status` = '1'");
|
18: |
|
19: | return $query->row;
|
20: | }
|
21: |
|
22: | |
23: | |
24: | |
25: | |
26: | |
27: | |
28: |
|
29: | public function getZonesByCountryId(int $country_id): array {
|
30: | $sql = "SELECT * FROM `" . DB_PREFIX . "zone` WHERE `country_id` = '" . (int)$country_id . "' AND `status` = '1' ORDER BY `name`";
|
31: |
|
32: | $key = md5($sql);
|
33: |
|
34: | $zone_data = $this->cache->get('zone.' . $key);
|
35: |
|
36: | if (!$zone_data) {
|
37: | $query = $this->db->query($sql);
|
38: |
|
39: | $zone_data = $query->rows;
|
40: |
|
41: | $this->cache->set('zone.' . $key, $zone_data);
|
42: | }
|
43: |
|
44: | return $zone_data;
|
45: | }
|
46: | }
|
47: | |