This repository has been archived by the owner on Apr 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
navbar.php
executable file
·201 lines (184 loc) · 6.6 KB
/
navbar.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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
<?php
session_start();
error_reporting(0);
require_once('essentials/config.php');
date_default_timezone_set('Asia/Kolkata');
if ($_SESSION['email']) {
$customer = $_SESSION['email'];
$find_data = "
SELECT * FROM customer WHERE email = '$customer' LIMIT 1
";
$found_data = $connect->query($find_data);
$customer_id_array = $found_data->fetch_assoc();
$_SESSION['id'] = $customer_id_array['id'];
$customer_id = $customer_id_array['id'];
$_SESSION['name'] = $customer_id_array['name'];
$_SESSION['phone'] = $customer_id_array['phone'];
$customer_created = $customer_id_array['datetym'];
$customer_login = $customer_id_array['last_login'];
} else {
$customer_id = '0';
}
?>
<style type="text/css">
input {
border: none;
border: none transparent;
outline: none;
}
.result {
width: 100%;
position: absolute;
margin: 0;
opacity: 20;
z-index: 10;
font-size: 12px;
text-transform: uppercase;
color: #888;
background: #fff;
text-align: left;
}
.result p {
background: #fff;
color: #888;
padding: 4px;
font-weight:bolder;
border-radius: 2px;
}
.result p:nth-child(even) {
background: #fff;
color: #888;
}
.result p a:hover {
cursor: pointer;
color: black !important;
}
</style>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Mukta:300,400,700">
<link rel="stylesheet" href="essentials/fonts/icomoon/style.css">
<link rel="stylesheet" href="essentials/css/bootstrap.min.css">
<link rel="stylesheet" href="essentials/css/magnific-popup.css">
<link rel="stylesheet" href="essentials/css/jquery-ui.css">
<link rel="stylesheet" href="essentials/css/owl.carousel.min.css">
<link rel="stylesheet" href="essentials/css/owl.theme.default.min.css">
<link rel="stylesheet" href="essentials/css/aos.css">
<link rel="stylesheet" href="essentials/css/style.css">
<div class="site-wrap mb-4">
<header class="site-navbar" role="banner">
<div class="site-navbar-top">
<div class="container">
<div class="row align-items-center">
<div class="col-6 col-md-4 order-2 order-md-1 site-search-icon text-center">
<div class="site-block-top-search search-box">
<input type="text" class="border-0" placeholder="Search" />
<div class="result"></div>
</div>
</div>
<div class="col-12 mb-3 mb-md-0 col-md-4 order-1 order-md-2 text-center">
<a href="index.php" class="js-logo-clone">
<img src="img/logo_nav.png" alt="logo" width="200" height="95"></a>
</div>
<div class="col-6 col-md-4 order-3 order-md-3 text-right">
<div class="site-top-icons">
<ul>
<?php
if ($_SESSION['email'] == null) {
echo "
<li>
<a href='login.php'>
<i class='fas fa-user'></i>
</a>
</li>";
} else {
$fav_sql = mysqli_query($connect, "SELECT * FROM wishlist WHERE customer_id=".$_SESSION['id']);
$count_fav = mysqli_num_rows($fav_sql);
echo '
<li>
<a href="dashboard.php"><i class="fas fa-user-check"></i></a>
</li>
<li>
<a href="wishlist.php" class="site-cart">
<i class="fas fa-heart"></i>
<span class="count">' . $count_fav . '</span>
</a>
</li>';
} ?>
<?php
if (isset($_SESSION['cart'])) {
$total = 0;
foreach ($_SESSION['cart'] as $variant => $quantity) {
$total = $total + $quantity;
}
} else {
$total = 0;
}
?>
<li>
<a href="cart.php" class="site-cart">
<i class="fas fa-shopping-cart"></i>
<span class="count"><?php echo $total; ?></span>
</a>
</li>
<li class="d-inline-block d-md-none ml-md-0"><a href="#" class="site-menu-toggle js-menu-toggle"><i class="fas fa-bars"></i></a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
<nav class="site-navigation text-right text-md-center" role="navigation">
<div class="container">
<ul class="site-menu js-clone-nav d-none d-md-block">
<li class="active"><a href="index.php">Home</a></li>
<li><a href="shop.php">Shop</a></li>
<li><a href="bestSellerPage.php">Bestseller</a></li>
<li><a href="newArrival.php">New Arrivals</a></li>
<li><a href="about.php">About</a></li>
<li><a href="contact.php">Contact</a></li>
<?php
if ($_SESSION['email'] == null) {
echo '
<li style="margin-top: 50px;" class="log_button" ><a href="login.php" style="color:#66fcf1; font-weight:bolder; " class="btn btn-sm pull-center">
signin / signup
</a></li>';
} else {
echo '
<li style="margin-top: 50px;" class="log_button" ><a href="logout.php" style="color:#66fcf1; font-weight:bolder; " class="btn btn-sm pull-center">
Logout
</a></li>';
} ?>
</ul>
</div>
</nav>
</header>
</div>
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('.search-box input[type="text"]').on("keyup input", function() {
var inputVal = $(this).val();
var resultDropdown = $(this).siblings(".result");
if (inputVal.length) {
$.get("fetchSearch.php", {
term: inputVal
}).done(function(data) {
resultDropdown.html(data);
});
} else {
resultDropdown.empty();
}
});
$(document).on("click", ".result p", function() {
$(this).parents(".search-box").find('input[type="text"]').val($(this).text());
$(this).parent(".result").empty();
});
});
</script>
<script src="essentials/js/jquery-3.3.1.min.js"></script>
<script src="essentials/js/jquery-ui.js"></script>
<script src="essentials/js/popper.min.js"></script>
<script src="essentials/js/bootstrap.min.js"></script>
<script src="essentials/js/owl.carousel.min.js"></script>
<script src="essentials/js/jquery.magnific-popup.min.js"></script>
<script src="essentials/js/aos.js"></script>
<script src="essentials/js/main.js"></script>