-
Notifications
You must be signed in to change notification settings - Fork 1
/
receipt.php
142 lines (139 loc) · 6.86 KB
/
receipt.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
<?php
require_once("header.php");
?>
<ul class="navbar-nav me-auto ms-4 mb-2 mb-lg-0">
<?php
if ($_SESSION['name'] == 'GUEST') {
echo "
<li class=\"nav-item\">
<a class=\"nav-link\" href=\"login.php\">Login/Register</a>
</li>
";
} else {
echo "
<li class=\"nav-item\">
<a class=\"nav-link\" href=\"dashboard.php\">Dashboard</a>
</li>
";
}
?>
<li class="nav-item">
<a class="nav-link" href="about.php">About</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button"
data-bs-toggle="dropdown" aria-expanded="false"> Categories
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdown">
<li><a class="dropdown-item" href="tshirt.php">T-Shirt</a></li>
<li><a class="dropdown-item" href="jacket.php">Jacket</a></li>
<li><a class="dropdown-item" href="mug.php">Mug</a></li>
<li>
<hr class="dropdown-divider">
</li>
<li><a class="dropdown-item" href="mouse.php">Mouse</a></li>
<li><a class="dropdown-item" href="keyboard.php">Keyboard</a></li>
</ul>
</li>
<li class="nav-item">
<a class="nav-link active" href="cart.php">View Cart
<span class="badge rounded-pill bg-primary">0</span>
</a>
</li>
</ul>
<!-- <form class="d-flex">
<input class="form-control me-2" type="search" placeholder="Find products..." aria-label="Search">
<button class="btn btn-outline-secondary" type="submit">Search</button>
</form> -->
</div>
</div>
</nav>
</section>
<!-- END OF NAVIGATION PANEL -->
<section>
<div class="container"> <br>
<h3><i class="fas fa-receipt"></i> Transaction Placed Successfully</h3>
<div class="container-float shadow border rounded p-5">
<?php
if ($_SESSION['name'] == 'GUEST') {
$getdata = "SELECT * FROM customer WHERE customer_id=".$_SESSION['customerID'];
$data = $conn -> query($getdata);
$customer = $data->fetch_assoc();
} else {
$customer = $_SESSION['detail'];
}
$getdata2 = "SELECT * FROM transaction WHERE transaction_id=".$_SESSION['transactionID'];
$data2 = $conn -> query($getdata2);
$transaction = $data2->fetch_assoc();
?>
<h5><b><i class="fas fa-hashtag"></i> Transaction Number: <?php echo $_SESSION['transactionID']; ?></b></h5>
<p class="m-0">
We will contact your transaction status and updates using your contact number
<b>(<?php echo $customer['contact_no']; ?>)</b>, you can do a follow-up of your transaction by sending email at
<b>[email protected]</b>, if you are registered at our website, you can see the
status of your transactions/orders by visiting your account dashboard. Here are
the details of your transaction: <hr>
<b><i class="fas fa-shipping-fast"></i> Shipping Details</b>
<p class="ms-4 mb-0"><b>Full Name:</b> <?php echo $customer['name']; ?></p>
<p class="ms-4 mb-0"><b>Full Address:</b> <?php echo $customer['address']; ?></p>
<p class="ms-4 mb-0"><b>Contact Number:</b> <?php echo $customer['contact_no']; ?></p>
<p class="ms-4 mb-0"><b>Mode of Payment:</b> <?php echo $transaction['payment_option']; ?></p>
<hr>
<b><i class="fas fa-list-ul mb-3"></i> List of Products</b>
<div class="container">
<?php echo "
<table class=\"table table-striped border justify-content-center align-items-center text-center\">
<thead>
<tr>
<th scope=\"col\">Quantity</div>
<th scope=\"col\">Product Name</div>
<th scope=\"col\">Price</div>
<th scope=\"col\">Sub-total</div>
</tr>
</thead>
<tbody>";
if ($_SESSION['name'] == 'GUEST') {
foreach ($_SESSION['cartlist'] as $product) {
echo "
<tr>
<td>".$product['quantity']."</td>
<td>".$product['name']."</td>
<td>₱ ".number_format($product['price'], 2, '.', ',')."</td>
<td>₱ ".number_format(($product['price'] * $product['quantity']), 2, '.', ',')."</td>
</tr>";
}
} else {
$getcart = $conn->query("SELECT product_id, quantity FROM cart WHERE customer_id=".$_SESSION['name']);
while ($row = $getcart->fetch_assoc()) {
$getproduct = $conn->query("SELECT * FROM product WHERE product_id=".($row['product_id']));
$product = $getproduct->fetch_assoc();
echo "
<tr>
<td>".$row['quantity']."</td>
<td>".$product['name']."</td>
<td>₱ ".number_format($product['price'], 2, '.', ',')."</td>
<td>₱ ".number_format(($product['price'] * $row['quantity']), 2, '.', ',')."</td>
</tr>";
}
$deleteCartProduct = $conn->query("DELETE FROM cart WHERE customer_id=".$_SESSION['name']);
}
echo " <tr>
<td></td>
<td></td>
<td><b>Total</b></td>
<td><b>₱ ".number_format($_SESSION['total_price'], 2, '.', ',')."</b></td>
</tr>
</tbody>
</table>";
unset($_SESSION['cart']);
unset($_SESSION['cartmultiples']);
unset($_SESSION['cartlist']);
unset($_SESSION['total_price']);?>
</div>
</p>
</div>
</div>
</section>
<?php
require_once("footer.php");
?>