add currency for teamstore

This commit is contained in:
Frank John Begornia
2019-08-19 21:37:47 +08:00
parent e60bb3baf8
commit b7e81adf31
68 changed files with 9977 additions and 442 deletions

View File

@@ -66,9 +66,12 @@ class MainModel extends Model {
return $i;
}
function cartCount($cartkey){ // count Confirmed attendees
function cartCount($cartkey){ //
$i = DB::table('cart_tmp')->where('CartKey', '=', $cartkey)->sum('Quantity');
$i = DB::table('cart_tmp')
->whereNull('VoucherId')
->where('CartKey', '=', $cartkey)
->sum('Quantity');
return $i;

View File

@@ -17,7 +17,7 @@ class TeamStoreModel extends Model {
{
$i = DB::table('teamstore_products')
->where($field, $teamstoreId)
->orderBy('Id', 'ASC')
->orderBy('Ordering', 'ASC')
->orderBy('Ordering', 'ASC')->get();
return $i;
}
@@ -28,6 +28,15 @@ class TeamStoreModel extends Model {
->where($field, $teamstoreURL)
->get();
return $i;
}
function selectTeamStoreGroupByCartKey($cartKey)
{
$i = DB::table('cart_tmp')
->where('CartKey', $cartKey)
->groupby('CartKey')
->get();
return $i;
}
function getProductThumbnails($productId){
@@ -94,7 +103,13 @@ class TeamStoreModel extends Model {
function insertToCart($data){
$i = DB::table('cart_tmp')->insert($data);
return $i;
$id = DB::getPdo()->lastInsertId();
return array(
'i' => $i,
'lastId' => $id
);
// return $i;
}
function selectDisplayCartThumb(){
@@ -105,11 +120,15 @@ class TeamStoreModel extends Model {
return $i;
}
function myCart($cartKey){
// echo $cartKey;
if($cartKey != ""){
$i = DB::table('cart_tmp')
->where('CartKey', $cartKey)
->leftjoin('teamstore_voucher', 'cart_tmp.VoucherId', '=', 'teamstore_voucher.Id')
->select('cart_tmp.*', 'teamstore_voucher.VoucherCode', 'teamstore_voucher.VoucherType', 'teamstore_voucher.VoucherValue', 'teamstore_voucher.VoucherExpiryDate', 'teamstore_voucher.Status')
->where('cart_tmp.CartKey', $cartKey)
->get();
// var_dump($i);
@@ -150,5 +169,26 @@ class TeamStoreModel extends Model {
return $i;
}
function selectVoucher($data){
$i = DB::table('teamstore_voucher')
->where(DB::raw('BINARY `VoucherCode`'), $data['voucher'])
->where('TeamStoreId', $data['store_id'])
->get();
return $i;
}
function selectVoucherWhereIn($data){
$i = DB::table('teamstore_voucher')
->whereIn('Id', $data)
->get();
return $i;
}
function updateVoucherValueInCart($data, $id){
$i = DB::table('cart_tmp')
->where('Id', $id)
->update($data);
return $i;
}
}

View File

@@ -67,8 +67,9 @@ class UserModel extends Model {
function selectPaymentDetails($field, $val){
$i = DB::table('payment_details')->where($field, $val)
->get();
$i = DB::table('payment_details')
->where($field, $val)
->get();
return $i;
}