<?php
class ModelDesignBanner extends Model {	
	public function getBanner($banner_id) {
		$sql = "
			SELECT * 
			FROM " . DB_PREFIX . "banner_image bi 
			INNER JOIN " . DB_PREFIX . "banner b ON (bi.banner_id = b.banner_id)
			LEFT JOIN " . DB_PREFIX . "banner_image_description bid ON (bi.banner_image_id  = bid.banner_image_id) 
			WHERE bi.banner_id = '" . (int)$banner_id . "' 
			AND bid.language_id = '" . (int)$this->config->get('config_language_id') . "' 
			AND bi.image IS NOT NULL
			AND bi.image <> ''
			AND b.`status` = 1
		";
		// $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "banner_image bi LEFT JOIN " . DB_PREFIX . "banner_image_description bid ON (bi.banner_image_id  = bid.banner_image_id) WHERE bi.banner_id = '" . (int)$banner_id . "' AND bid.language_id = '" . (int)$this->config->get('config_language_id') . "' AND bi.image <> ''");
		$query = $this->db->query($sql);
		
		return $query->rows;
	}
	public function getBannerName($banner_id) {
	    $query = $this->db->query("SELECT DISTINCT name FROM " . DB_PREFIX . "banner WHERE banner_id = '" . (int)$banner_id . "'");
	    
	    if (isset($query->row['name'])){
	       return $query->row['name'];
	    }
	    
	}	
	
}
