-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheckout2.php
185 lines (151 loc) · 7.16 KB
/
checkout2.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
<?php include 'topMenu.php';?>
<?php
$servername = "localhost";
$username = "root";
$password = "root";
$dbname = "toystore";
$conn = new mysqli($servername, $username, $password, $dbname);
$userid = $siteConfigurationObject->getUserId();
$sql = "select p.purchase_id, p.user_id, p.qty, p.toy_id, t.toy_name, t.price, t.image,ROUND((p.qty * t.price), 2) as total from purchased as p
LEFT JOIN toy AS t ON t.toy_id = p.toy_id
where p.user_id = $userid and p.status = 0 and t.status = 1 group by user_id, p.toy_id";
$result = $conn->query($sql);
$sql = "select ROUND(SUM(p.qty * t.price),2) as sum,count(*) as total,sum(p.qty) as quantity
from purchased AS p LEFT JOIN toy AS t ON t.toy_id = p.toy_id
where user_id = $userid and p.status = 0 and t.status = 1";
$price = $conn->query($sql);
while($row = mysqli_fetch_array($price)){
$sum = $row['sum'];
$total = $row['quantity'];
}
$conn->close();
?>
<div id="all">
<div id="content">
<div class="container">
<div class="col-md-12">
<ul class="breadcrumb">
<li><a href="#">Home</a>
</li>
<li>Checkout - Delivery method</li>
</ul>
</div>
<div class="col-md-9" id="checkout">
<div class="box">
<form method="post" action="checkout3.php">
<h1>Checkout - Delivery method</h1>
<ul class="nav nav-pills nav-justified">
<li><a href="checkout1.php"><i class="fa fa-map-marker"></i><br>Address</a>
</li>
<li class="active"><a href="#"><i class="fa fa-truck"></i><br>Delivery Method</a>
</li>
<li class="disabled"><a href="#"><i class="fa fa-money"></i><br>Payment Method</a>
</li>
<li class="disabled"><a href="#"><i class="fa fa-eye"></i><br>Order Review</a>
</li>
</ul>
<div class="content">
<div class="row">
<div class="col-sm-6">
<div class="box shipping-method">
<h4>USPS Next Day</h4>
<p>Get it right on next day - fastest option possible.</p>
<div class="box-footer text-center">
<input type="radio" name="delivery" value="delivery1">
</div>
</div>
</div>
<div class="col-sm-6">
<div class="box shipping-method">
<h4>USPS Air</h4>
<p>Get it in 2-3 business days.</p>
<div class="box-footer text-center">
<input type="radio" name="delivery" value="delivery2">
</div>
</div>
</div>
<div class="col-sm-6">
<div class="box shipping-method">
<h4>USPS Ground</h4>
<p>Get it in 6-8 business days.</p>
<div class="box-footer text-center">
<input type="radio" name="delivery" value="delivery3">
</div>
</div>
</div>
</div>
<!-- /.row -->
</div>
<!-- /.content -->
<div class="box-footer">
<div class="pull-left">
<a href="checkout1.php" class="btn btn-default"><i class="fa fa-chevron-left"></i>Back to Addresses</a>
</div>
<div class="pull-right">
<button type="submit" class="btn btn-primary">Continue to Payment Method<i class="fa fa-chevron-right"></i>
</button>
</div>
</div>
</form>
</div>
<!-- /.box -->
</div>
<!-- /.col-md-9 -->
<div class="col-md-3">
<div class="box" id="order-summary">
<div class="box-header">
<h3>Order summary</h3>
</div>
<p class="text-muted">Shipping and additional costs are calculated based on the values you have entered.</p>
<div class="table-responsive">
<table class="table">
<tbody>
<tr>
<td>Order subtotal</td>
<th>
<?php
if(mysqli_num_rows($result)==0){
echo "There are no items in your cart ...";
}
else{
echo "$$sum";
}
?>
</th>
</tr>
<tr>
<td>Shipping and handling</td>
<th>$10.00</th>
</tr>
<tr>
<td>Tax</td>
<th>$0.00</th>
</tr>
<tr class="total">
<td>Total</td>
<th>
<?php
$shipping=10;
if(mysqli_num_rows($result)==0){
echo "There are no items in your cart ...";
}
else{
echo "$";
print ($sum + $shipping);
}
?>
</th>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- /.col-md-3 -->
</div>
<!-- /.container -->
</div>
<!-- /#content -->
</div>
<!-- /#all -->
<?php include 'footer.php';?>