crewsportswear update as of 3_18_19

This commit is contained in:
Frank John Begornia
2019-03-18 13:48:37 +08:00
parent 562f03488a
commit a2d88bc52e
71 changed files with 5443 additions and 85 deletions

View File

@@ -7,15 +7,37 @@ class PayPalModel extends Model {
function insertToPaypalDetails($data){
$i = DB::table('payment_details')->insert($data);
$i = DB::table('payment_details')->insertGetId($data);
return $i;
}
function insertToOrders($ck){
// $i = DB::table('orders')->insert($data);
$pdo = DB::connection()->getPdo();
$query = $pdo->prepare("INSERT INTO orders SELECT * FROM cart_tmp where CartKey = '$ck'");
$i = $query->execute();
return $i;
}
function insertShippingAddress($data){
function insertToOrders($data){
$i = DB::table('orders')->insert($data);
$i = DB::table('shipping_addresses')->insert($data);
return $i;
}
function getLastIdPaymentDetails(){
$i = DB::table('payment_details')
->orderby('Id', 'DESC')
->take(1)
->get();
// var_dump($i);
return $i;
}
}

View File

@@ -79,6 +79,14 @@ class TeamStoreModel extends Model {
return $i;
}
function selectDisplayCartThumb(){
$i = DB::table('teamstore_product_thumbnails')
->where('ImageClass', 'active')
->get();
return $i;
}
function myCart($cartKey){
// echo $cartKey;
if($cartKey != ""){
@@ -103,15 +111,9 @@ class TeamStoreModel extends Model {
function myCartGroup($cartKey){
if($cartKey != ""){
$pdo = DB::connection()->getPdo();
$query = $pdo->prepare("SELECT *, COUNT(Id) AS qty, SUM(Price) AS total_price FROM cart_tmp WHERE CartKey = :ck GROUP BY ProductId");
$query = $pdo->prepare("SELECT *, COUNT(Id) AS qty, SUM(Price) AS total_price, SUM(Quantity) AS total_qty FROM cart_tmp WHERE CartKey = :ck GROUP BY ProductId");
$query->execute([':ck'=>$cartKey]);
$row = $query->fetchAll(\PDO::FETCH_OBJ);
// $i = DB::table('cart_tmp')->()
// ->where('CartKey', $cartKey)
// ->groupby('ProductId')
// ->get();
// // var_dump($i);
return $row;
}
}

View File

@@ -65,9 +65,9 @@ class UserModel extends Model {
return $i;
}
function selectPaymentDetails($userid){
function selectPaymentDetails($field, $val){
$i = DB::table('payment_details')->where('UserId', $userid)
$i = DB::table('payment_details')->where($field, $val)
->get();
return $i;
@@ -134,4 +134,28 @@ class UserModel extends Model {
return $i;
}
function selectOrderItem($ck){
$i = DB::table('orders')
->where('CartKey', $ck)
->get();
return $i;
}
function itemGroup($cartKey){
$pdo = DB::connection()->getPdo();
$query = $pdo->prepare("SELECT *, COUNT(Id) AS qty, SUM(Price) AS total_price, SUM(Quantity) AS total_qty FROM orders WHERE CartKey = :ck GROUP BY ProductId");
$query->execute([':ck'=>$cartKey]);
$row = $query->fetchAll(\PDO::FETCH_OBJ);
return $row;
}
function selectDisplayItemThumb(){
$i = DB::table('teamstore_product_thumbnails')
->where('ImageClass', 'active')
->get();
return $i;
}
}