diff options
author | lonkaars <loek@pipeframe.xyz> | 2023-06-01 17:12:25 +0200 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2023-06-01 17:12:25 +0200 |
commit | c2b5ab68a84bf830f64e9c4e39f92b24c085c7e6 (patch) | |
tree | 09c459c28d19ff35e4ae1746572f11169e00150c /public/admin-order.php | |
parent | 6715936a3b33c14b2d8c581677855bb6c1297940 (diff) |
calculate cart sum
Diffstat (limited to 'public/admin-order.php')
-rw-r--r-- | public/admin-order.php | 7 |
1 files changed, 5 insertions, 2 deletions
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); ?> <?php function order_template($order) { + $subtotal = number_format($order->subtotal, 2, ',', '.'); echo <<<"EOF" <form method="post"> <input type="hidden" name="id" value="$order->id"> @@ -21,6 +22,7 @@ function order_template($order) { <td>$order->id</td> <td>$order->user_name</td> <td>$order->product_count</td> + <td>$subtotal</td> <td> <select name="status"> EOF; @@ -57,16 +59,17 @@ function order_template($order) { <div class="main limwidth"> <h2>bestellingen</h2> <p>hier kun je bestellingen zien en de status aanpassen. wijzigingen kunnen doorgevoegd worden door op de 'bijwerken'-knop te drukken na het aanpassen van de status. maar één bestellingen kan aangepast worden per update!!</p> - <table> + <table class="order-table"> <tr> <th>ID</th> <th>besteller</th> <th>aantal producten</th> + <th>subtotaal</th> <th>status</th> <th>update</th> </tr> <?php - $res = $cursor->query("select `order`.id as id, sum(orderproduct.count) as product_count, user.name as user_name, `order`.status from orderproduct join `order` on `order`.id = orderproduct.`order` join user on user.id = `order`.user where status > 1 group by orderproduct.`order` order by status asc"); + $res = $cursor->query("select `order`.id as id, sum(orderproduct.count) as product_count, cart_sum(`order`.id) as subtotal, user.name as user_name, `order`.status from orderproduct join `order` on `order`.id = orderproduct.`order` join user on user.id = `order`.user where status > 1 group by orderproduct.`order` order by status asc"); while ($order = $res->fetch_object()) order_template($order); ?> </table> |