https://t.me/RX1948
Server : Apache/2.4.18 (Ubuntu)
System : Linux canvaswebdesign 3.13.0-71-generic #114-Ubuntu SMP Tue Dec 1 02:34:22 UTC 2015 x86_64
User : oppastar ( 1041)
PHP Version : 7.0.33-0ubuntu0.16.04.15
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
Directory :  /var/www/rabbithabit.com/public_html/application/models/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //var/www/rabbithabit.com/public_html/application/models/Product_attributes_m.php
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Product_attributes_m extends MY_Model {
	
	protected $_table_name = 'product_attributes';
	protected $_primary_key = 'id';
	protected $_order_by = 'id';

	public $rules = array(  
	    array(
	         'field'   => 'attribute',
	         'label'   => 'atribut (id)',
	         'rules'   => 'trim|required|callback__cek_existing_attribute'
	    ),  
	    array(
	         'field'   => 'attribute_en',
	         'label'   => 'atribut (en)',
	         'rules'   => 'trim|required|callback__cek_existing_attribute_en'
	    ),  
    );

    public $detail_rules = array(  
	    array(
	         'field'   => 'attribute_detail',
	         'label'   => 'detil atribut (id)',
	         'rules'   => 'trim|required'
	         /* 'rules'   => 'trim|required|callback__cek_existing_detail_title' */
	    ),  
	     array(
	         'field'   => 'attribute_detail_en',
	         'label'   => 'detil atribut (en)',
	         'rules'   => 'trim|required'
	         /* 'rules'   => 'trim|required|callback__cek_existing_detail_title_en' */
	    ),  
    );
 
	function __construct() {
		parent::__construct();	 
	}	

	public function record_count() {
        return $this->db->get('product_attributes')->num_rows();
    }

    public function record_count_detail($attribute_id) {
        $this->db->select('id')->from('product_attributes_detail')->where('product_attribute_id', $attribute_id);
        $count = $this->db->get()->num_rows();
        return $count;
    }

    function get_all_attributes($limit, $start) {
		$this->db->select('*');
		$this->db->from('product_attributes');
		$this->db->limit($limit, $start);
		$this->db->order_by('is_color, priority', 'ASC');
		$query = $this->db->get();		
		return $query->result();
	}

	public function get_new() {
		$attribute = new stdClass();
		$attribute->product_attribute = '';
		$attribute->product_attribute_en = '';
		$attribute->is_color = '';
		return $attribute;
	}

	public function count_exist($id) {
        $this->db->select('*');
        $this->db->from('product_attributes');
        $this->db->where('id', $id);
        $query = $this->db->get();		
		return $query->num_rows();
    }

    public function count_exist_detail($attribute_id, $detail_id) {
        $this->db->select('id');
        $this->db->from('product_attributes_detail');
        $this->db->where('id', $detail_id);
        $this->db->where('product_attribute_id', $attribute_id);
        $query = $this->db->get();		
		return $query->num_rows();
    }

	public function cek_existing_attribute($str, $attribute_id) {
		$this->db->select('id');
		$this->db->from('product_attributes');
		$this->db->where('product_attribute', $str);
		
		if ($attribute_id != NULL) {
			$this->db->where('id !=', $attribute_id);	
		} 
		$query = $this->db->get();
		return $query->num_rows();
	}

	public function cek_existing_attribute_en($str, $attribute_id) {
		$this->db->select('id');
		$this->db->from('product_attributes');
		$this->db->where('product_attribute_en', $str);
		
		if ($attribute_id != NULL) {
			$this->db->where('id !=', $attribute_id);	
		} 
		$query = $this->db->get();
		return $query->num_rows();
	}

	function add_attribute($data) {
		$this->db->insert('product_attributes', $data);	
		return $this->db->insert_id();	 
	}

	function edit_attribute($id, $data) {
		$this->db->where('id', $id);
		$this->db->update('product_attributes', $data);	
	}


	function get_all_attribute_details($attribute_id) {
		$this->db->select('*');
		$this->db->from('product_attributes_detail');
		$this->db->where('product_attribute_id', $attribute_id);
		$this->db->order_by('priority', 'ASC');
		$query = $this->db->get();		
		return $query->result();
	}

	public function get_new_detail() {
		$detail = new stdClass(); 
		$detail->attribute_detail = '';
		$detail->attribute_detail_en = '';
		$detail->id = '';	
		return $detail;
	}

	//function edit product_attribute
	function edit_attribute_detail($id, $data) {
		$this->db->where('id', $id);
		$this->db->update('product_attributes_detail', $data);	
	}

	//function add new product_attribute
	function add_attribute_detail($data) {
		$this->db->insert('product_attributes_detail', $data);	
		return $this->db->insert_id();	 
	}












	
	
	


	

	//get all product_size 
	function get_product_size() {
		$this->db->select('*'); 
		$this->db->from('product_size');
		$query = $this->db->get();		
		return $query->result();
	}

    //FOR FRONT END REGISTRATION PAGE
    
    //get all product_size to display at front registration page, with status display 1 only
	function get_product_size_display_on() {
		$this->db->select('*');
		$this->db->from('product_size');
		$this->db->where('status', '1');
		$this->db->where('id_product_size !=', '0');
		$this->db->order_by('id_product_size asc');
		$query = $this->db->get();		
		return $query->result();
	}


	

	//cek if size title already exist
	public function cek_existing_detail_title($str, $detail_id) {

		$this->db->select('id');
		$this->db->from('product_attributes_detail');
		$this->db->where('attribute_detail', $str);
		
		if ($detail_id != NULL) {
			$this->db->where('id !=', $detail_id);	
		} 

		$query = $this->db->get();
		return $query->num_rows();
	}

	//cek if size title already exist
	public function cek_existing_detail_title_en($str, $detail_id) {

		$this->db->select('id');
		$this->db->from('product_attributes_detail');
		$this->db->where('attribute_detail_en', $str);
		
		if ($detail_id != NULL) {
			$this->db->where('id !=', $detail_id);	
		} 

		$query = $this->db->get();
		return $query->num_rows();
	}
	
	
	
	
}

https://t.me/RX1948 - 2025