-
Notifications
You must be signed in to change notification settings - Fork 1
/
cart.php
181 lines (128 loc) · 4.44 KB
/
cart.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
<html>
<?php
session_start();
require_once "header1.php";
if(isset($_SESSION['u_name'])){
$us_name= $_SESSION['u_name'] ;
require_once "refresh_cart.php";
?>
<div class="cart">
<div class="container">
<ol class="breadcrumb">
<li><a href="index.php">Home</a></li>
<li class="active">Cart</li>
</ol>
<div class="col-md-9 cart-items">
<h2>My Shopping Bag</h2>
<!-- Created On 31-March-2018, Prabhat Chandra -->
<div class="cart-header">
<div class="cart-sec">
<?php
// $sql=mysqli_query($conn,"SELECT * FROM `testing` WHERE u_name='$u_name'");
// while($fimpo = $sql->fetch_array()){
//echo "Yo!".$u_name;
$sql = $conn->query("SELECT * FROM u_cart , i_new_product
WHERE u_cart.p_id = i_new_product.id AND u_cart.user_name='$u_name' ")
or die(mysqli_error($conn)) ;
while($fimpo = $sql->fetch_array()){
$id = $fimpo['p_id'];
$qty = $fimpo['u_qty'];
?>
<div class="cart-item">
<?php
echo '<img src="data:image/jpeg;base64,'.base64_encode( $fimpo['image'] ).'" />';
// echo $fimpo['user_name'];
?>
</div>
<div class="cart-item-info">
<h3 class="item_name"><?php echo $fimpo['name'];?><span>Model id: <?php echo $fimpo['p_id'];?> </span></h3>
<h4><span>Rs. </span> <?php echo $fimpo['u_price'];?></h4>
<form action="update_cart_qty.php" method="post">
<input type="hidden" name="id" value=" <?php echo $id; ?> ">
<p class="qty">Selected Qty ::<?php echo $fimpo['u_qty']; ?><br>UPDATE:</p><input min="1" type="number" name="qty" value="1" class="form-control input-small">
<input type="submit" value="Apply">
</form>
<form action="remove_item_cart.php" method="post">
<input type="hidden" name="id" value=" <?php echo $id; ?> ">
<input type="submit" value="Remove">
</form>
</div> <?php
}
?>
<div class="clearfix"></div>
<div class="delivery">
<span>Delivered in 2-3 business days</span>
<div class="clearfix"></div>
</div>
</div>
</div>
</div>
<div class="col-md-3 cart-total">
<p>SEE FINAL PRICE:</p><BR>
<div class="price-details">
<h3>Price Details</h3>
<?php
$sql = $conn->query("SELECT * FROM cart_t WHERE cart_t.cus_name='$u_name'
")
or die(mysqli_error($conn)) ;
while($fimpo = $sql->fetch_array()){
$t_price = $fimpo['totalprice'];
?>
<span>Total</span>
<span class="total">Rs.<?php echo $fimpo['totalprice']; ?>.00</span>
<span>Discount</span>
<span class="total">---</span>
<div class="clearfix"></div>
</div>
<h4 class="last-price">TOTAL</h4>
<span class="total final">Rs.<?php
echo $t_price ;}
?>.00
<?php
$sql = $conn->query("SELECT * FROM cart_t_q WHERE cart_t_q.user_name='$us_name'
")
or die(mysqli_error($conn)) ;
while($fimpo = $sql->fetch_array()){
$t_qty2 = $fimpo['t_qty'];
?>
<br>
<h5>Total Number Of Items: <?php echo $t_qty2;} ?></h5>
</span>
<div class="clearfix"></div>
<br><br>
<?php
if($t_qty2 == 0 ){
echo'
<script type = "text/javascript">
alert("NO ITEM IN CART!!!");
window.location = "index.php";
</script>
';
} else { ?>
<form action="checkout.php" method="post">
<button class="btns">PLACE ORDER</button>
</form>
<?php
}
?>
<!-- <div class="total-item">
<h3>OPTIONS</h3>
<h4>COUPONS</h4>
<a class="cpns" href="#">Apply Coupons</a>
<p><a href="#">Log In</a> to use accounts - linked coupons</p>
</div> -->
</div>
</div>
</div>
<?php
require_once "men_footer.php";
} else {
echo'
<script type = "text/javascript">
alert("Sign In First!!!");
window.location = "login.php";
</script>
';
}
?>
</html>