-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathshipping.php
211 lines (196 loc) · 10.1 KB
/
shipping.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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
<?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">
<?php
echo $_SESSION['cart'];
?>
</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-cart-arrow-down"></i> Checkout</h3>
<div class="container-fluid shadow border rounded py-4">
<?php
if ($_SESSION['name'] == 'GUEST') {
foreach ($_SESSION['cartlist'] as $cartlist) {
echo "
<div class=\"row justify-content-center align-items-center text-center\">
<div class=\"col-md-2\">
<b>".$cartlist["quantity"]."</b>
</div>
<div class=\"col-md-4\">
<b>".$cartlist["name"]."</b>
</div>
<div class=\"col-md-3\">
<b>₱ ".number_format($cartlist["price"], 2, '.', ',')."</b>
</div>
<div class=\"col-md-3\">
<b>₱ ".number_format(($cartlist["quantity"]*$cartlist["price"]), 2, '.', ',')."</b>
</div>
</div>
";
}
} 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 "
<div class=\"row justify-content-center align-items-center text-center\">
<div class=\"col-md-2\">
<b>".$row["quantity"]."</b>
</div>
<div class=\"col-md-4\">
<b>".$product["name"]."</b>
</div>
<div class=\"col-md-3\">
<b>₱ ".number_format($product["price"], 2, '.', ',')."</b>
</div>
<div class=\"col-md-3\">
<b>₱ ".number_format(($row["quantity"]*$product["price"]), 2, '.', ',')."</b>
</div>
</div>
";
}
}
echo "</div>";
?>
</div>
</div>
<form enctype="multipart/form-data" method="POST" action="includes/placeorder.inc.php">
<div class="container">
<div class="shadow border rounder p-5 mt-3">
<h3><i class="fas fa-envelope-open-text"></i> Fill-Out Shipping Information</h3>
<div class="mb-3 mt-4">
<b><label for="name" class="form-label">Name</label></b>
<?php if ($_SESSION['name'] != 'GUEST') echo "<fieldset disabled>"; ?>
<input type="text" class="form-control m-0" name="name" placeholder="Enter your full name"
<?php
if ($_SESSION['name'] != 'GUEST') {
echo " id=\"disabledTextInput\" value=".
str_replace(" "," ",$_SESSION['detail']['name'])."
required>";}
else echo "required>";
?>
</div>
<div class="mb-3">
<b><label for="address" class="form-label">Address</label></b>
<?php if ($_SESSION['name'] != 'GUEST') echo "<fieldset disabled>"; ?>
<input type="text" class="form-control m-0" name="address" placeholder="Enter your full address"
<?php
if ($_SESSION['name'] != 'GUEST') {
echo " id=\"disabledTextInput\" value=".
str_replace(" "," ",$_SESSION['detail']['address'])."
required>";}
else echo "required> </fieldset>";
?>
</div>
<div class="mb-3">
<b><label for="contact" class="form-label">Contact Number</label></b>
<?php if ($_SESSION['name'] != 'GUEST') echo "<fieldset disabled>"; ?>
<input type="text" class="form-control m-0" name="contact" placeholder="Enter your contact number"
<?php
if ($_SESSION['name'] != 'GUEST') {
echo " id=\"disabledTextInput\" value=".
str_replace(" "," ",$_SESSION['detail']['contact_no'])."
required>";}
else echo "required> </fieldset>";
?>
</div>
<div class="mb-3">
<b><label for="id" class="form-label">Valid ID</label></b>
<?php if ($_SESSION['name'] != 'GUEST') echo "<fieldset disabled>"; ?>
<input type="file" class="form-control m-0" name="id"
<?php
if ($_SESSION['name'] != 'GUEST') {
echo " id=\"disabledTextInput\" value=".$_SESSION['detail']['id']." required>";}
else echo "required> </fieldset>";
?>
</div>
<b><label for="option" class="form-label">Payment Option</label></b>
<div class="input-group mb-3">
<select class="form-select" id="option" name="option" onload="changePayment()" onclick="changePayment()" required>
<option value="1">Cash On Delivery</option>
<option value="2">GCash</option>
<option value="3">Debit Card</option>
<option value="4">Credit Card</option>
</select>
</div>
<div class="mb-3" id="payment">
<b><label for="address" class="form-label" id="paymentLabel">Enter your </label></b>
<input type="text" class="form-control m-0" name="payment" placeholder="Enter your ">
</div>
<center style="color:red;"><b>
<?php
if (isset($_REQUEST['error'])) {
echo $_REQUEST['error'];
}
?>
</b></center>
<div style="border-top: 1px solid black; margin-top: 40px; padding-top: 20px;">
<center>
<p style="margin-bottom: 0;">
By placing your order, You agree to the <a href="terms.php"><b>Terms and Conditions</b></a> of <b>PulseBytes Merchandise Store.</b>
<b>PulseBytes</b> is an online merchandise store located in the country of Philippines.
</p>
</center>
</div>
</div>
</div>
<center>
<a href="cart.php" class="btn btn-secondary mt-4 me-1 px-5">Back to Cart</a>
<input type="submit" class="btn btn-primary mt-4 px-5" name="submit" value="Place Order">
</center>
</form>
</section>
<?php
require_once("footer.php");
?>