-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathorder.php
More file actions
116 lines (116 loc) · 4.04 KB
/
order.php
File metadata and controls
116 lines (116 loc) · 4.04 KB
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
<?php
session_start();
include 'includes/header.php';
include 'includes/nav.php';
?>
<div id="main">
<header class="container">
<h3 class="page-header">Order</h3>
</header>
<div class="container">
<div class="row">
<div class="col-md-7 col-sm-6">
<?php if( count($_SESSION['CART']) > 0 ) { ?>
<h4>Review Order Items</h4>
<div class="table-responsive">
<table class="table products-table">
<thead>
<tr>
<th>Preview</th>
<th>Name</th>
<th class="text-center">Price</th>
<th class="text-center">Remove</th>
</tr>
</thead>
<tbody>
<?php
$_SESSION['total'] = 0;
foreach ($_SESSION['CART'] as $item) {
$_SESSION['total'] += $item['pd_price'];
?>
<tr>
<td><img style="max-width:140px;" src="img/uploads/<?php echo $item['pd_image'] ?>" alt="<?php echo $item['pd_name'] ?>"></td>
<td><?php echo $item['pd_name'] ?></td>
<?php setlocale(LC_MONETARY,'en_US'); ?>
<td class="text-center">₹ <?php echo money_format('%!i', floatval($item['pd_price'])); ?></td>
<td class="text-center"><a href="cart.php?del=<?php echo $item['pd_id'] ?>"><span class="glyphicon glyphicon-trash" onclick="return confirm('Are you sure you want to delete this item from you cart?');"> </span></a></td>
</tr>
<?php
}
?>
<tr>
<td> </td>
<td>
<h4>Total:</h4>
</td>
<td class="text-info text-center">
₹ <?php echo money_format('%!i', floatval($_SESSION['total'])); ?>
</td>
<td> </td>
</tr>
</tbody>
</table>
</div>
<?php
} // check count of cart
else
{
echo '<div class="alert alert-info">Oh no! Add something to your cart from the Store.</div>';
}
?>
</div>
<div class="col-md-5 col-sm-6">
<h4>Order Details</h4>
<form id="oform" class="form-horizontal" action="includes/order-exec.php" method="POST">
<div class="form-group">
<label for="name" class="col-sm-4 control-label">Name</label>
<div class="col-sm-8">
<input type="text" class="form-control" placeholder="Steve Jobs" name="name" id="name">
</div>
</div>
<div class="form-group">
<label for="address" class="col-sm-4 control-label">Address</label>
<div class="col-sm-8">
<textarea class="form-control" name="address" id="address"></textarea>
</div>
</div>
<div class="form-group">
<label for="city" class="col-sm-4 control-label">City</label>
<div class="col-sm-8">
<input type="text" class="form-control" placeholder="Mumbai" name="city" id="city">
</div>
</div>
<div class="form-group">
<label for="postal_code" class="col-sm-4 control-label">PIN Code</label>
<div class="col-sm-8">
<input type="text" class="form-control" placeholder="400001" name="postal_code" id="postal_code">
</div>
</div>
<button class="btn btn-block btn-success btn-lg">Order & Checkout<br></button>
</form>
</div>
</div>
</div>
</div>
<script>
$('#oform').submit(function(e){
$('.alert-warning').remove();
var name = $('#name').val();
var address = $('#address').val();
var city = $('#city').val();
var postal_code = $('#postal_code').val();
if(name == '' || address == '' || city=='' || postal_code=='' )
{
$('<div class="alert alert-warning"><b>Oh no!</b> Please fill all feilds.</div>').hide().insertBefore('#oform');
$('.alert-warning').fadeIn();
return false;
}
else
{
return true;
}
});
</script>
<?php
include 'includes/footer.php';
?>