From c2b5ab68a84bf830f64e9c4e39f92b24c085c7e6 Mon Sep 17 00:00:00 2001 From: lonkaars Date: Thu, 1 Jun 2023 17:12:25 +0200 Subject: calculate cart sum --- public/admin-order.php | 7 +++++-- public/admin.css | 9 +++++---- public/cart.css | 2 ++ public/cart.php | 12 +++++++++++- public/global.css | 1 + public/index.php | 10 ++++++++++ 6 files changed, 34 insertions(+), 7 deletions(-) (limited to 'public') diff --git a/public/admin-order.php b/public/admin-order.php index debde66..8bb7fc0 100644 --- a/public/admin-order.php +++ b/public/admin-order.php @@ -14,6 +14,7 @@ } while (false); ?> subtotal, 2, ',', '.'); echo <<<"EOF"
@@ -21,6 +22,7 @@ function order_template($order) { $order->id $order->user_name $order->product_count + $subtotal - $item->price + $price EOF; } @@ -86,8 +87,17 @@ EOF; EOF; while ($product = $res->fetch_object()) item_template($product); + + $statement = $cursor->prepare("select cart_sum(cart(?)) as `sum`"); + $statement->bind_param("i", $user_id); + if (!$statement->execute()) break; + $res = $statement->get_result(); + $subtotal = number_format($res->fetch_object()->sum, 2, ',', '.'); echo <<<"EOF"
+
+ Subtotaal: $subtotal +
diff --git a/public/global.css b/public/global.css index 2a23250..a34b503 100644 --- a/public/global.css +++ b/public/global.css @@ -102,3 +102,4 @@ input.buttonstyle[type=number] { cursor: unset; } } .skipafter { margin-bottom: 16px; } +.alignright { text-align: right; } diff --git a/public/index.php b/public/index.php index 0fd0ff2..fecf624 100644 --- a/public/index.php +++ b/public/index.php @@ -20,6 +20,16 @@ function promobuff2str($price_buff, $count_buff) {
+ +
+ +
+
+ EOF; + } while (false); ?>

hier zijn de aanbiedingen