<?php
class Categorym extends CI_Model {
function __construct(){
parent::__construct();
}
function get_all_categories($extra_where=""){
if($extra_where != ""){
$this->db->where($extra_where);
}else{
$this->db->where(array("parent_id" => 0));
}
$this->db->order_by("category_name","asc");
$q = $this->db->get('categories');
$result = $q->result();
return $result;
}
function get_category_detail($cid){
$this->db->where("category_id",$cid);
$q = $this->db->get('categories');
$result = $q->result();
return $result;
}
function get_all_collections(){
$this->db->order_by("collection_name","asc");
$q = $this->db->get('collections');
$result = $q->result();
return $result;
}
function get_collection_cats($collection_id){
$this->db->where("collection_id",$collection_id);
$this->db->order_by("category_name","asc");
$q = $this->db->get('categories');
$result = $q->result();
return $result;
}
function get_collection ($cid,$limit){
$this->db->where("collection_id",$cid);
$this->db->limit($limit);
$q = $this->db->get('categories');
$result = $q->result();
return $result;
}
function get_sub_cats($category_id){
$this->db->where("parent_id",$category_id);
$this->db->order_by("category_name","asc");
$q = $this->db->get('categories');
$result = $q->result();
return $result;
}
}
@KyuuKazami