-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcart.php
112 lines (112 loc) · 4.73 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
<?php include 'includes/header.php'; ?>
<div class="alert alert-primary" role="alert">
<marquee behavior="scroll" direction="left">Winter flash sell...Buy now and get 20% off</marquee>
</div>
<div class="container card-product">
<div class="card">
<div class="card-header">
<h5>Cart Item List</h5>
</div>
<div class="card-body">
<!-- Content here -->
<table class="table table-borderless">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Product Name</th>
<th scope="col">Product Price</th>
<th scope="col">Quantity</th>
<th scope="col">Edit</th>
</tr>
</thead>
<tbody>
<?php include 'backend/cartfetch.php'; ?>
</tbody>
</table>
</div>
<div class="card-footer">
<div class="btn btn-success btn-sm" type="button" data-toggle="modal" data-target="#checkoutModal" data-amount="<?=$amount;?>" data-user="<?=$cust_id;?>">Checkout</div>
<div class="product-total">
<p>Net Product Price: ৳ <?php echo $amount.'.00'?></p>
</div>
</div>
</div>
</div>
<?php
$fname="";
$mname="";
$lname="";
$contact="";
$address="";
IF(ISSET($_SESSION['name'])){
include "database/db_con.php";
$name=$_SESSION['name'];
$cust_id=$_SESSION['cust_id'];
$getInfo="SELECT * FROM CUSTOMER WHERE cust_id='$cust_id'";
$cek=mysqli_query($con,$getInfo);
$count=mysqli_num_rows($cek);
$data=mysqli_fetch_array($cek);
if($count == 1){
$fname=$data['first_name'];
$mname=$data['middle_name'];
$lname=$data['last_name'];
$contact=$data['contact'];
$address=$data['address'];
}
}
?>
<!-- Modal Checkout -->
<div class="modal fade" id="checkoutModal" tabindex="-1" role="dialog" aria-labelledby="checkoutModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="checkoutModalLabel">CHECKOUT</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div class="form-row">
<div class="form-group col-md-6">
<label for="inputName">Shipping Name</label>
<input type="text" class="form-control" id="name" name="name" value="<?php echo $fname.' '.$mname.' '.$lname;?> " required>
</div>
<div class="form-group col-md-6">
<label for="inputContact">Contact Number</label>
<input type="text" class="form-control" id="c-contact" name="number" value="<?php echo $contact;?>" required>
</div>
</div>
<div class="form-group">
<label for="inputAddress">Address</label>
<input type="text" class="form-control" id="c-address" name="address" placeholder="1234 Main St" value="<?php echo $address;?>" required>
</div>
<div class="form-group">
<label for="inputAddress2">Address 2</label>
<input type="text" class="form-control" id="c-address2" name="address2" placeholder="Apartment, studio, or floor">
</div>
<div class="form-row">
<div class="form-group col-md-12">
<label for="inputPM">Payment Method</label>
<select id="pmethod" class="form-control" name="pmethod">
<option selected>Cash On Delivery</option>
<option>DBBL Rocket</option>
<option>Bkash</option>
<option>Nagad</option>
</select>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary btn-sm" id="checkout">CONFIRM ORDER</button>
</div>
</div>
</div>
</div>
<?php include 'includes/footer.php'; ?>
<?php
$cust_id=session_id();
$time=time();
$time_check=$time-1220; // set for 10 minutes
$delete = "DELETE FROM GUEST_CART WHERE temp_id='$cust_id' AND time_get<$time_check";
mysqli_query($con,$delete);
?>