| Server IP : 103.48.194.25 / Your IP : 216.73.217.33 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 : 8.2.20 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/thegioimaycongnghiep.vn/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('cart_id','DESC');
$this->db->where('status',0);
$this->db->where('is_delete',0);
return $this->db->get('cart',12,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 $cart_id
*/
function get_sum_product($cart_id)
{
$this->db->select_sum('Quantity','total');
$this->db->from('cartdetail');
$this->db->where('cart_id',$cart_id);
$query = $this->db->get();
return $query->row()->total;
}
/********
* Tinh tong tien trong moi don hang
*
* @param mixed $cart_id
*/
function get_sum_price($cart_id)
{
$this->db->where('cart_id',$cart_id);
$list = $this->db->get('cartdetail')->result();
$total = 0;
foreach($list as $rs):
$total = $total + ($rs->price * $rs->Quantity);
endforeach;
return $total;
}
function add_img($filename,$proid,$ext,$session)
{
$data = array(
'proid' => (int)$proid,
'ImageName' => $filename,
'ImagePath' => 'images/'.date('Y').'/'.date('m').'/',
'ImageType' => 1,
'ImageSession' => $session
);
$this->db->insert('productimage',$data);
return $this->db->insert_id();;
}
function setActiveDeactive($table,$field,$id,$pub)
{
$this->db->set('bl_active',$pub);
$this->db->where($field,$id);
$this->db->update($table);
}
}
?>