4_15_2019 update

This commit is contained in:
Frank John Begornia
2019-04-15 22:38:53 +08:00
parent 0fe1270756
commit c5862dfbf4
665 changed files with 401297 additions and 194 deletions

View File

@@ -91,8 +91,10 @@ class UserModel extends Model {
}
function selectTemplatePaths($field, $templateid){
$i = DB::table('template_paths')->where($field, $templateid)
->get();
$i = DB::table('template_paths')
->where($field, $templateid)
->where('IsActive', 'TRUE')
->get();
return $i;
}
@@ -142,15 +144,33 @@ class UserModel extends Model {
return $i;
}
function selectOrderItemWithStoreId($store_id, $ck){
$i = DB::table('orders')
->where('StoreId', $store_id)
->where('CartKey', $ck)
->get();
return $i;
}
function itemGroup($cartKey){
$pdo = DB::connection()->getPdo();
$query = $pdo->prepare("SELECT *, COUNT(Id) AS qty, SUM(Price) * Quantity AS total_price FROM orders WHERE CartKey = :ck GROUP BY ProductId");
$query = $pdo->prepare("SELECT *, COUNT(Id) AS qty, Price * SUM(Quantity) AS total_price FROM orders WHERE CartKey = :ck GROUP BY ProductId");
$query->execute([':ck'=>$cartKey]);
$row = $query->fetchAll(\PDO::FETCH_OBJ);
return $row;
}
function itemGroupWithStoreId($store_id, $cartKey){
$pdo = DB::connection()->getPdo();
$query = $pdo->prepare("SELECT *, COUNT(Id) AS qty, Price * SUM(Quantity) AS total_price FROM orders WHERE StoreId= :si AND CartKey = :ck GROUP BY ProductId");
$query->execute(array(':si'=>$store_id, ':ck'=>$cartKey));
$row = $query->fetchAll(\PDO::FETCH_OBJ);
return $row;
}
function selectDisplayItemThumb(){
$i = DB::table('teamstore_product_thumbnails')
@@ -158,4 +178,42 @@ class UserModel extends Model {
->get();
return $i;
}
}
function selectItemsStoreId($ck){
$i = DB::table('cart_tmp')
->select(DB::raw('StoreId'))
->where('CartKey', $ck)
->groupby('StoreId')
->get();
return $i;
}
function selectUserLogins($field, $value){
$i = DB::table('user_logins')
->where($field, $value)
->get();
return $i;
}
function insertNewProduct($data){
$pdo = DB::connection()->getPdo();
$i = DB::table('teamstore_products')->insert($data);
$id = DB::getPdo()->lastInsertId();
return $id;
}
function insertNewProductThumbnails($data){
$i = DB::table('teamstore_product_thumbnails')->insert($data);
return $i;
}
function updateProductCode($data, $id){
$i = DB::table('teamstore_products')->where('Id', $id)
->update($data);
return $i;
}
}