403Webshell
Server IP : 68.178.202.69  /  Your IP : 216.73.216.122
Web Server : Apache
System : Linux 69.202.178.68.host.secureserver.net 3.10.0-1160.139.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Nov 3 13:30:41 UTC 2025 x86_64
User : ikioworld ( 1005)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/ikioworld/public_html/application/models/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/ikioworld/public_html/application/models/Productsdisplay.php
<?php
class Productsdisplay extends CI_Model
{
    function __construct()
    {
        parent::__construct();
         $this->load->database();
        $this->table_name = 'product';
    }
   
    function fetch_details($id){
        if($id!=''){
           $this->db->select('*');
           $this->db->where('id',$id);
           $query = $this->db->get($this->table_name);
           return $query->row();
        }
    }
    
   function get_total_records(){
       return $query = $this->db->count_all_results($this->table_name);
    }
    
   function get_contents($start, $limit){
       $this->db->select('*');
       $this->db->order_by($this->table_name.".id");
       $this->db->limit( $start, $limit);  
       $query = $this->db->get($this->table_name);
       return $query->result();
  }
  
  function deletebrand($id){
       $this->db->where('id', $id);
       $this->db->delete($this->table_name);
  }
  
   
     function getAllCategories($item_id='')
    {
         
        if($item_id!=''){
      
       $query = $this->db->where('product_type',$item_id);
     }
      $query = $this->db->get('category');
       return $query->result(); 
    }
    
    function addEnquiry($data){
        if(!empty($data)){
          unset($data['sbt']);
          unset($data['g-recaptcha-response']);
          
           $this->table_name='enquiry'; 
           $this->db->insert($this->table_name,$data);
            $insert_id = $this->db->insert_id();
            return $insert_id;
           //echo $this->db->last_query(); die;
        }
    }

    
    
  
function get_category($item_id){
    if($item_id!=''){
       $this->db->select('*');
       $this->db->order_by("category_name", "ASC");
       $query = $this->db->where('product_type',$item_id);
       $query = $this->db->get('category');
       return $query->result(); 
     }
   }
   
  function get_products()
    {
        if(isset($_GET['sort'])!="") {
            $sort = $_GET['sort'];
            $this->db->select('*');
            $this->db->select('product.id');
            
            $this->db->from('product');
            $this->db->join('category',"category.id=product.product_category");
            $this->db->join('product_images',"product.id=product_images.product_id ");
            $this->db->where("product.status='active'");
            $this->db->order_by("product.product_name",$sort);  
            $query = $this->db->get(); 
            return $query->result(); 
        }
        if(isset($_GET['getCat'])!="") {
            $cat = $_GET['getCat'];
            // var_dump($_GET);exit;
            $this->db->select('*');
            $this->db->select('product.id');
            
            $this->db->from('product');
            $this->db->join('category',"category.id=product.product_category");
            $this->db->join('product_images',"product.id=product_images.product_id ");
            $this->db->where("product.status='active'");
            $this->db->where("product.product_category",$cat);  
            $query = $this->db->get(); 
            return $query->result(); 
        }
        if(isset($_GET['sort'])!="" && isset($_GET['getCat'])!="") {
            $sort = $_GET['sort'];
            $cat = $_GET['getCat'];
            $this->db->select('*');
            $this->db->select('product.id');
            
            $this->db->from('product');
            $this->db->join('category',"category.id=product.product_category");
            $this->db->join('product_images',"product.id=product_images.product_id ");
            $this->db->where("product.status='active'");
            $this->db->where("product.product_category",$cat); 
            $this->db->order_by("product.product_name",$sort);  
            
            $query = $this->db->get(); 
            return $query->result(); 
        }
      else{
        $this->db->select('*');
        $this->db->select('product.id as prodID');
        
        $this->db->from('product');
        $this->db->join('category',"category.id=product.product_category");
        $this->db->join('subcategory',"subcategory.id=product.product_subcategory");
        $this->db->join('product_images',"product.id=product_images.product_id ");
        $this->db->where("product.status='active'");
        // $this->db->order_by("product.product_name",$sort);
        $query = $this->db->get(); 
        return $query->result();
    }
}
 
    function get_launch_products()
    {
        if(isset($_GET['sort'])!="") {
            $sort = $_GET['sort'];
            $this->db->select('*');
            $this->db->select('product.id');
            
            $this->db->from('product');
            $this->db->join('category',"category.id=product.product_category");
            $this->db->join('product_images',"product.id=product_images.product_id ");
            $this->db->where("product.status='active'");
            $this->db->where("product.new_launch='1'");
            $this->db->order_by("product.product_name",$sort);  
            $query = $this->db->get(); 
            return $query->result(); 
        }
        if(isset($_GET['getCat'])!="") {
            $cat = $_GET['getCat'];
            // var_dump($_GET);exit;
            $this->db->select('*');
            $this->db->select('product.id');
            
            $this->db->from('product');
            $this->db->join('category',"category.id=product.product_category");
            $this->db->join('product_images',"product.id=product_images.product_id ");
            $this->db->where("product.status='active'");
            $this->db->where("product.new_launch='1'");
            $this->db->where("product.product_category",$cat);  
            $query = $this->db->get(); 
            return $query->result(); 
        }
        if(isset($_GET['sort'])!="" && isset($_GET['getCat'])!="") {
            $sort = $_GET['sort'];
            $cat = $_GET['getCat'];
            $this->db->select('*');
            $this->db->select('product.id');
            
            $this->db->from('product');
            $this->db->join('category',"category.id=product.product_category");
            $this->db->join('product_images',"product.id=product_images.product_id ");
            $this->db->where("product.status='active'");
            $this->db->where("product.product_category",$cat); 
            $this->db->where("product.new_launch='1'");
            $this->db->order_by("product.product_name",$sort);  
            
            $query = $this->db->get(); 
            return $query->result(); 
        }  else {
            $this->db->select('*');
            $this->db->select('product.id as prodID');
            
            $this->db->from('product');
            $this->db->join('category',"category.id=product.product_category");
            $this->db->join('subcategory',"subcategory.id=product.product_subcategory");
            $this->db->join('product_images',"product.id=product_images.product_id ");
            $this->db->where("product.new_launch='1'");
            $this->db->where("product.status='active'");
            // $this->db->order_by("product.product_name",$sort);
            $query = $this->db->get(); 
            return $query->result();
        }
    }  
   
     function getCategories()
    {
        $this->db->where("status='active'");
        $query = $this->db->get('category');
        return $query->result();
    }   
    
     function getSubCategories()
    {
        $this->db->where("status='active'");
        $query = $this->db->get('subcategory');
        return $query->result();
    }       

     function getAllType()
    {
        $query = $this->db->get('type');
        return $query->result();
    }

    function getAllApps()
    {
        $query = $this->db->get('application');
        return $query->result();
    }

    function getAllVariant()
    {
        $query = $this->db->get('variant');
        return $query->result();
        
    }

    function getAllFeatures()
    {
        $query = $this->db->get('feature');
        return $query->result();
    }

    function getAllRating()
    {
        $query = $this->db->get('rating');
        return $query->result();
    }
    
        
function get_compdetails($slug,$sub,$cat,$img){
    $this->db->select('*');
    $this->db->select('product.id as prodID');
    $this->db->select('product.featured_image');
    $this->db->select('category.slug as cat_slug');
    $this->db->select('subcategory.slug as subcat_slug');
    $this->db->select('product.features as prodfeatures');
    $this->db->from('product');
    $this->db->join('category',"category.id=product.product_category");
    $this->db->join('subcategory',"subcategory.id=product.product_subcategory");
    if($img!=""){
    $this->db->join('product_images',"product.id=product_images.product_id ");
    }
    $this->db->where('product.slug',$slug);
    $this->db->where('product.product_category',$cat);
    $this->db->where('product.product_subcategory',$sub);
   
    $query = $this->db->get(); 
    return $query->result();
}
function get_compRelated($slug,$sub,$cat,$img,$id)
{
    $this->db->select('*');
    $this->db->select('product.id as prodID');
    $this->db->select('product.slug as prodslug');
    $this->db->select('product.featured_image as image');
    $this->db->from('product');
    $this->db->join('category',"category.id=product.product_category");
    $this->db->join('subcategory',"subcategory.id=product.product_subcategory");
    if($img!=""){
    $this->db->join('product_images',"product.id=product_images.product_id ");
    }
    
    $this->db->where('product.slug !=',$slug);
    $this->db->where('product.product_category',$cat);
    $this->db->where('product.product_subcategory',$id);
    $this->db->order_by('rand()');
    $query = $this->db->get(); 
    return $query->result();
}


    function getAllCompanyProduct1($catid)
    {
            $this->db->select('*');
            $this->db->select('product.slug as productid');
            $this->db->select('product.featured_image as image');
            $this->db->from('product');
            $this->db->join('product_company',"product.id=product_company.product_id");
            $this->db->where('product_company.company_id',$catid);
            $this->db->where('product.product_category','1');
            $query = $this->db->get(); 
            return $query->result(); 
    }
    
      function getAllCompanyProduct2($catid)
    {
            $this->db->select('*');
            $this->db->select('product.slug as productid');
            $this->db->select('product.featured_image as image');
            $this->db->from('product');
            $this->db->join('product_company',"product.id=product_company.product_id");
            $this->db->where('product_company.company_id',$catid);
             $this->db->where('product.product_category','2');
            $query = $this->db->get(); 
            return $query->result(); 
    }
    
    
      function getAllCompanyProduct3($catid)
    {
            $this->db->select('*');
            $this->db->select('product.slug as productid');
            $this->db->select('product.featured_image as image');
            $this->db->from('product');
            $this->db->join('product_company',"product.id=product_company.product_id");
            $this->db->where('product_company.company_id',$catid);
             $this->db->where('product.product_category','4');
            $query = $this->db->get(); 
            return $query->result(); 
    }
    
    
      function getAllCompanyProduct4($catid)
    {
            $this->db->select('*');
            $this->db->select('product.slug as productid');
            $this->db->select('product.featured_image as image');
            $this->db->from('product');
            $this->db->join('product_company',"product.id=product_company.product_id");
            $this->db->where('product_company.company_id',$catid);
             $this->db->where('product.product_category','5');
            $query = $this->db->get(); 
            return $query->result(); 
    }

    function getAllCompanyProduct5($catid)
    {
            $this->db->select('*');
            $this->db->select('product.slug as productid');
            $this->db->select('product.featured_image as image');
            $this->db->from('product');
            $this->db->join('product_company',"product.id=product_company.product_id");
            $this->db->where('product_company.company_id',$catid);
            $this->db->where('product.product_category','8');
            $query = $this->db->get(); 
            return $query->result(); 
    }
    
    
    
    function get_Related($slug,$sub,$cat,$img)
    {
        $this->db->select('*');
        $this->db->select('product.id as prodID');
        $this->db->select('product.slug as prodslug');
        $this->db->select('product.featured_image as image');
        $this->db->from('product');
        $this->db->join('category',"category.id=product.product_category");
        $this->db->join('subcategory',"subcategory.id=product.product_subcategory");
        if($img!=""){
        $this->db->join('product_images',"product.id=product_images.product_id ");
        }
        $this->db->where('product.slug !=',$slug);
         $this->db->where('product.product_category',$cat);
        // $this->db->where('product.product_subcategory',$sub);
        $this->db->where("product.status='active'");
        $this->db->order_by('rand()');
        $query = $this->db->get(); 
        return $query->result();
    }
    
    function getAllCategoryProduct($catid)
    {
            $this->db->select('*');
            $this->db->select('product.slug as productid');
             $this->db->select('product.featured_image as image');
            $this->db->from('product');
            $this->db->join('category',"category.id=product.product_category");

            $this->db->where('product.product_category',$catid);
            $this->db->where("product.status='active'");
            // $this->db->group_by('product.product_name');
            $query = $this->db->get(); 
            return $query->result(); 
    }
    
    
    
    
    function getAllSubcategoryProduct($subcatid)
    {
            $this->db->select('*');
            $this->db->select('product.id as productid');
            $this->db->select('product.featured_image');
            $this->db->from('product');
            $this->db->join('category',"category.id=product.product_category");
            $this->db->join('subcategory',"subcategory.id = product.product_subcategory");
            $this->db->join('product_images',"product.id=product_images.product_id ");
            $this->db->where('product.product_subcategory',$subcatid);
            $this->db->where("product.status='active'");
            $query = $this->db->get(); 
            return $query->result(); 
    }
    
    
    
function make_query($sort_by)
 {
  $query = "
  SELECT DISTINCT product.*,product.slug as prodID,product.featured_image as img FROM product 
   WHERE product.status = 'active' 
 ";
  
  if(isset($sort_by))
  {
      $query .= "ORDER BY  ".$sort_by." 
      ";
  }
  
  return $query;
 }   
 
 function make_launch_query()
 {
  $query = "
  SELECT DISTINCT product.*,product.slug as prodID,product.featured_image as img FROM product 
   WHERE product.status = 'active' AND product.new_launch=1
 ";
  
  
  return $query;
 } 
 
 function make_query1($rating, $feature, $variant,$application,$type,$sort_by,$subcatid)
 {
  $query = "
  SELECT DISTINCT product.*,product.slug as prodID,category.category_name,subcategory.name,product.featured_image as image FROM product
  left JOIN product_application ON product_application.product_id=product.id
  left JOIN product_feature ON 	product_feature.product_id=product.id 
  left JOIN product_rating  ON 	product_rating.product_id=product.id
  left JOIN product_type    ON 	product_type.product_id=product.id
  left JOIN product_variant ON 	product_variant.product_id=product.id
  left JOIN product_images  ON 	product_images.product_id=product.id 
  left JOIN category        ON  category.id=product.product_category
  left JOIN subcategory     ON  subcategory.id=product.product_subcategory
  WHERE product.status = 'active'  AND product.product_subcategory='$subcatid'
 ";
  
  if(isset($application))
  {
   $application_filter = implode("','", $application);
   $query .= "
    AND product_application.product_application IN ('".$application_filter."')
   ";
  }
 
if(isset($type))
  {
   $type_filter = implode("','", $type);
   $query .= "
    AND product_type.product_type IN('".$type_filter."')
   ";
  }
  
  if(isset($variant))
  {
   $variant_filter = implode("','", $variant);
   $query .= "
    AND product_variant.product_variant IN ('".$variant_filter."')
   ";
  }
 
  if(isset($feature))
  {
   $feature_filter = implode("','", $feature);
   $query .= "
    AND product_feature.product_feature IN ('".$feature_filter."')
   ";
  }
  
if(isset($rating))
  {
   $rating_filter = implode("','", $rating);
   $query .= "
    AND product_rating.product_rating IN ('".$rating_filter."')
   ";
  }
  
  if(isset($subcategory))
  {
     $query .="
     AND product.product_subcategory ='".$subcategory."' 
     "; 
  }
  
  if(isset($sort_by))
  {
      $query .= "ORDER BY ".$sort_by." 
      ";
  }
  
  return $query;
 }   
 function count_all($sort_by)
 {
  $query = $this->make_query($sort_by);
  $data = $this->db->query($query);
  return $data->num_rows();
 }  
 function count_launch_all()
 {
  $query = $this->make_launch_query();
  $data = $this->db->query($query);
  return $data->num_rows();
 }  
 

function count_all1($rating,$feature,$variant,$application,$type,$sort_by,$subcatid)
 {
  $query = $this->make_query1($rating,$feature,$variant,$application,$type,$sort_by,$subcatid);
  $data = $this->db->query($query);
  return $data->num_rows();
 }  
function countWhere($where){
		$this -> db -> where($where);
        $query = $this -> db -> get($this->table_name);
        return $query->num_rows();
}

function launch_data($limit,$start)
 {
  $query = $this->make_launch_query();

  $query .= ' LIMIT '.$start.',' . $limit;

  $data = $this->db->query($query);

  $output = '';
  if($data->num_rows() > 0)
  {
   foreach($data->result_array() as $row)
   {
       
     $product_id = $row['prodID'];
     $product_name =$row['product_name'];
     $item_name = $row['product_tagline'];
    
     $output.='<div class="col-md-3">
                            <div class="ikio__main_product_boxes">
                               <a href='.base_url().'product/'.$product_id.'>
                                    <div class="ikio_main_productImage">
                                        <img src="'.base_url().'uploads/product/'.$row['featured_image'].'">
                                    </div>
                                    <div class="ikio_mian_productMeta_info">
                                        <h6>'.$product_name.'</h6>
                                        <span>'.$item_name.'</span>
                                    </div>
                                </a>
                            </div>
                </div>
    ';    
   }
  }
  else
  {
   $output = '<img src="'.base_url().'assets/img/404.jpg" class="no_data">';
  }
  return $output;
 } 
 
 function fetch_data($limit,$start,$sort_by)
 {
  $query = $this->make_query($sort_by);

  $query .= ' LIMIT '.$start.',' . $limit;

  $data = $this->db->query($query);

  $output = '';
  if($data->num_rows() > 0)
  {
   foreach($data->result_array() as $row)
   {
       
     $product_id = $row['prodID'];
     $product_name =$row['product_name'];
     $item_name = $row['product_tagline'];
    
     $output.='<div class="col-md-3">
                            <div class="ikio__main_product_boxes">
                               <a href='.base_url().'product/'.$product_id.'>
                                    <div class="ikio_main_productImage">
                                        <img src="'.base_url().'uploads/product/'.$row['featured_image'].'">
                                    </div>
                                    <div class="ikio_mian_productMeta_info">
                                        <h6>'.$product_name.'</h6>
                                        <span>'.$item_name.'</span>
                                    </div>
                                </a>
                            </div>
                </div>
    ';    
   }
  }
  else
  {
   $output = '<img src="'.base_url().'assets/img/404.jpg" class="no_data">';
  }
  return $output;
 }   
function fetch_data12($limit,$start,$rating,$feature,$variant,$application,$type,$sort_by,$subcatid){
      
    $query = "SELECT DISTINCT product.*,product.slug as prodID,product.featured_image as image FROM product  WHERE product.status = 'active' AND product.product_subcategory='$subcatid' ";
    if(isset($sort_by))
  {
      $query .= "ORDER BY ".$sort_by." 
      ";
  }
  //   $query .= ' LIMIT '.$start.', ' . $limit;
  
    $data = $this->db->query($query);
    $product_subcategory = array();
    $output = '';
    if($data->num_rows() > 0)
    {
     foreach($data->result_array() as $row)
     {
         
       $product_id = $row['prodID'];
       $product_name =$row['product_name'];
       $item_name = $row['product_tagline'];
         
       $output.='<div class="col-md-3">
                              <div class="ikio__main_product_boxes">
                                 <a href='.base_url().'product/'.$product_id.'>
                                      <div class="ikio_main_productImage">
                                          <img src="'.base_url().'uploads/product/'. $row['image'] .'">
                                      </div>
                                      <div class="ikio_mian_productMeta_info">
                                          <h6>'.$product_name.'</h6>
                                          <span>'.$item_name.'</span>
                                      </div>
                                  </a>
                              </div>
                  </div>
      ';    
     }
    }
    else
    {
     $output = '<img src="'.base_url().'assets/img/404.jpg" class="no_data">';
    }
  
    return $output;
   }  
   function fetch_data13($limit,$start,$rating,$feature,$variant,$application,$type,$sort_by,$subcatid){
      
    $query = "SELECT DISTINCT product.*,product.slug as prodID,product.featured_image as image FROM product left JOIN product_variant ON 	product_variant.product_id=product.id left JOIN product_type    ON 	product_type.product_id=product.id WHERE product.status = 'active' AND product.product_subcategory='$subcatid' ";
    if(isset($type))
  {
   $type_filter = implode("','", $type);
   $query .= "
    AND product_type.product_type IN('".$type_filter."')
   ";
  }
  
  if(isset($variant))
  {
   $variant_filter = implode("','", $variant);
   $query .= "
    AND product_variant.product_variant IN ('".$variant_filter."')
   ";
  }
    if(isset($sort_by))
  {
      $query .= "ORDER BY ".$sort_by." 
      ";
  }
  
    $data = $this->db->query($query);
    $product_subcategory = array();
    $output = '';
    if($data->num_rows() > 0)
    {
     foreach($data->result_array() as $row)
     {
         
       $product_id = $row['prodID'];
       $product_name =$row['product_name'];
       $item_name = $row['product_tagline'];
         
       $output.='<div class="col-md-3">
                              <div class="ikio__main_product_boxes">
                                 <a href='.base_url().'product/'.$product_id.'>
                                      <div class="ikio_main_productImage">
                                          <img src="'.base_url().'uploads/product/'. $row['image'] .'">
                                      </div>
                                      <div class="ikio_mian_productMeta_info">
                                          <h6>'.$product_name.'</h6>
                                          <span>'.$item_name.'</span>
                                      </div>
                                  </a>
                              </div>
                  </div>
      ';    
     }
    }
    else
    {
     $output = '<img src="'.base_url().'assets/img/404.jpg" class="no_data">';
    }
  
    return $output;
   }  
  
  function fetch_data1($limit,$start,$rating,$feature,$variant,$application,$type,$sort_by,$subcatid){
      
  $query = $this->make_query1($rating,$feature,$variant,$application,$type,$sort_by,$subcatid);
 
//   $query .= ' LIMIT '.$start.', ' . $limit;

  $data = $this->db->query($query);
  $product_subcategory = array();
  $output = '';
  if($data->num_rows() > 0)
  {
   foreach($data->result_array() as $row)
   {
       
     $product_id = $row['prodID'];
     $product_name =$row['product_name'];
     $item_name = $row['product_tagline'];
       
     $output.='<div class="col-md-3">
                            <div class="ikio__main_product_boxes">
                               <a href='.base_url().'product/'.$product_id.'>
                                    <div class="ikio_main_productImage">
                                        <img src="'.base_url().'uploads/product/'. $row['image'] .'">
                                    </div>
                                    <div class="ikio_mian_productMeta_info">
                                        <h6>'.$product_name.'</h6>
                                        <span>'.$item_name.'</span>
                                    </div>
                                </a>
                            </div>
                </div>
    ';    
   }
  }
  else
  {
   $output = '<img src="'.base_url().'assets/img/404.jpg" class="no_data">';
  }

  return $output;
 }   


  function fetch_data11($limit,$start,$rating,$feature,$variant,$application,$type,$sort_by,$subcatid){
      
  $query = $this->make_query1($rating,$feature,$variant,$application,$type,$sort_by,$subcatid);

//   $query .= ' LIMIT '.$start.', ' . $limit;

  $data = $this->db->query($query);
  $product_subcategory = array();
  $output = '';
  if($data->num_rows() > 0)
  {
   foreach($data->result_array() as $row)
   {
       
     $product_id = $row['prodID'];
     $product_name =$row['product_name'];
     $item_name = $row['product_tagline'];   
    $product_subcategory[] = $row['id'];
   }
  }
  else
  {
   $output = '<img src="'.base_url().'assets/img/404.jpg" class="no_data">';
  }
  $outputfilt =''; 
$product_subcategory =  array_unique($product_subcategory);
$pid = implode(",",$product_subcategory);
if(!empty($pid)){
$varid='';
      $query121 = "SELECT product_type,count(product_type) FROM product_type WHERE product_id IN($pid) GROUP BY product_type
      HAVING COUNT(product_type) > 0;";
      $data451 = $this->db->query($query121);



if($data451->num_rows() > 0)
{
 foreach($data451->result_array() as $row451)
 {
     if(empty($varid)){
      $varid=$row451['product_type'];
     }
     else{
      $varid=$varid.','.$row451['product_type'];
     }
  }


     
     
     $query = "SELECT  * FROM `type` WHERE id IN($varid)"; 
      $data = $this->db->query($query);
 if($data->num_rows() > 0)
  {
   foreach($data->result_array() as $type)
   {
       $type_id = $type['id'];
       $type_name =$type['type_name'];
       $outputfilt.=' <li>
                                            <div class="form-group ikio_filter_group ">
                                                <input type="checkbox" id="'.$type_name.'"  class="type_checkbox common_selector"  value="'.$type_id.'">
                                                <label for="'.$type_name.'">'.$type_name.'</label>
                                            </div>
                                        </li>'; 
       
   }
  }

 }
}
  return $outputfilt;
 }   

  function variant_data($subid,$subcatid)
 {
     
     $base= base_url();
  $query = "
  SELECT  product_filters.* FROM product_filters 
  left JOIN subcategory_filter ON subcategory_filter.name=product_filters.id
  left JOIN subcategory ON 	subcategory.id=subcategory_filter.subcategory_id 
  WHERE subcategory.slug = '$subid'";
  $data = $this->db->query($query);

  $output = '';
       $output.='    
                    <div class="ikio__product_filter_horizontal ">
                        <ul class="nav nav-tabs horizontal__filter_styl" id="myTab" role="tablist">';
  if($data->num_rows() > 0)
  {
   foreach($data->result_array() as $row)
   {
       
     $fitter_id = $row['id'];
     $fitter_name =$row['filter_name'];
     
 
                            $output.='  <li class="nav-item ">
                                <a class="nav-link tablinks" id="'.$fitter_name.'-tab" data-toggle="tab" href="#'.$fitter_name.'" role="tab"
                                    aria-controls="'.$fitter_name.'" aria-selected="true"  >'.$fitter_name.'</a>
                            </li>';
                             
                      
     
   }
   
  }
   $output.='  </ul>
                        <div class="tab-content sub_category_content " id="myTabContent">';
   $query = "SELECT  product_filters.* FROM product_filters 
  left JOIN subcategory_filter ON subcategory_filter.name=product_filters.id
  left JOIN subcategory ON 	subcategory.id=subcategory_filter.subcategory_id    
  WHERE subcategory.slug = '$subid'";
  $data = $this->db->query($query);

 
        
  if($data->num_rows() > 0)
  {
   foreach($data->result_array() as $row)
   {
       
     $fitter_id = $row['id'];
     $fitter_name =$row['filter_name'];
     if($fitter_name == "Type"){
        $verientid = "subcat";
     }else{
        $verientid = "";
     }
     $output .='<div class="tab-pane fade" id="'.$fitter_name.'" role="tabpanel" aria-labelledby="'.$fitter_name.'-tab">
                                <div class="horizontal__filters_values" >
                                    <ul id="'.$verientid.'">';
 if($fitter_name == "Variant"){
    $pid='';
      $query12 = "SELECT * FROM product WHERE product_subcategory = '$subcatid'";
  $data45 = $this->db->query($query12);

 
        
  if($data45->num_rows() > 0)
  {
   foreach($data45->result_array() as $row45)
   {
       if(empty($pid) ){
        $pid=$row45['id'];
       }
       else{
        $pid=$pid.','.$row45['id']; 
       }

    }
}
$varid='';
        $query121 = "SELECT product_variant,count(product_variant) FROM product_variant WHERE product_id IN($pid) GROUP BY product_variant
        HAVING COUNT(product_variant) > 0;";
        $data451 = $this->db->query($query121);

 
        
  if($data451->num_rows() > 0)
  {
   foreach($data451->result_array() as $row451)
   {
       if(empty( $varid)){
        $varid=$row451['product_variant'];
       }
       else{
        $varid=$varid.','.$row451['product_variant'];
       }
    }

}
      $query = "SELECT * FROM  variant WHERE id IN($varid)"; 
      $data = $this->db->query($query);
 if($data->num_rows() > 0)
  {
   foreach($data->result_array() as $variant)
   { 
       $variant_id = $variant['id'];
     $variant_name =$variant['variant_name'];
      $output.=' <li>
                                            <div class="form-group ikio_filter_group">
                                                <input type="checkbox" class="variant_checkbox common_selector" type="checkbox" id="'.$variant_name.'" value="'.$variant_id.'">
                                                <label for="'.$variant_name.'">'.$variant_name.'</label>
                                            </div>
                                        </li>'; 
       
  
   }
  }
   
   
 }
 else if($fitter_name == "Type"){
     
    $pid='';
    $query12 = "SELECT * FROM product WHERE product_subcategory = '$subcatid'";
$data45 = $this->db->query($query12);


      
if($data45->num_rows() > 0)
{
 foreach($data45->result_array() as $row45)
 {
     if(empty($pid) ){
      $pid=$row45['id'];
     }
     else{
      $pid=$pid.','.$row45['id']; 
     }

  }
}
$varid='';
      $query121 = "SELECT product_type,count(product_type) FROM product_type WHERE product_id IN($pid) GROUP BY product_type
      HAVING COUNT(product_type) > 0;";
      $data451 = $this->db->query($query121);


      
if($data451->num_rows() > 0)
{
 foreach($data451->result_array() as $row451)
 {
     if(empty($varid)){
      $varid=$row451['product_type'];
     }
     else{
      $varid=$varid.','.$row451['product_type'];
     }
  }

}
     
     
     $query = "SELECT  * FROM `type` WHERE id IN($varid)"; 
      $data = $this->db->query($query);
 if($data->num_rows() > 0)
  {
   foreach($data->result_array() as $type)
   {
       $type_id = $type['id'];
       $type_name =$type['type_name'];
       $output.=' <li>
                                            <div class="form-group ikio_filter_group ">
                                                <input type="checkbox" id="'.$type_name.'"  class="type_checkbox common_selector"  value="'.$type_id.'">
                                                <label for="'.$type_name.'">'.$type_name.'</label>
                                            </div>
                                        </li>'; 
       
   }
  }
   
 }
   if($fitter_name == "Rating"){
     
    $pid='';
    $query12 = "SELECT * FROM product WHERE product_subcategory = '$subcatid'";
$data45 = $this->db->query($query12);


      
if($data45->num_rows() > 0)
{
 foreach($data45->result_array() as $row45)
 {
     if(empty($pid) ){
      $pid=$row45['id'];
     }
     else{
      $pid=$pid.','.$row45['id']; 
     }

  }
}
$varid='';
      $query121 = "SELECT product_rating,count(product_rating) FROM product_rating WHERE product_id IN($pid) GROUP BY product_rating
      HAVING COUNT(product_rating) > 0;";
      $data451 = $this->db->query($query121);


      
if($data451->num_rows() > 0)
{
 foreach($data451->result_array() as $row451)
 {
     if(empty( $varid)){
      $varid=$row451['product_rating'];
     }
     else{
      $varid=$varid.','.$row451['product_rating'];
     }
  }

}
     
     $query = "SELECT  * FROM  rating WHERE id IN($varid)"; 
      $data = $this->db->query($query);
 if($data->num_rows() > 0)
  {
   foreach($data->result_array() as $rating)
   {
       $ratintg_id = $rating['id'];
     $ratintg_name =$rating['rating_name'];
      $output.=' <li>
                                            <div class="form-group ikio_filter_group tabcontent">
                                                <input type="checkbox" id="'.$ratintg_id.'"  class="rating_checkbox common_selector"  value="'.$ratintg_id.'">
                                                <label for="'.$ratintg_name.'">'.$ratintg_name.'</label>
                                            </div>
                                        </li>'; 
       
   }
  }
   
 } 
                             
     if($fitter_name == "Feature"){
   
        $pid='';
        $query12 = "SELECT * FROM product WHERE product_subcategory = '$subcatid'";
    $data45 = $this->db->query($query12);
    
    
          
    if($data45->num_rows() > 0)
    {
     foreach($data45->result_array() as $row45)
     {
         if(empty($pid) ){
          $pid=$row45['id'];
         }
         else{
          $pid=$pid.','.$row45['id']; 
         }
    
      }
    }
    $varid='';
          $query121 = "SELECT product_features,count(product_features) FROM product_feature WHERE product_id IN($pid) GROUP BY product_features
          HAVING COUNT(product_features) > 0;";
          $data451 = $this->db->query($query121);
    
    
          
    if($data451->num_rows() > 0)
    {
     foreach($data451->result_array() as $row451)
     {
         if(empty( $varid)){
          $varid=$row451['product_features'];
         }
         else{
          $varid=$varid.','.$row451['product_features'];
         }
      }
    
    }
     
       
     $query = "SELECT  * FROM  feature WHERE id IN($varid)"; 
      $data = $this->db->query($query);
 if($data->num_rows() > 0)
  {
   foreach($data->result_array() as $feature)
   {
       $feature_id = $feature['id'];
     $feature_name =$feature['feature_name'];
      $output.=' <li>
                                            <div class="form-group ikio_filter_group">
                                                <input type="checkbox"id="'.$feature_id.'"  class="feature_checkbox common_selector"  value="'.$feature_id.'">
                                                <label for="'.$feature_name.'">'.$feature_name.'</label>
                                            </div>
                                        </li>'; 
       
   }
  }
  
 }     
   if($fitter_name == "Application"){
   
    $pid='';
    $query12 = "SELECT * FROM product WHERE product_subcategory = '$subcatid'";
$data45 = $this->db->query($query12);


      
if($data45->num_rows() > 0)
{
 foreach($data45->result_array() as $row45)
 {
     if(empty($pid) ){
      $pid=$row45['id'];
     }
     else{
      $pid=$pid.','.$row45['id']; 
     }

  }
}
$varid='';
      $query121 = "SELECT product_application,count(product_application) FROM product_application WHERE product_id IN($pid) GROUP BY product_application
      HAVING COUNT(product_application) > 0;";
      $data451 = $this->db->query($query121);


      
if($data451->num_rows() > 0)
{
 foreach($data451->result_array() as $row451)
 {
     if(empty( $varid)){
      $varid=$row451['product_application'];
     }
     else{
      $varid=$varid.','.$row451['product_application'];
     }
  }

}
     
       
     $query = "SELECT * FROM application WHERE id IN($varid)"; 
      $data = $this->db->query($query);
 if($data->num_rows() > 0)
  {
   foreach($data->result_array() as $application)
   {
       $application_id = $application['id'];
     $application_name =$application['application_name'];
      $output.=' <li>
                                            <div class="form-group ikio_filter_group">
                                                <input type="checkbox" id="'.$application_id.'"  class="application_checkbox common_selector"  value="'.$application_id.'">
                                                <label for="'.$application_name.'">'.$application_name.'</label>
                                            </div>
                                        </li>'; 
       
   }
  }

   }
  
  $output.=' </ul>
                                </div>
                            </div>';
  }
 }
  else  {
  
  }
                     
                           
                         $output.=' </div>';
     
                    
            $output.='        <script>
                    $(document).ready(function(){
                          function filter_data12(page)
    {
           var action = "fetch_data";
        var sort_by = $("#select_id").val(); 
        var limit = $("#Sort__filters").val();
         var subid="'. $subid.'";
        var application_checkbox = get_filter("application_checkbox");
        var variant_checkbox = get_filter("variant_checkbox");
        var type_checkbox = get_filter("type_checkbox");
        var feature_checkbox = get_filter("feature_checkbox");
        var rating_checkbox = get_filter("rating_checkbox");
  
       
        $.ajax({
            url:"'.$base.'product/fetch_datasub1/"+page,
            method:"POST",
            dataType:"JSON",
            data:{action:action,subid:subid,variant_checkbox:variant_checkbox,type_checkbox:type_checkbox,feature_checkbox:feature_checkbox,application_checkbox:application_checkbox,rating_checkbox:rating_checkbox,sort_by:sort_by,limit:limit},
            success:function(data)
            {
             
                $(".filter_data").html(data.product_list);
                $("#subcat").html(data.subcat);
                $("#pagination_link").html(data.pagination_link);
            }
        })
    }

    function get_filter(class_name)
    {
        var filter = [];
        $("."+class_name+":checked").each(function(){
            filter.push($(this).val());
        });
        return filter;
    }
function getQueryStringValue(key) {  
  return decodeURIComponent(window.location.search.replace(new RegExp("^(?:.*[&\\?]" + encodeURIComponent(key).replace(/[\.\+\*]/g, "\\$&") + "(?:\\=([^&]*))?)?.*$", "i"), "$1"));  
} 
function getUrlVars() {
    var vars = {};
    var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
        vars[key] = value;
    });
    return vars;
}

    $(document).on("click", ".pagination li a", function(event){
        event.preventDefault();
        var page = $(this).data("ci-pagination-page");
        filter_data(page);
    }); 

    $(".common_selector").click(function(){
        filter_data12(1);
    });
});
                    </script>';
                     
                    
   
 
  return $output;
 }      

    
function get_details($slug,$sub,$cat,$img){
        $this->db->select('*');
        $this->db->select('product.id as prodID');
        $this->db->select('product.featured_image');
        $this->db->select('category.slug as cat_slug');
        $this->db->select('subcategory.slug as subcat_slug');
        $this->db->select('product.features as prodfeatures');
        $this->db->from('product');
        $this->db->join('category',"category.id=product.product_category");
        $this->db->join('subcategory',"subcategory.id=product.product_subcategory");
        if($img!=""){
        $this->db->join('product_images',"product.id=product_images.product_id ");
        }
        $this->db->where('product.slug',$slug);
        $this->db->where('product.product_category',$cat);
        $this->db->where('product.product_subcategory',$sub);
        $this->db->where("product.status='active'");
        $query = $this->db->get(); 
        return $query->result();
    } 
    
   function prod_Check($prod)
   {
    $this->db->select('product_name');
    $this->db->from('product');
    $this->db->where('product.product_name',$prod);
    $query = $this->db->get(); 
    return $query->result();

   }
  
    
}   

Youez - 2016 - github.com/yon3zu
LinuXploit