diff options
Diffstat (limited to 'public/catalog/model/localisation/zone.php')
-rw-r--r-- | public/catalog/model/localisation/zone.php | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/public/catalog/model/localisation/zone.php b/public/catalog/model/localisation/zone.php new file mode 100644 index 0000000..2124672 --- /dev/null +++ b/public/catalog/model/localisation/zone.php @@ -0,0 +1,22 @@ +<?php +class ModelLocalisationZone extends Model { + public function getZone($zone_id) { + $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "zone WHERE zone_id = '" . (int)$zone_id . "' AND status = '1'"); + + return $query->row; + } + + public function getZonesByCountryId($country_id) { + $zone_data = $this->cache->get('zone.' . (int)$country_id); + + if (!$zone_data) { + $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "zone WHERE country_id = '" . (int)$country_id . "' AND status = '1' ORDER BY name"); + + $zone_data = $query->rows; + + $this->cache->set('zone.' . (int)$country_id, $zone_data); + } + + return $zone_data; + } +}
\ No newline at end of file |