function list_order_products_view($q = array(), $type = 'arr', $order = NULL, $op = 'ASC')
 {
     $this->db->select('*');
     $this->db->from($this->view);
     $this->db->where($q);
     $query = $this->db->get();
     return Product::result_as($query, $type);
 }
 function list_order_status($q = array(), $type = 'arr')
 {
     $this->db->select('*');
     $this->db->from($this->table);
     $this->db->where($q);
     $this->db->order_by('order_status_sort', 'ASC');
     $query = $this->db->get();
     return Product::result_as($query, $type);
 }
Example #3
0
 function list_prices($q = array(), $type = 'arr')
 {
     $this->db->select('*');
     $this->db->from('price');
     $this->db->join('level', 'price_level_id = level_id');
     $this->db->where($q);
     $this->db->where('level_order >', 0);
     $this->db->order_by('level_order');
     $query = $this->db->get();
     return Product::result_as($query, $type);
 }
Example #4
0
 function list_orders_with_dealer($q = array(), $lim = 0, $off = 0, $type = 'arr', $sort = 'order_id DESC', $op = 'DESC')
 {
     $this->db->select('*');
     $this->db->from($this->table);
     $this->db->join('dealer', 'dealer_id = order_dealer_id');
     $this->db->join('order_status', 'order_status_id = order_order_status_id');
     $this->db->where($q);
     $this->db->order_by($sort);
     $this->db->limit($lim, $off);
     $query = $this->db->get();
     return Product::result_as($query, $type);
 }
Example #5
0
 function list_dealers($q = array(), $lim = 0, $off = 0, $type = "arr", $sort = 'level_order DESC')
 {
     $this->db->select('*');
     $this->db->from($this->table);
     $this->db->join('level', 'level_id = dealer_level_id');
     $this->db->where($q);
     $this->db->where('dealer_status', 1);
     $this->db->limit($lim, $off);
     $this->db->order_by($sort);
     $query = $this->db->get();
     return Product::result_as($query, $type);
 }
Example #6
0
 function list_hot_products($q = array(), $lim = 0, $off = 0, $type = 'arr')
 {
     $this->db->select('*, sum(order_product_quantity) as amount');
     $this->db->from($this->view);
     $this->db->join('order_product', 'order_product_product_id = product_id', 'left');
     $this->db->join('price', 'product_id = price_product_id');
     $this->db->where($q);
     $this->db->where('product_status_id != ', 0);
     $this->db->group_by('product_id');
     $this->db->order_by('amount', 'DESC');
     $this->db->limit($lim, $off);
     $query = $this->db->get();
     return Product::result_as($query, $type);
 }
Example #7
0
 function list_brand_from_category($cat_id, $type = 'arr')
 {
     $this->db->select('brand.*');
     $this->db->distinct();
     $this->db->from($this->table);
     $this->db->join('product', 'product.product_brand_id = brand.brand_id and product.product_status_id != 0');
     $this->db->where('product_category_id', $cat_id);
     $query = $this->db->get();
     return Product::result_as($query, $type);
 }