zone.php (666B)
1 <?php 2 class ModelLocalisationZone extends Model { 3 public function getZone($zone_id) { 4 $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "zone WHERE zone_id = '" . (int)$zone_id . "' AND status = '1'"); 5 6 return $query->row; 7 } 8 9 public function getZonesByCountryId($country_id) { 10 $zone_data = $this->cache->get('zone.' . (int)$country_id); 11 12 if (!$zone_data) { 13 $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "zone WHERE country_id = '" . (int)$country_id . "' AND status = '1' ORDER BY name"); 14 15 $zone_data = $query->rows; 16 17 $this->cache->set('zone.' . (int)$country_id, $zone_data); 18 } 19 20 return $zone_data; 21 } 22 }