forked from arjankc/online-store
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcart.php
141 lines (119 loc) · 3.69 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
<!DOCTYPE html>
<html lang="en">
<?php
include ("files/head.php");
?>
<body class="animsition">
<?php
include ("files/header.php");
?>
<?php
if (!isset($total)) {
$total=0;
}
?>
<!-- Shoping Cart -->
<?php
if (isset($_SESSION['cart'])) {
$total=0;
echo '<div class="bg0 p-t-75 p-b-85">
<div class="container">
<div class="row">
<div class="col-lg-10 col-xl-7 m-lr-auto m-b-50">
<div class="m-l-25 m-r--38 m-lr-0-xl">
<div class="wrap-table-shopping-cart">
<table class="table-shopping-cart">
<tr class="table_head">
<th class="column-1">Action</th>
<th class="column-2">Name</th>
<th class="column-3">Price</th>
<th class="column-4">Quantity</th>
<th class="column-5"></th>
</tr>';
foreach($_SESSION['cart'] as $key => $value) {
$total=$total+$value['item_price']*$value['quantity'];
?>
<tr class="table_row">
<td class="column-1">
<div class="">
<form action="cartremove.php" method="POST">
<button class="btn btn-sm btn-outline-danger" name="remove">Remove</button>
<input type="hidden" name="item_name" value="<?php echo $value['item_name'] ?>">
</form>
</div>
</td>
<td class="column-2"><?php echo $value['item_name'] ?></td>
<td class="column-3">Rs <?php echo $value['item_price'] ?></td>
<td class="column-4">
<form action="cartupdate.php" method="POST">
<div class="wrap-num-product flex-w m-l-auto m-r-0">
<div class="btn-num-product-down cl8 hov-btn3 trans-04 flex-c-m">
<i class="fs-16 zmdi zmdi-minus"></i>
</div>
<input class="mtext-104 cl3 txt-center num-product" type="number" name="quantity" value="<?php echo $value['quantity'] ?>">
<div class="btn-num-product-up cl8 hov-btn3 trans-04 flex-c-m">
<i class="fs-16 zmdi zmdi-plus"></i>
</div>
</div>
</td>
<td class="column-5">
<button class="btn btn-sm btn-outline-danger" name="update">Update</button>
<input type="hidden" name="item_name" value="<?php echo $value['item_name'] ?>">
</form>
</td>
</tr>
<?php
}
} else {
echo '<div class="bg0 p-t-75 p-b-85">
<div class="container">
<div class="row">
<div class="col-lg-10 col-xl-7 m-lr-auto m-b-50">
<div class="m-l-25 m-r--38 m-lr-0-xl">
<h1> Cart is empty</h1>
</div>
</div>
</div>
</div>';
}
?>
</table>
</div>
<!-- <div class="flex-w flex-sb-m bor15 p-t-18 p-b-15 p-lr-40 p-lr-15-sm">
<div class="flex-w flex-m m-r-20 m-tb-5">
</div>
</div> -->
</div>
</div>
<div class="col-sm-10 col-lg-7 col-xl-5 m-lr-auto m-b-50">
<div class="bor10 p-lr-40 p-t-30 p-b-40 m-l-63 m-r-40 m-lr-0-xl p-lr-15-sm">
<h4 class="mtext-109 cl2 p-b-30">
Cart Totals
</h4>
<div class="flex-w flex-t bor12 p-b-13">
<div class="size-208">
<span class="stext-110 cl2">
Total:
</span>
</div>
<div class="size-209">
<span class="mtext-110 cl2">
Rs <?php echo $total ?>
</span>
</div>
</div>
<button onclick="location.href='cart2.php'" class="flex-c-m stext-101 cl0 size-116 bg3 bor14 hov-btn3 p-lr-15 trans-04 pointer"
<?php if (!isset($_SESSION['cart'])) { echo'disabled';} ?>
>
Proceed to Checkout
</button>
</div>
</div>
</div>
</div>
</div>
<?php
include ("files/footer.php");
?>
</body>
</html>