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

@@ -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;