-
Notifications
You must be signed in to change notification settings - Fork 1
/
nav.php
137 lines (119 loc) · 6.14 KB
/
nav.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
<?php include('connection.php') ?>
<div style="width:100% ; background-color:#222f3e ">
<div style="margin-left:10% ; margin-right: 10%;">
<nav class="navbar navbar-expand-lg navbar navbar " style="background-color:#222f3e">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbarSupportedContent" aria-expanded="false">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="main.php">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
View
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="product.php">View Products</a>
<a class="dropdown-item" href="outlets.php">View Outlets</a>
<?php if(isset($_SESSION['login']) && ($_SESSION['role']=='admin')){ ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="user_details.php">View Users</a>
</div>
<?php } ?>
</li>
<?php if(isset($_SESSION['login']) && ($_SESSION['role']=='admin')){ ?>
<li class="nav-item">
<a class="nav-link" href="additem.php">Add Products</a>
</li>
<li class="nav-item">
<a class="nav-link" href="add_outlets.php" tabindex="-1" aria-disabled="true">Add Outlets</a>
</li>
<li class="nav-item">
<a class="nav-link" href="add_category.php" tabindex="-1" aria-disabled="true">Add Category</a>
</li>
<?php } ?>
<!-- <li class="nav-item">
<a class="nav-link disabled" href="#" tabindex="-1" aria-disabled="true">Logout</a>
</li> -->
</ul>
<form class="form-inline my-2 my-lg-0">
<!-- <a href="my-cart.php" style="margin-right:25px;"><i class="icon fa fa-shopping-cart" style="margin-right:10px;"></i>My Cart</a> -->
<div class="dropdown">
<button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="icon fa fa-shopping-cart" style="margin-right:10px;"></i>My Cart Rs
<?php
if(isset($_SESSION['cart'])){
$total=0;
foreach($_SESSION['cart'] as $key => $value)
{
$total+=$value['quantity']*$value['price'];
}
echo "".$total;
}else {
echo "00 ";
}
?> .00/=
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<div class="card" style=" width:350px;">
<center>
<?php if(isset($_SESSION['cart'])) {
foreach ($_SESSION['cart'] as $key => $value) {
$sql = "select * from products where id={$key}";
$res=mysqli_query($conn,$sql);
if(!$res){
die("Error in the products".mysqli_error($conn));
}
$row = mysqli_fetch_assoc($res);
?>
<div class="row">
<div class="col-6">
<img src="upload\<?php echo "".$row['product_image']; ?>" style="width:130px; height:80px;" >
</div>
<div class="col-6">
<center>
<h6><?php echo " ".$row['product_name']; ?></h6>
<p>Rs<?php echo "".$value['price'] ?>*<?php echo "".$value['quantity'] ?></p>
</center>
</div>
</div>
<?php } ?>
<div class="row">
<div class="col-12">
<center>
<h6>Total Price</h6>
<h4>Rs.<?php
if(isset($_SESSION['cart'])){
$total=0;
foreach($_SESSION['cart'] as $key => $value){
$total+=$value['quantity']*$value['price'];
}
echo "".$total;
}
?>/=</h4>
</center>
</div>
</div>
<a href="my-cart.php" class="lnk btn btn-primary" type="submit"><i class="icon fa fa-shopping-cart" style="margin-right:10px;"></i>Buy</a>
<?php }
else{ ?>
<h3>Your Cart is empty</h3>
<button type="button" class="btn btn-primary" name="button">More shopping</button>
<?php } ?>
</center>
</div>
</div>
</div>
<input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search">
<button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
</form>
</div>
</nav>
</div>
</div>