| Server IP : 103.48.194.25 / Your IP : 216.73.216.47 Web Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.33 System : Linux VMHostDefault 3.10.0-1160.42.2.el7.x86_64 #1 SMP Tue Sep 7 14:49:57 UTC 2021 x86_64 User : sieuthimay ( 1016) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/zomuaban.com/public_html/webadmin/models/ |
Upload File : |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class ajax_model extends CI_Model
{
function __construct() {
parent::__construct();
}
function get_last_order(){
$this->db->order_by('CartID','DESC');
$this->db->where('Status !=','Status');
$this->db->where('IsDelete',0);
return $this->db->get('shoppingcart',5,0)->result();
}
/****
* Thong bao chuyen khoan moi nhat
*/
function get_transfer_notice_last(){
$this->db->select('account.*,transfernotice.*');
$this->db->join('account','account.AccountID = transfernotice.AccountID');
$this->db->order_by('transfernotice.TransferID','DESC');
$this->db->limit('10');
return $this->db->get('transfernotice')->result();
}
/*****
* Tinh tong san pham trong moi don hang
*
* @param mixed $CartID
*/
function get_sum_product($CartID){
$this->db->select_sum('Quantity','total');
$this->db->from('cartdetail');
$this->db->where('CartID',$CartID);
$query = $this->db->get();
return $query->row()->total;
}
/********
* Tinh tong tien trong moi don hang
*
* @param mixed $CartID
*/
function get_sum_price($CartID){
$this->db->where('CartID',$CartID);
$list = $this->db->get('cartdetail')->result();
$total = 0;
foreach($list as $rs):
$total = $total + ($rs->Price * $rs->Quantity);
endforeach;
return $total;
}
/********
* Upload img
*/
function add_img($filename,$ProductID,$session){
if($ProductID!=0){
if($filename!=''){
fn_resize_image('../uploads/images/'.$filename,'../uploads/product/200/'.$filename,200,200);
fn_resize_image('../uploads/images/'.$filename,'../uploads/product/80/'.$filename,80,80);
fn_resize_image('../uploads/images/'.$filename,'../uploads/product/40/'.$filename,40,40);
fn_resize_image('../uploads/images/'.$filename,'../uploads/product/30/'.$filename,30,30);
}
}
$data = array(
'ImagePath' => $filename,
'ProductID' => (int)$ProductID,
'ImageSession' => ($ProductID!=0)?'':$session
);
$this->db->insert('productimage',$data);
return $this->db->insert_id();;
}
/*
* @author : Vo Van Hieu
* @method : set active/deactive
* @param :
* @date : 2/10/2012
* @modify :
*/
function setActiveDeactive($table,$field,$id,$pub){
$this->db->set('bl_active',$pub);
$this->db->where($field,$id);
$this->db->update($table);
}
}
?>