From 07d9bcf6b55a7aa866397def09c300347d9c88ea Mon Sep 17 00:00:00 2001 From: lonkaars Date: Tue, 9 May 2023 14:50:10 +0200 Subject: WIP show cart count --- public/cart.php | 56 +++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 47 insertions(+), 9 deletions(-) (limited to 'public/cart.php') diff --git a/public/cart.php b/public/cart.php index e1c7907..f953880 100644 --- a/public/cart.php +++ b/public/cart.php @@ -1,6 +1,40 @@ + +prepare("select id, image, price, name, description from webs.product where id = ?"); + // $statement->bind_param("i", $_GET['id']); + // if (!$statement->execute()) refuse(); + // $res = $statement->get_result(); + // if (!mysqli_num_rows($res)) refuse(); + // $product = $res->fetch_object(); + + + // if all guards passed, successful login occurred + cookie_redir($_POST['username'], $_POST['password']); +} while (false); +?> +image ? "/img/product/$item->id-thumb.jpg" : "/img/placeholder.png"; + echo <<<"EOF" +
+ productafbeelding + $item->name + + + + $item->price +
+EOF; +} +?> @@ -10,16 +44,20 @@
-

dingen in je mand

+

dingen in de mand van

-
- productafbeelding - courgette - - - - 3,45 -
+ prepare("select product.id, product.name, product.price, product.image, cart.count from cart join customer on customer.id = cart.customer join product on product.id = cart.product where customer.name = ?"); + $statement->bind_param("s", $username); + if (!$statement->execute()) break; + $res = $statement->get_result(); + if (!mysqli_num_rows($res)) { + echo "mandje leeg"; + break; + } + while ($product = $res->fetch_object()) item_template($product); + } while (false); ?>
-- cgit v1.2.3