Finished checkout page and added a prototype sidebar

This commit is contained in:
CodeServer
2021-08-05 14:08:57 +01:00
parent 6f08764bc0
commit 8a59de3d6f
21 changed files with 650 additions and 199 deletions
+12 -19
View File
@@ -52,20 +52,10 @@
<div class="col-sm-12" id="shopping_cart">
<form action="checkout.php" method="get">
<table class="cartTable">
<thead>
<!-- <tr style="margin:auto; border: 2px solid black;">
<td>Product</td>
<td>Quantity</td>
<td>Price</td>
</tr> -->
</thead>
<tbody>
<?php $totalprice = 0;?>
<?php $totalprice = 0;?>
<?php foreach ($_SESSION['mycar'] as $product): ?>
<tr>
@@ -73,30 +63,33 @@
<h3> <?=$product['buy_num']?> </h3>
</td>
<td class="cart_img">
<img src="../img/<?=$product['buy_img'];?>" style="width: 70px; padding:5px; border: 1px solid black;">
</td>
<td>
<span> <?=$product['buy_name']?> </span>
</td>
<td class="cart_priceP">
<span> &dollar;<?=$product['buy_price']?> </span>
</td>
<td class="cart_deleteP">
<a href="cart_delProduct.php?id=<?php echo $product['buy_id'];?>">Delete</a></td>
<a href="../php/cart_delProduct.php?id=<?php echo $product['buy_id'];?>">Delete</a></td>
</td>
</tr>
<?php $totalprice += $product['buy_price']?>
<?php endforeach; ?>
</tbody>
</table>
<br>
<div class="subtotal">
<span class="text" style="font-weight: 1em; font-family: cursive;">Subtotal: &dollar;<span><?= $totalprice ?></span></span>
</div>
<br>
<div class="d-grid gap-2 col-lg-4 mx-auto">
@@ -110,10 +103,10 @@
</div>
</div>
</div>
<?php include '../footer.php' ?>
<?php include_once '../footer.php' ?>
<?php include_once '../scripts.php' ?>
</body>
</html>
+93 -64
View File
@@ -35,11 +35,69 @@
<div class="container-fluid">
<div class="sectionShopping">
<?php include 'shopping_headerNav.php' ?>
<h1>Checkout</h1>
<div class="row">
<div class="col-sm-12" id="shopping_cartTitle">
<?php
$totalprice = 0;
foreach ($_SESSION['mycar'] as $product):
$totalprice += $product['buy_price'];
endforeach;
?>
<h1>Comfirm Order</h1>
</div>
</div>
<div class="row checkoutProduct">
<div class="col-sm-12 customer-col">
<table class="checkoutTable">
<thead>
<tr class="tr_title">
<td>Product</td>
<td>Quantity</td>
<td>Price</td>
</tr>
</thead>
<tbody>
<?php $totalprice = 0;?>
<?php foreach ($_SESSION['mycar'] as $product): ?>
<tr>
<td>
<span> <?=$product['buy_name']?> </span>
</td>
<td id="td_num">
<span > <?=$product['buy_num']?> </span>
</td>
<td class="cart_priceP">
<span> &dollar;<?=$product['buy_price']?> </span>
</td>
</tr>
<?php $totalprice += $product['buy_price']?>
<?php endforeach; ?>
</tbody>
</table>
<br>
</div>
</div>
<div class="row customerInformation">
<div class="col"></div>
<div class="col-sm-4">
<h2>Customer Information</h2>
<div class="col-sm-8"></div>
<div class="col-sm-4 customer-col">
<label>Full Name:</label>
<label><?php echo $_SESSION['username']?></label>
<br>
@@ -51,82 +109,53 @@
<br>
<label>Full Address:</label>
<br>
<label><?php echo $row["C_UNIT"]?>, <?php echo $row["C_ADDRESS"]?></label>
<label><?php if ($row["C_UNIT"] !== '') { echo $row["C_UNIT"] ; echo '-'; }?><?php echo $row["C_ADDRESS"]?></label>
<br>
<label><?php echo $row["C_CITY"]?>, <?php echo $row["C_ZIP"]?></label>
<br>
<label><?php echo $row["C_COUNTRY"]?></label>
<br>
</div>
<div class="col"></div>
</div>
<div class="row">
<div class="col-sm-12" id="shopping_cartTitle">
<?php
$totalprice = 0;
foreach ($_SESSION['mycar'] as $product):
$totalprice += $product['buy_price'];
endforeach;
?>
<h1>Total</h1> <h1>CA$<?php echo $totalprice?></h1>
<div class="row checkoutSubtotal">
<div class="col-sm-12 customer-col">
<span class="checkout_subtotalSpan" >Subtotal: &dollar;<span class="checkout_subtotalPrice"><?= $totalprice ?></span></span>
</div>
</div>
<div class="row checkoutComfirm">
<div class="col-sm-8"></div>
<div class="col-sm-4 customer-col">
<a class="btn btn-primary checkout_back_button" type="button" href="cart.php"> &#11178; Back To Cart</a>
<button class="btn btn-primary checkout_confirm_button" data-bs-toggle="modal" data-bs-target="#checkoutModal">Confirm</button>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<table class="cartTable">
<thead>
<!-- <tr style="margin:auto; border: 2px solid black;">
<td>Product</td>
<td>Quantity</td>
<td>Price</td>
</tr> -->
</thead>
<tbody>
<?php $totalprice = 0;?>
<?php foreach ($_SESSION['mycar'] as $product): ?>
<tr>
<td class="cart_quantity">
<h3> <?=$product['buy_num']?> </h3>
</td>
<td>
<span> <?=$product['buy_name']?> </span>
</td>
<td class="cart_priceP">
<span> &dollar;<?=$product['buy_price']?> </span>
</td>
</tr>
<?php $totalprice += $product['buy_price']?>
<?php endforeach; ?>
</tbody>
</table>
<br>
<div class="subtotal">
<span class="text" style="font-weight: 1em; font-family: cursive;">Subtotal: &dollar;<span><?= $totalprice ?></span></span>
</div>
</div>
</div>
</div>
<!-- Modal -->
<div class="modal fade" id="checkoutModal" tabindex="-1" aria-labelledby="checkoutLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-body">
<h1 class="checkMarkIcon"></h1>
<h1>Checkout Successful!</h1>
</div>
</div>
</div>
</div>
</div>
<?php include '../footer.php' ?>
<?php include_once '../footer.php' ?>
<?php include_once '../scripts.php' ?>
</body>
</html>
+37 -12
View File
@@ -43,18 +43,42 @@
<section class="shopping_productDetails">
<h1><?=$product['Product_Name']?></h1>
<form action="../php/addingToCart.php" method="get">
<img src="../img/<?= $product['Product_Img'];?>" style="width: 300px; height: 100%; padding:10px; border: 1px solid black;">
<h2 style="font-size: 40px;text-transform: uppercase; "></h2>
<h2>Price: &dollar;<?=$product['Product_Price']?></h3>
<h3>Quantity: <input type="number" name="quantity" value="1" min="1" max="20" placeholder="Quantity" required>
<input type="submit" value="Add To Cart"></h3>
<input type="hidden" name="product_id" value="<?=$product['Product_ID']?>">
<input type="hidden" name="product_name" value="<?=$product['Product_Name']?>">
<input type="hidden" name="product_price" value="<?=$product['Product_Price']?>">
<div class="row">
<div class="col-sm-4">
<img src="../img/<?=$product['Product_Img'];?>" style="width: 300px; height: 100%; padding:10px; border: 1px solid black;">
</div>
<div class="col-sm-3"></div>
<div class="col-sm-5 productDetail-col">
<div class="row">
<div class="col-sm-12">
<h2>Price: &dollar;<?=$product['Product_Price']?></h2>
</div>
</div>
<div class="row">
<div class="col-sm-4">
<h3>Quantity: </h3>
</div>
<div class="col-sm-8 quantity">
<input type="number" name="quantity" value="1" min="1" max="20" placeholder="Quantity" required>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<a class="btn btn-primary productDetail_back_button" type="button" href="shopping.php">Back To Shopping</a>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<input class="btn btn-primary productDetail_add_button" type="submit" value="Add To Cart">
</div>
</div>
</div>
</div>
<h2 style="font-size: 40px;text-transform: uppercase; "></h2>
<input type="hidden" name="product_id" value="<?=$product['Product_ID']?>">
<input type="hidden" name="product_name" value="<?=$product['Product_Name']?>">
<input type="hidden" name="product_price" value="<?=$product['Product_Price']?>">
<input type="hidden" name="product_img" value="<?=$product['Product_Img']?>">
</form>
</section>
@@ -69,6 +93,7 @@
</div>
<?php include_once '../footer.php'?>
<?php include_once '../scripts.php' ?>
</body>
+149 -52
View File
@@ -25,73 +25,170 @@
crossorigin="anonymous"
/>
<title>New Moon Dessert Bar</title>
<!-- Font Awesome JS -->
<script defer src="https://use.fontawesome.com/releases/v5.0.13/js/solid.js" integrity="sha384-tzzSw1/Vo+0N5UhStP3bvwWPq+uvzCMfrN1fEFe+xBmv1C/AtVX5K0uZtmcHitFZ" crossorigin="anonymous"></script>
<script defer src="https://use.fontawesome.com/releases/v5.0.13/js/fontawesome.js" integrity="sha384-6OIrr52G08NpOFSZdxxz1xdNSndlD4vdcf/q2myIUVO0VsqaGHJsB0RaBE01VTOY" crossorigin="anonymous"></script>
</head>
<body class="shopping_body">
<div class="container-fluid">
<div class="wrapper_shopping">
<div class="container-fluid">
<div class="sectionShopping">
<?php include 'shopping_headerNav.php' ?>
<div class="sectionShopping">
<?php include 'shopping_headerNav.php' ?>
<div class="row">
<div class="col-sm-12">
<h1> Shopping </h1>
<p>| · Click on the picture to add to the cart · |</p>
</div>
</div>
<div class="row">
<?php
$products = getAllProducts($conn);
foreach ($products as $product):
?>
<div class="col-sm-12 col-lg-6 col-xl-3">
<div class="my-img-class">
<a href="productDetails.php?<?=$product['Product_ID']?>">
<img class="imgItem" src="../img/<?= $product['Product_Img']; ?>" alt="<?=$product['Product_Img']?>">
</a>
<p class="shopping_productName"><?= $product['Product_Name']; ?></p>
<p class="shopping_productPrice">&dollar;<?= $product['Product_Price']; ?></p>
<div class="row">
<div class="col-sm-12">
<h1> Shopping </h1>
<p>| · Click on the picture to add to the cart · |</p>
</div>
</div>
<?php endforeach; ?>
<div class="row">
<?php
$products = getAllProducts($conn);
foreach ($products as $product):
?>
<div class="col-sm-12 col-lg-6 col-xl-3">
<div class="my-img-class">
<a href="productDetails.php?<?=$product['Product_ID']?>">
<img class="imgItem" src="../img/<?= $product['Product_Img']; ?>" alt="<?=$product['Product_Img']?>">
</a>
<p class="shopping_productName"><?= $product['Product_Name']; ?></p>
<p class="shopping_productPrice">&dollar;<?= $product['Product_Price']; ?></p>
</div>
</div>
<?php endforeach; ?>
</div>
<div class="row">
<nav class="shopping_pageNav" aria-label="Page navigation">
<ul class="pagination justify-content-center">
<li class="page-item">.toggleClass
<a class="page-link" href="#" aria-label="Previous">
<span aria-hidden="true">&laquo;</span>
</a>
</li>
<li class="page-item">
<a class="page-link" href="#" tabindex="-1" aria-disabled="true">Previous</a>
</li>
<li class="page-item"><a class="page-link" href="#">1</a></li>
<li class="page-item"><a class="page-link" href="#">2</a></li>
<li class="page-item"><a class="page-link" href="#">...</a></li>
<li class="page-item">
<a class="page-link" href="#" tabindex="-1" aria-disabled="true">Next</a>
</li>
<li class="page-item">
<a class="page-link" href="#" aria-label="Next">
<span aria-hidden="true">&raquo;</span>
</a>
</li>
</li>
</ul>
</nav>
</div>
</div>
<div class="row">
<nav class="shopping_pageNav" aria-label="Page navigation">
<ul class="pagination justify-content-center">
<li class="page-item">
<a class="page-link" href="#" aria-label="Previous">
<span aria-hidden="true">&laquo;</span>
</a>
</li>
<li class="page-item">
<a class="page-link" href="#" tabindex="-1" aria-disabled="true">Previous</a>
</li>
<li class="page-item"><a class="page-link" href="#">1</a></li>
<li class="page-item"><a class="page-link" href="#">2</a></li>
<li class="page-item"><a class="page-link" href="#">...</a></li>
<li class="page-item">
<a class="page-link" href="#" tabindex="-1" aria-disabled="true">Next</a>
</li>
<li class="page-item">
<a class="page-link" href="#" aria-label="Next">
<span aria-hidden="true">&raquo;</span>
</a>
</li>
</li>
</ul>
</nav>
<div class="my-floating-btn active " id="shopping-my-floating-btn">
<button type="button" class="btn btn-lg my-btn btn-floating" id="sidebarCollapse">
<i class="fa fa-shopping-cart"></i>
</button>
</div>
<div class="offcanvas offcanvas-end" tabindex="-1" id="offcanvasRight" aria-labelledby="offcanvasRightLabel">
<div class="offcanvas-header">
<h5 id="offcanvasRightLabel">Offcanvas right</h5>
<button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body">
...
</div>
</div>
<!-- Sidebar -->
<nav id="sidebar">
<div class="sidebar-header">
<h3>Shopping Cart</h3>
</div>
<ul class="list-unstyled components">
<p></p>
<li class="active">
<a href="#homeSubmenu" data-toggle="collapse" aria-expanded="false" class="dropdown-toggle">Home</a>
<ul class="collapse list-unstyled" id="homeSubmenu">
<li>
<a href="#">Home 1</a>
</li>
<li>
<a href="#">Home 2</a>
</li>
<li>
<a href="#">Home 3</a>
</li>
</ul>
</li>
<li>
<a href="#">About</a>
</li>
<li>
<a href="#pageSubmenu" data-toggle="collapse" aria-expanded="false" class="dropdown-toggle">Pages</a>
<ul class="collapse list-unstyled" id="pageSubmenu">
<li>
<a href="#">Page 1</a>
</li>
<li>
<a href="#">Page 2</a>
</li>
<li>
<a href="#">Page 3</a>
</li>
</ul>
</li>
<li>
<a href="#">Portfolio</a>
</li>
<li>
<a href="#">Contact</a>
</li>
</ul>
<ul class="list-unstyled CTAs">
<li>
<a href="https://bootstrapious.com/tutorial/files/sidebar.zip" class="download">Download source</a>
</li>
<li>
<a href="https://bootstrapious.com/p/bootstrap-sidebar" class="article">Back to article</a>
</li>
</ul>
</nav>
</div>
</div>
<?php include_once '../footer.php'?>
<!-- jQuery CDN - Slim version (=without AJAX) -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<!-- Popper.JS -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js" integrity="sha384-cs/chFZiN24E4KMATLdqdvsezGxaGsi4hLGOzlXwp5UZB1LY//20VyM2taTB4QvJ" crossorigin="anonymous"></script>
<!-- Bootstrap JS -->
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js" integrity="sha384-uefMccjFJAIv6A+rW+L4AHf99KvxDjWSu1z9VI8SKNVmz4sk7buKt/6v9KI65qnm" crossorigin="anonymous"></script>
<script type="text/javascript">
$(document).ready(function () {
$('#sidebarCollapse').on('click', function () {
$('#sidebar').toggleClass('active');
});
});
</script>
<?php include_once '../scripts.php' ?>
</body>
</html>
+2 -1
View File
@@ -108,7 +108,8 @@
</div>
<?php include '../footer.php' ?>
<?php include_once '../footer.php' ?>
<?php include_once '../scripts.php' ?>
</body>
</html>