-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcart.php
112 lines (85 loc) · 3.34 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
session_start();
if(isset($_GET['p_id'])){
$x = $_GET['p_id'];
$y = $_GET['size'];
$_SESSION['cost'] += $_GET['price'];
array_push($_SESSION['cart'], [$x, $y]);
header('Location: cart.php');
}
require 'db.inc.php';
if(!isset($_SESSION['user'])){
header('Location: index.php');
}
$shipping = 0;
$_SESSION['final_cost'] = $_SESSION['cost']*1.07+$shipping;
?>
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="login_style.css">
<link rel="stylesheet" href="style_list.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.2/css/all.css" integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" crossorigin="anonymous">
<title>VELASCA</title>
</head>
<body>
<div id="wrapper" >
<style>
nav{
position: fixed;
}
nav #logo{
color: black;
}
</style>
<?php
include 'navbar.php'
?>
<div style="margin-left:120px;margin-right:120px;margin-top:120px;margin-bottom:50px;">
<!-- <div> -->
<h1><?php echo $_SESSION['user']; ?>'s Cart</h1>
<h2>Total Cost : $<?php echo $_SESSION['final_cost']; ?></h2>
<hr>
</div>
<!-- <div class="cart-items" style="margin-left:0;width:50%;" > -->
<div style="display:block; float:left; width:60%">
<?php
foreach ($_SESSION['cart'] as $var){
$p_id = $var[0];
include 'cart.inc.php';
}
?>
</div>
<!-- <div class="cart-sum" style="margin-right=0;width:50%;float:right;"> -->
<div style="display:block;float:right;width:15%; margin-right:20%; margin-bottom:40px;line-height:40px;border-left:1px solid black;padding: 30px">
<span style="color: grey;">PRICE DETAILS</span> <br>
Total MRP <span style="float:right;">$<?php echo $_SESSION['cost']; ?></span> <br>
Estimated Tax <span style="float:right;">$<?php echo $_SESSION['cost']*0.07; ?></span> <br>
Delivery Charges <span style="float:right;">$
<?php
if($_SESSION['cost'] < 300){
$shipping = 50;
}
echo $shipping;
?></span> <br>
<hr>
<b>Total <span style="float:right;">$<?php echo $_SESSION['final_cost']; ?></span> </b><br>
<a href="address.php"><button style="width:100%;height:40px;" id="place_order"><b>PLACE ORDER</b></button></a>
</div>
<style>
#place_order:hover{
transition: .3s;
font-size: 14px;
}
</style>
<?php
include 'footer.php'
?>
</div>
</body>
<script src="https://code.jquery.com/jquery-3.3.1.js" integrity="sha256-2Kok7MbOyxpgUVvAk/HJ2jigOSYS2auK4Pfzbm7uH60="
crossorigin="anonymous"></script>
<script src="list_script.js"></script>
<link href="https://fonts.googleapis.com/css?family=Cedarville+Cursive|Karla|Bad+Script|Handlee" rel="stylesheet">
</html>