-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcart.php
155 lines (112 loc) · 7.09 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
<section id="cart_items">
<div class="container">
<div class="breadcrumbs">
<ol class="breadcrumb">
<li><a href="#">Home</a></li>
<li class="active">Shopping Cart</li>
</ol>
</div>
<div class="table-responsive cart_info">
<?php
// if (!isset($_SESSION['USERID'])){
// redirect("index.php");
check_message();
?>
<table class="table table-condensed" id="table" >
<thead>
<tr class="cart_menu">
<td >Product</td>
<td >Description</td>
<td width="15%" >Price</td>
<td width="15%" >Quantity</td>
<td width="15%" >Total</td>
</tr>
</thead>
<?php
if (!empty($_SESSION['gcCart'])){
echo '<script>totalprice()</script>';
$count_cart = count($_SESSION['gcCart']);
for ($i=0; $i < $count_cart ; $i++) {
$query = "SELECT * FROM `tblpromopro` pr , `tblproduct` p , `tblcategory` c
WHERE pr.`PROID`=p.`PROID` AND p.`CATEGID` = c.`CATEGID` and p.`PROID` = '".@$_SESSION['gcCart'][$i]['productid']."'";
$mydb->setQuery($query);
$cur = $mydb->loadResultList();
foreach ($cur as $result) {
?>
<tr>
<td>
<img src="<?php echo web_root. 'admin/products/'.$result->IMAGES; ?>" onload=" totalprice() " width="50px" height="50px">
<br/>
<?php
if (isset($_SESSION['CUSID'])){
echo ' <a href="'.web_root. 'customer/controller.php?action=addwish&proid='.$result->PROID.'" title="Add to wishlist">Add to wishlist</a>
';
}else{
echo '<a href="#" title="Add to wishlist" class="proid" data-target="#smyModal" data-toggle="modal" data-id="'. $result->PROID.'">Add to wishlist</a>
';
}
?>
</td>
<td>
<?php echo $result->PRODESC ; ?>
</td>
<td>
<input type="hidden" id ="PROPRICE<?php echo $result->PROID; ?>" name="PROPRICE<?php echo $result->PROID; ?>" value="<?php echo $result->PRODISPRICE ; ?>" >
€ <?php echo $result->PRODISPRICE ; ?>
</td>
<td class="input-group custom-search-form" >
<input type="hidden" maxlength="3" class="form-control input-sm" autocomplete="off" id ="ORIGQTY<?php echo $result->PROID; ?>" name="ORIGQTY<?php echo $result->PROID; ?>" value="<?php echo $result->PROQTY; ?>" placeholder="Search for...">
<input type="number" maxlength="3" data-id="<?php echo $result->PROID; ?>" class="QTY form-control input-sm" autocomplete="off" id ="QTY<?php echo $result->PROID; ?>" name="QTY<?php echo $result->PROID; ?>" value="<?php echo $_SESSION['gcCart'][$i]['qty']; ?>" placeholder="Search for...">
<span class="input-group-btn">
<a title="Remove Item" class="btn btn-danger btn-sm" id="btnsearch" name="btnsearch" href="cart/controller.php?action=delete&id=<?php echo $result->PROID; ?>">
<i class="fa fa-trash-o"></i>
</a>
</span>
</td>
<input type="hidden" id ="TOT<?php echo $result->PROID; ?>" name="TOT<?php echo $result->PROID; ?>" value="<?php echo $result->PRODISPRICE ; ?>" >
<td> € <output id="Osubtot<?php echo $result->PROID ?>"><?php echo $_SESSION['gcCart'][$i]['price'] ; ?></output></td>
</tr>
<?php
}
}
}else{
echo "<h1>There is no item in the cart.</h1>";
}
?>
</table>
<h3 align="right"> Total €<span id="sum">0</span></h3>
</div>
</div>
</section>
<section id="do_action">
<div class="container">
<div class="heading">
<h3>What would you like to do next?</h3>
<p>Choose if you have a discount code or reward points you want to use or would like to estimate your delivery cost.</p>
</div>
<div class="row">
<form action="index.php?q=orderdetails" method="post">
<a href="index.php?q=product" class="btn btn-default check_out pull-left ">
<i class="fa fa-arrow-left fa-fw"></i>
Add New Order
</a>
<?php
$countcart =isset($_SESSION['gcCart'])? count($_SESSION['gcCart']) : "0";
if ($countcart > 0){
if (isset($_SESSION['CUSID'])){
echo '<button type="submit" name="proceed" id="proceed" class="btn btn-default check_out btn-pup pull-right">
Proceed And Checkout
<i class="fa fa-arrow-right fa-fw"></i>
</button>';
}else{
echo '<a data-target="#smyModal" data-toggle="modal" class="btn btn-default check_out signup pull-right" href="">
Proceed And Checkout
<i class="fa fa-arrow-right fa-fw"></i>
</a>';
}
}
?>
</form>
</div>
</div>
</section><!--/#do_action-->