update 3_20_19

This commit is contained in:
Frank John Begornia
2019-03-20 19:24:22 +08:00
parent a2d88bc52e
commit 68549cbf30
16 changed files with 21 additions and 8 deletions

View File

@@ -220,6 +220,7 @@ class TeamStoreController extends Controller {
$product_id = $post['product_id'];
$store_url = $post['store_url'];
$store_id = $post['store_id'];
if($request->session()->has('cartkey')){
$cartKey = $request->session()->get('cartkey');
@@ -253,6 +254,7 @@ class TeamStoreController extends Controller {
$items[] = array(
'ProductId' => $product_id,
'StoreURL' => $store_url,
'StoreId' => $store_id,
'FormUsed' => $product_form,
'CartKey' => $cartKey,
'DesignCode' => $design_code,
@@ -271,6 +273,7 @@ class TeamStoreController extends Controller {
$items[] = array(
'ProductId' => $product_id,
'StoreURL' => $store_url,
'StoreId' => $store_id,
'FormUsed' => $product_form,
'CartKey' => $cartKey,
'DesignCode' => $design_code,
@@ -285,6 +288,7 @@ class TeamStoreController extends Controller {
$items[] = array(
'ProductId' => $product_id,
'StoreURL' => $store_url,
'StoreId' => $store_id,
'FormUsed' => $product_form,
'CartKey' => $cartKey,
'DesignCode' => $design_code,
@@ -304,6 +308,7 @@ class TeamStoreController extends Controller {
$items[] = array(
'ProductId' => $product_id,
'StoreURL' => $store_url,
'StoreId' => $store_id,
'FormUsed' => $product_form,
'CartKey' => $cartKey,
'DesignCode' => $design_code,
@@ -325,6 +330,7 @@ class TeamStoreController extends Controller {
$items[] = array(
'ProductId' => $product_id,
'StoreURL' => $store_url,
'StoreId' => $store_id,
'FormUsed' => $product_form,
'CartKey' => $cartKey,
'DesignCode' => $design_code,

View File

@@ -111,7 +111,7 @@ 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, SUM(Quantity) AS total_qty FROM cart_tmp WHERE CartKey = :ck GROUP BY ProductId");
$query = $pdo->prepare("SELECT *, COUNT(Id) AS qty, SUM(Price) * Quantity AS total_price FROM cart_tmp WHERE CartKey = :ck GROUP BY ProductId");
$query->execute([':ck'=>$cartKey]);
$row = $query->fetchAll(\PDO::FETCH_OBJ);
return $row;

View File

@@ -144,7 +144,7 @@ class UserModel extends Model {
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 = $pdo->prepare("SELECT *, COUNT(Id) AS qty, SUM(Price) * Quantity AS total_price FROM orders WHERE CartKey = :ck GROUP BY ProductId");
$query->execute([':ck'=>$cartKey]);
$row = $query->fetchAll(\PDO::FETCH_OBJ);
return $row;