?
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Productapi_model extends CI_Model{
function __construct()
{
parent::__construct();
}
public function getproductBycategory($catid="") {
// $cat_id=30;
$this->db->select('*');
$this->db->from('interface_procategories');
$this->db->join('tbl_product','interface_procategories.product_id=tbl_product.product_id','inner');
//$this->db->join('tbl_product_price','tbl_product_price.product_id=tbl_product_categories.product_id','inner');
$this->db->join('tbl_interface_product_images','interface_procategories.product_id=tbl_interface_product_images.product_id','inner');
$this->db->where('tbl_product.product_status','Enable');
$this->db->where('interface_procategories.sub_category_id',$catid);
$this->db->group_by('interface_procategories.product_id');
$query = $this->db->get();
//pr($this->db->last_query());die;
//$query->result();die;
return $query->result();
}
public function getproductBymultiplecategory($catid="") {
//$cat_id=30;
$this->db->select('*');
$this->db->from('interface_procategories');
$this->db->join('tbl_product','interface_procategories.product_id=tbl_product.product_id','inner');
$this->db->where('tbl_product.product_status','Enable');
$this->db->where_in('interface_procategories.sub_category_id',$catid);
$this->db->group_by('interface_procategories.product_id');
$query = $this->db->get();
//pr($this->db->last_query());die;
//$query->result();die;
return $query->result();
}
public function getcategoryParent($parentid=""){
$this->db->select("*");
$this->db->where('id',$parentid);
$this->db->limit('1','0');
$query=$this->db->get('tbl_categories');
return $query->result();
}
}
?>