| Server IP : 68.178.202.69 / Your IP : 216.73.216.174 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/www/application/models/ |
Upload File : |
<?php
class Productmodel extends CI_Model
{
function __construct()
{
parent::__construct();
$this->load->database();
$this->table_name = 'product';
}
function add($data){
if(!empty($data)){
// print_r($data);exit;
unset($data['sbt']);
unset($data['product_type']);
unset($data['application_area']);
unset($data['product_images']);
unset($data['product_variant']);
unset($data['product_features']);
unset($data['product_rating']);
unset($data['product_color']);
unset($data['product_tech']);
unset($data['product_company']);
unset($data['tech_heading1']);
unset($data['tech_documents']);
$this->db->insert($this->table_name,$data);
$insert_id = $this->db->insert_id();
return $insert_id;
// echo $this->db->last_query(); die;
}
}
function edit($id,$data){
if(!empty($data) && $id!=''){
unset($data['sbt']);
unset($data['product_type']);
unset($data['application_area']);
unset($data['product_images']);
unset($data['product_variant']);
unset($data['product_features']);
unset($data['product_rating']);
unset($data['product_color']);
unset($data['product_tech']);
unset($data['product_company']);
unset($data['tech_heading1']);
unset($data['tech_documents']);
$this->db->where('id',$id);
return $this->db->update($this->table_name,$data);
//echo $this->db->last_query(); die;
}
}
function fetch_details($id){
if($id!=''){
$this->db->select('*');
$this->db->from('product');
$this->db->where('product.id',$id);
$query = $this->db->get();
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('*');
if(isset($_GET['product_category'])){
$cat = $_GET['product_category'];
$this->db->where("product.product_category",$cat);
$this->db->order_by($this->table_name.".id", "desc");
$query = $this->db->get($this->table_name);
return $query->result();
}
elseif(isset($_GET['product_subcategory'])){
$subcat = $_GET['product_subcategory'];
$this->db->where("product.product_subcategory",$subcat);
$this->db->order_by($this->table_name.".id", "desc");
$query = $this->db->get($this->table_name);
return $query->result();
}
else{}
$this->db->order_by($this->table_name.".id", "desc");
$query = $this->db->get($this->table_name);
return $query->result();
}
function get_featured_total_records(){
$this->db->where("is_featured='yes'");
return $query = $this->db->count_all_results($this->table_name);
}
function get_featured_contents($start, $limit){
$this->db->select('*');
$this->db->where("is_featured='yes'");
$this->db->order_by($this->table_name.".id", "desc");
$query = $this->db->get($this->table_name);
return $query->result();
}
function deleteProduct($id){
$this->db->where('id', $id);
$this->db->delete($this->table_name);
}
function deleteallproduct($id){
$this->db->where('id', $id);
$this->db->delete('product_images');
}
function deleteallproductimages($id){
$this->db->where('product_id', $id);
$this->db->delete('product_images');
}
function deleteallproducts($id){
$this->db->where('id', $id);
$this->db->delete('product');
}
function getAllCategories()
{
$query = $this->db->get('category');
return $query->result();
}
function getAllSubCategories()
{
$query = $this->db->get('subcategory');
return $query->result();
}
function getAllCompanies()
{
$query = $this->db->get('company');
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 fetch_subcategory($item_id)
{
$this->db->where('category_type', $item_id);
$this->db->order_by('name', 'ASC');
$query = $this->db->get('subcategory');
$output = '<option value="">Select Sub Category</option>';
foreach($query->result() as $row)
{
$output .= '<option value="'.$row->subcategory_id.'">'.$row->subcategory_name.'</option>';
}
return $output;
}
function get_category(){
$this->db->select('*');
$query = $this->db->get('category');
return $query->result();
}
function get_subcategory($item_id){
if($item_id!=''){
$this->db->select('*');
$this->db->order_by("name", "ASC");
$query = $this->db->where('category_type',$item_id);
$query = $this->db->get('subcategory');
return $query->result();
}
}
function count_feature_product($product_id){
$this->db->where('product_id',$product_id);
$this->db->where('features','yes');
return $query = $this->db->count_all_results('product_images');
}
function get_export_data(){
$this->db->select(["product_category","product_subcategory","product_name","featured_image","product_tagline","product_short_description","product_long_description","features","video_link","meta_title","meta_description","meta_keyword","product_right_top_image","product_left_bottom_image","ordering_information","accessories","slug"]);
$this->db->order_by($this->table_name.".id", "desc");
$query = $this->db->get($this->table_name);
return $query->result_array();
}
function delete_product($id)
{
$this->db->where('id', $id);
$this->db->delete('product');
}
function make_featured($id)
{
$this->db->set('is_featured','yes');
$this->db->where('id', $id);
$this->db->update('product');
}
function remove_featured($id)
{
$this->db->set('is_featured','no');
$this->db->where('id', $id);
$this->db->update('product');
}
function make_activated($id)
{
$this->db->set('status','active');
$this->db->where('id', $id);
$this->db->update('product');
}
function remove_activated($id)
{
$this->db->set('status','inactive');
$this->db->where('id', $id);
$this->db->update('product');
}
}