<?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) {

	  $sql = "SELECT * FROM " . DB_PREFIX . "zone WHERE country_id = '" . (int)$country_id . "' AND status = '1' ORDER BY name";
    $query = $this->db->query($sql, true);
    $zone_data = $query->rows;
	
		return $zone_data;
	}
        
	public function getZoneByCountryId($country_id, $code) {
        $query = $this->db->query("SELECT zone_id FROM " . DB_PREFIX . "zone WHERE country_id = '" . (int)$country_id . "' AND code = '".$code."' AND status = '1' ORDER BY name");
	        	
		return $query->row['zone_id'];
	}        
        
}
