/
mycart.php
164 lines (151 loc) · 4.77 KB
/
mycart.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
<?php include("header.php");?>
<section class="breadcrumb-section">
<h2 class="sr-only">Site Breadcrumb</h2>
<div class="container">
<div class="breadcrumb-contents">
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="index.php">Home</a></li>
<li class="breadcrumb-item active">My Cart</li>
</ol>
</nav>
</div>
</div>
</section>
<!-- Cart Page Start -->
<main class="cart-page-main-block inner-page-sec-padding-bottom">
<div class="cart_area cart-area-padding ">
<div class="container">
<div class="page-section-title">
<h1>Shopping Cart</h1>
</div>
<div class="row">
<div class="col-12">
<form action="#" class="">
<!-- Cart Table -->
<div class="cart-table table-responsive mb--40">
<table class="table">
<!-- Head Row -->
<thead>
<tr>
<th class="pro-remove"></th>
<th class="pro-title">Class</th>
<th class="pro-thumbnail">Subject</th>
<th class="pro-title">Publisher</th>
<th class="pro-price">Price</th>
<th class="pro-quantity">Quantity</th>
<th class="pro-subtotal">Total</th>
</tr>
</thead>
<tbody>
<?php
$total=0;
$dc=0;
foreach ($_SESSION['mycart'] as $i => $value) {
$subject="";
$publisher="";
$pprice=0;
$classid=0;
if($value['t']=="book")
{
$fet_pro="select * from tbl_books where book_id='$i'";
$run_pro=mysqli_query($con,$fet_pro);
$row_pro=mysqli_fetch_array($run_pro);
$pprice=$row_pro['sell_price'];
$subject=$row_pro['book_subject'];
$publisher=$row_pro['book_publisher'];
$classid=$row_pro['class_id'];
}
if($value['t']=="guest")
{
$fet_pro="select * from tbl_guestpaper where guest_id='$i'";
$run_pro=mysqli_query($con,$fet_pro);
$row_pro=mysqli_fetch_array($run_pro);
$pprice=$row_pro['sell_price'];
$subject=$row_pro['guestpaper_subject'];
$publisher=$row_pro['guestpaper_publisher'];
$classid=$row_pro['class_id'];
}
if($value['t']=="note")
{
$fet_pro="select * from tbl_notes where note_id='$i'";
$run_pro=mysqli_query($con,$fet_pro);
$row_pro=mysqli_fetch_array($run_pro);
$pprice=$row_pro['sell_price'];
$subject=$row_pro['note_subject'];
$publisher=$row_pro['note_publisher'];
$classid=$row_pro['class_id'];
}
if($value['t']=="stationary")
{
$fet_pro="select * from tbl_stationary where s_id='$i'";
$run_pro=mysqli_query($con,$fet_pro);
$row_pro=mysqli_fetch_array($run_pro);
$pprice=$row_pro['s_price'];
$subject="";
$publisher="";
$class_name=$row_pro['s_name'];
}
if($value['t']!="stationary")
{
$fg_class="select * from tbl_class where class_id='$classid'";
$run_class=mysqli_query($con,$fg_class);
$row_class=mysqli_fetch_array($run_class);
$class_name=$row_class['class_name'];
}
$qty=$value['q'];
$tol=$pprice * $value['q'];
$typp=$value['t'];
echo "
<tr>
<td class='pro-remove'><a href='remove.php?pid=$i'><i class='far fa-trash-alt'></i></a>
</td>
<td class='pro-thumbnail'>$class_name</td>
<td class='pro-title'><a >$subject</a></td>
<td class='pro-title'><a >$publisher</a></td>
<td class='pro-price'><span>Rs $pprice</span></td>
<td class='pro-quantity'>
<a href='addcart.php?pid=$i&type=$typp' style='color:black'><span class='ir'><i class='fas fa-plus'></i></span></a>
<span> $qty </span>
<a href='mincart.php?pid=$i&type=$typp' style='color:black'><span class='ir'><i class='fas fa-minus'></i></span></a>
</td>
<td class='pro-subtotal'><span>Rs : $tol</span></td>
</tr>
";
$total=$total + $tol;
}
?>
<!-- Product Row -->
</tbody>
</table>
</div>
</form>
</div>
</div>
</div>
</div>
<div class="cart-section-2">
<div class="container">
<div class="row">
<div class="col-lg-6 col-12 mb--30 mb-lg--0">
<!-- slide Block 5 / Normal Slider -->
</div>
<!-- Cart Summary -->
<div class="col-lg-6 col-12 d-flex">
<div class="cart-summary">
<div class="cart-summary-wrap">
<h4><span>Cart Summary</span></h4>
<p>Sub Total <span class="text-primary">Rs : <?php echo $total ?></span></p>
<p>Shipping Cost <span class="text-primary">Rs : 100</span></p>
<h2>Grand Total <span class="text-primary">Rs : <?php echo $total + 100; ?></span></h2>
</div>
<div class="cart-summary-button">
<a href="checkout.php" class="checkout-btn c-btn btn--primary">Checkout</a>
</div>
</div>
</div>
</div>
</div>
</div>
</main>
<?php include("footer.php");?>