forked from mgherghi/inventory
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcart.php
83 lines (81 loc) · 3.17 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
<?php
$page_title = 'Shopping Cart';
require_once('includes/load.php');
$user = current_user();
if(isset($_POST['empty_cart']))
{
$_SESSION['items'] = array();
if($user['user_level'] === '1'){
redirect("products.php", false);
}else{
redirect("user_products.php", false);
}
}
if(isset($_POST['remove']))
{
//$index = remove_junk($db->escape($_POST['item']));
//unset($_SESSION['items'],$index);
//redirect("add_order.php", false);
}
?>
<?php include_once('layouts/header.php'); ?>
<div class="row">
<div class="col-md-6">
<?php echo display_msg($msg); ?>
</div>
</div>
<div class="row">
<div class="col-md-16">
<div class="panel panel-default">
<div class="panel-heading clearfix">
<strong>
<span class="glyphicon glyphicon-th"></span>
Cart Items
</strong>
<a class="pull-right clearfix" href="add_order.php"><button class="btn btn-default">Go To Checkout</button></a>
<form method="post" action="" class="pull-right clearfix">
<button class="btn btn-default" type="submit" name="empty_cart">Empty Cart</button>
</form>
</div>
<div class="panel-body">
<table class="table table-bordered">
<thead>
<tr>
<th class="text-center" style="width: 10%;">#</th>
<th class="text-center" style="width: 50px;"> Product Title </th>
<th class="text-center" style="width: 50px;"> GPC Number </th>
<th class="text-center" style="width: 10%;"> Location </th>
<th class="text-center" style="width: 50px;"> Stock </th>
<th class="text-center" style="width: 50px;"> Min </th>
<th class="text-center" style="width: 50px;"> Max </th>
<th class="text-center" style="width: 10%;"> GPC P/N </th>
<th class="text-center" style="width: 10%;"> Manufacturer P/N </th>
<th class="text-center" style="width: 10%;"> Action </th>
</tr>
</thead>
<tbody>
<?php if (isset($_SESSION['items'])){
foreach ($_SESSION['items'] as $item){
$product = find_by_gpcnum('products', (int)$item);
echo "<tr>";
echo "<td class='text-center'>".remove_junk($product['id']). "</td>";
echo "<td>".remove_junk($product['name'])."</td>";
echo "<td class='text-center'>".remove_junk($product['gpc_number'])."</td>";
echo "<td class='text-center'>".remove_junk($product['location'])."</td>";
echo "<td class='text-center'>".remove_junk($product['quantity'])."</td>";
echo "<td class='text-center'>".remove_junk($product['min'])."</td>";
echo "<td class='text-center'>".remove_junk($product['max'])."</td>";
echo "<td class='text-center'>".$item."</td>";
echo "<td class='text-center'>".remove_junk($product['manufacturernumber'])."</td>";
echo "<td class='text-center'>";
echo '<div class="btn-group">';
echo '<a href="remove_item.php?id='.(int)$item.'" onClick="return confirm("Are you sure you want to return?")" class="btn btn-xs btn-danger" data-toggle="tooltip" title="Return">Remove</a></div></td>';
echo "</tr>";
}
}?>
</tbody>
</table>
</div>
</div>
</div>
</div>