-
Notifications
You must be signed in to change notification settings - Fork 0
/
top.php
executable file
·331 lines (308 loc) · 13.8 KB
/
top.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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
<?php
require('connection.inc.php');
require('functions.inc.php');
require('add_to_cart.inc.php');
$wishlist_count=0;
$cat_res=mysqli_query($con,"select * from categories where status=1 order by categories asc");
$cat_arr=array();
while($row=mysqli_fetch_assoc($cat_res)){
$cat_arr[]=$row;
}
$obj=new add_to_cart();
$totalProduct=$obj->totalProduct();
if(isset($_SESSION['USER_LOGIN'])){
$uid=$_SESSION['USER_ID'];
if(isset($_GET['wishlist_id'])){
$wid=get_safe_value($con,$_GET['wishlist_id']);
mysqli_query($con,"delete from wishlist where id='$wid' and user_id='$uid'");
}
$wishlist_count=mysqli_num_rows(mysqli_query($con,"select product.name,product.image,product.price,product.mrp,wishlist.id from product,wishlist where wishlist.product_id=product.id and wishlist.user_id='$uid'"));
}
$script_name=$_SERVER['SCRIPT_NAME'];
$script_name_arr=explode('/',$script_name);
$mypage=$script_name_arr[count($script_name_arr)-1];
$meta_title="AgroTech";
$meta_desc="Best and direct acrigulture shop website";
$meta_keyword="My Ecom Website";
if($mypage=='product.php'){
$product_id=get_safe_value($con,$_GET['id']);
$product_meta=mysqli_fetch_assoc(mysqli_query($con,"select * from product where id='$product_id'"));
$meta_title=$product_meta['meta_title'];
$meta_desc=$product_meta['meta_desc'];
$meta_keyword=$product_meta['meta_keyword'];
}if($mypage=='contact.php'){
$meta_title='Contact Us';
}
?>
<!doctype html>
<html class="no-js" lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title><?php echo $meta_title?></title>
<link rel="icon" href="images/favicon.ico" type="image/icon type">
<meta name="description" content="<?php echo $meta_desc?>">
<meta name="keywords" content="<?php echo $meta_keyword?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/owl.carousel.min.css">
<link rel="stylesheet" href="css/owl.theme.default.min.css">
<link rel="stylesheet" href="css/core.css">
<link rel="stylesheet" href="css/shortcode/shortcodes.css">
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="css/responsive.css">
<link rel="stylesheet" href="css/custom.css">
<script src="js/vendor/modernizr-3.5.0.min.js"></script>
<link rel="manifest" href="manifest.json">
<style>
.htc__shopping__cart a span.htc__wishlist {
background: #2196F3;
border-radius: 100%;
color: #fff;
font-size: 9px;
height: 17px;
line-height: 19px;
position: absolute;
right: 18px;
text-align: center;
top: -4px;
width: 17px;
margin-right:15px;
}
</style>
<script>
function focusearch() {
document.getElementById("searcht").focus();
}
</script>
</head>
<body>
<!--[if lt IE 8]>
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
<![endif]-->
<!-- Body main wrapper start -->
<div class="wrapper">
<header id="htc__header" class="htc__header__area header--one">
<div id="sticky-header-with-topbar" class="mainmenu__wrap sticky__header">
<div class="container">
<div class="row">
<div class="menumenu__container clearfix">
<div class="col-lg-2 col-md-2 col-sm-3 col-xs-5">
<div class="logo">
<a href="index.php"><img src="images/logo/4.png" alt="logo images"></a>
</div>
</div>
<div class="col-md-7 col-lg-6 col-sm-5 col-xs-3">
<nav class="main__menu__nav hidden-xs hidden-sm">
<ul class="main__menu">
<li class="drop"><a href="index.php">Home</a></li>
<?php
foreach($cat_arr as $list){
?>
<li class="drop"><a href="categories.php?id=<?php echo $list['id']?>"><?php echo $list['categories']?></a>
<?php
$cat_id=$list['id'];
$sub_cat_res=mysqli_query($con,"select * from sub_categories where status='1' and categories_id='$cat_id'");
if(mysqli_num_rows($sub_cat_res)>0){
?>
<ul class="dropdown">
<?php
while($sub_cat_rows=mysqli_fetch_assoc($sub_cat_res)){
echo '<li><a href="categories.php?id='.$list['id'].'&sub_categories='.$sub_cat_rows['id'].'">'.$sub_cat_rows['sub_categories'].'</a></li>
';
}
?>
</ul>
<?php } ?>
</li>
<?php
}
?>
<li><a href="contact.php">contact</a></li>
</ul>
</nav>
<div class="mobile-menu clearfix visible-xs visible-sm">
<nav id="mobile_dropdown">
<ul>
<li><a href="index.php">Home</a></li>
<?php
foreach($cat_arr as $list){
?>
<li class="drop"><a href="categories.php?id=<?php echo $list['id']?>"><?php echo $list['categories']?></a>
<?php
$cat_id=$list['id'];
$sub_cat_res=mysqli_query($con,"select * from sub_categories where status='1' and categories_id='$cat_id'");
if(mysqli_num_rows($sub_cat_res)>0){
?>
<ul class="dropdown">
<?php
while($sub_cat_rows=mysqli_fetch_assoc($sub_cat_res)){
echo '<li><a href="categories.php?id='.$list['id'].'&sub_categories='.$sub_cat_rows['id'].'">'.$sub_cat_rows['sub_categories'].'</a></li>
';
}
?>
</ul>
<?php } ?>
</li>
<?php
}
?>
<li><a href="contact.php">contact</a></li>
</ul>
</nav>
</div>
</div>
<div class="col-md-3 col-lg-4 col-sm-4 col-xs-4">
<div class="header__right">
<?php
$class="mr15";
if(isset($_SESSION['USER_LOGIN'])){
$class="";
}
?>
<div class="header__search search search__open <?php echo $class?>">
<a href="#" onclick="focusearch()"><i class="icon-magnifier icons"></i></a>
</div>
<div class="header__account">
<?php if(isset($_SESSION['USER_LOGIN'])){
?>
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<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">
Hi <?php echo $_SESSION['USER_NAME']?>
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="my_order.php">Order</a>
<a class="dropdown-item" href="profile.php">Profile</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="logout.php">Logout</a>
</div>
</li>
</ul>
</div>
</nav>
<?php
}else{
echo '<a href="login.php" id="onchange" class="mr15">Login/Register</a>';
}
?>
</div>
<div class="htc__shopping__cart">
<?php
if(isset($_SESSION['USER_ID'])){
?>
<a href="wishlist.php" class="mr15"><i class="icon-heart icons"></i></a>
<a href="wishlist.php"><span class="htc__wishlist"><?php echo $wishlist_count?></span></a>
<?php } ?>
<a class="cart__menu" href="#"><i class="icon-handbag icons"></i></a>
<a href="cart.php"><span class="htc__qua"><?php echo $totalProduct?></span></a>
</div>
</div>
</div>
</div>
</div>
<div class="mobile-menu-area"></div>
</div>
</div>
</header>
<div class="body__overlay"></div>
<div class="offset__wrapper">
<div class="search__area">
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="search__inner">
<form action="search.php" method="get">
<input placeholder="Search here... " type="text" id="searcht" name="str">
<button type="submit"></button>
</form>
<div class="search__close__btn">
<span class="search__close__btn_icon"><i class="zmdi zmdi-close"></i></span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Start Cart Panel -->
<div class="shopping__cart">
<div class="shopping__cart__inner">
<div class="offsetmenu__close__btn">
<a href="#"><i class="zmdi zmdi-close"></i></a>
</div>
<?php
$cart_total = 0;
if(isset($_SESSION['cart']) && count($_SESSION['cart'])!=0){
foreach($_SESSION['cart'] as $key=>$val){
$productArr=get_product($con,'','',$key);
$pname=$productArr[0]['name'];
$mrp=$productArr[0]['mrp'];
$price=$productArr[0]['price'];
$image=$productArr[0]['image'];
$qty=$val['qty'];
$cart_total=$cart_total+($price*$qty);
$pid = $productArr[0]['id'];
?>
<div class="shp__cart__wrap">
<div class="shp__single__product">
<div class="shp__pro__thumb">
<a href="<?php echo 'product.php?id='.$pid ?>">
<img src="<?php echo PRODUCT_IMAGE_SITE_PATH.$image?>" />
</a>
</div>
<div class="shp__pro__details">
<h2><a href="<?php echo 'product.php?id='.$pid ?>"><?php echo $pname?></a></h2>
<span class="quantity">QTY: <?php echo $qty?></span>
<span class="shp__price">Rs. <?php echo $price*$qty?></span>
</div>
<div class="remove__btn">
<a href="javascript:void(0)" onclick="manage_cart('<?php echo $key?>','remove')" title="Remove this item"><i class="zmdi zmdi-close"></i></a>
</div>
</div>
</div>
<?php } ?>
<ul class="shoping__total">
<li class="subtotal">Subtotal:</li>
<li class="total__price"><?php echo $cart_total?> Rs</li>
</ul>
<?php } else { ?>
<center>
<h2><i class="fa fa-shopping-basket fa-5x"></i></h2><br>
<h3 style="margin-bottom:60px">Your cart is empty at the moment!</h3>
</center>
<?php
}?>
<ul class="shopping__btn">
<li><a href="cart.php">View Cart</a></li>
<li class="shp__checkout"><a href="checkout.php">Checkout</a></li>
<li><a href="./" onclick="manage_cart(0,'empty')" title="Remove all items">Remove All</a></li>
</ul>
</div>
</div>
<!-- End Cart Panel -->
<script>
if (navigator.userAgent.match(/Mobile/)) {
try {
document.getElementById('onchange').innerHTML = '<i class="icon-user icons"></i>';
} catch (error) {
console.log("Logged in!!");
}
}
if ('serviceWorker' in navigator) {
window.addEventListener('load', () => {
navigator.serviceWorker.register('./service-worker.js')
.then(reg => {
console.log('Registration succeeded. Scope is ' + reg.scope);
})
.catch(registrationError => {
console.log('SW registration failed: ', registrationError);
});
});
}
</script>