-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshop-single.php
315 lines (281 loc) · 10.3 KB
/
shop-single.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
<?php
session_start();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Little Kings — E-Commerce</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Mukta:300,400,700">
<link rel="stylesheet" href="fonts/icomoon/style.css">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/magnific-popup.css">
<link rel="stylesheet" href="css/jquery-ui.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/aos.css">
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/Form.css">
<script src="js/jquery-3.3.1.min.js"></script>
<script src="js/dangnhap_dangky.js"></script>
<script>
$(document).ready(function(){
var soluong=1;
function addCart(id,soluong){
$.ajax({
url:"addCart.php",
type:"post",
data:{id:id,soluong:soluong},
success:function(data){
//alert(data);
$("#countCart").html(data);
}
});
}
function getID(x){
var query=window.location.search.substring(1);
var vars=query.split("&");
for(var i=0;i<vars.length;i++){
var pair=vars[i].split("=");
if(pair[0]==x) return pair[1];
}
return false;
};
var id=getID('id');
function details(id){
$.ajax({
type:"get",
url:"shopsingle.php",
data:{productid:id},
success:function(data){
$("#details").html(data);
}
});
};
details(id);
$(document).on("click","#minus",function(){
//lert($('#sl').attr('max'))
if($("#sl").val()>1 ){
$("#sl").val($("#sl").val()-1);
}
});
$(document).on("click","#plus",function(){
var plus=parseInt($("#sl").val());
if(plus<$('#sl').attr('max'))
$("#sl").val(plus+1);
});
$(document).on('click','img[name="image"]',function(){
"use strict";
$('img[name="image"]').each(function(){
$('img[name="image"]').attr("style","opacity:0.7");
});
$(this).attr("style","opacity:1");
$('#imageshow').attr('src',$(this).attr('src'));
});
$(document).on("click","#addCart",function(){
// size=$("input[name='shop-sizes']:checked").val();
// if(!size){
// alert("Please choose the size. ");
// return false;
// };
//alert(size);
soluong=$("#sl").val();
var ts=/[0-9]+$/;
if(!ts.test(soluong.toString())){
alert("Amount Invalid.");
return false;
}
addCart($(this).attr('title'),soluong);
$('html body').append('<div id="nofi" style="background-color:rgba(85,85,85,0.93);width: 350px;height: 150px;position: fixed;top: 200px;left: 600px;"><img src="images/success.jpg" alt="" width="50px" height="50px" style="border-radius: 50%; opacity: 1;margin-left: 150px;margin-top: 20px"><h2><p style="color:white;margin-left: 40px;margin-top: 20px">Add to cart success.</p></h2></div>');
var rm_nofi=function(){
$("#nofi").remove();
}
setTimeout(rm_nofi,2000);
});
});
</script>
</head>
<body>
<?php
include 'userinfor-form.php';
include 'signin-form.php';
include 'signup-form.php';
?>
<div class="site-wrap">
<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-left">
<!-- <form action="" class="site-block-top-search">
<span class="icon icon-search2"></span>
<input type="text" class="form-control border-0" placeholder="Search">
</form> -->
</div>
<div class="col-12 mb-3 mb-md-0 col-md-4 order-1 order-md-2 text-center">
<div class="site-logo">
<a href="index.php" class="js-logo-clone">Little Kings</a>
</div>
</div>
<div class="col-6 col-md-4 order-3 order-md-3 text-right">
<div class="site-top-icons">
<ul>
<li><?php
if(isset($_SESSION['isLogin'])){
if($_SESSION['isLogin']==1){
echo '<a id="logout"><span class="icon icon-sign-out" style="cursor: pointer;"></span></a>';
}
}
else{
echo '<a id="btsignin"><span class="icon icon-person" style="cursor: pointer;" ></span></a>';
}
?></li>
<li><a href="#"><?php
if(isset($_SESSION['isLogin'])){
if($_SESSION['isLogin']==1){
echo '<a href="#" id="name"> Hello, '.$_SESSION['nameLogin'].'</a>';
}
}
else{
echo"<a href='#'> Hello </a>";
}
?></a></li>
<li>
<a href="cart.php" class="site-cart">
<span class="icon icon-shopping_cart"></span>
<span class="count" id="countCart">
<?php
$count=0;
if(isset($_SESSION['cart'])){
foreach($_SESSION['cart'] as $k=>$v){
$count+=$v;
}
}
echo($count);
?></span>
</a>
</li>
<li class="d-inline-block d-md-none ml-md-0"><a href="#" class="site-menu-toggle js-menu-toggle"><span class="icon-menu"></span></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 >
<a href="index.php">Home</a>
</li>
<li >
<a href="about.php">About</a>
</li>
<li class="active"><a href="shop.php">Shop</a></li>
<li><a href="contact.php">Contact</a></li>
</ul>
</div>
</nav>
</header>
<div class="bg-light py-3">
<div class="container">
<div class="row">
<div class="col-md-12 mb-0"><a href="index.php">Home</a> <span class="mx-2 mb-0">/</span> <strong class="text-black">Shop</strong></div>
</div>
</div>
</div>
<div class="site-section">
<div class="container">
<div class="row" id="details">
<!-- ajax cho nay-->
</div>
</div>
</div>
<div class="site-section block-3 site-blocks-2 bg-light">
<div class="container">
<div class="row justify-content-center">
<div class="col-md-7 site-section-heading text-center pt-4">
<h2>Featured Products</h2>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="nonloop-block-3 owl-carousel">
<!-- Cac sp lien quan -->
<?php
require_once "class/shop-single.class.php";
$pl = new ShopSingle($_GET['id']);
echo $pl->productslist();
$pl->close();
?>
</div>
</div>
</div>
</div>
</div>
<footer class="site-footer border-top">
<div class="container">
<div class="row">
<div class="col-lg-6 mb-5 mb-lg-0">
<div class="row">
<div class="col-md-12">
<h3 class="footer-heading mb-4">Leather collection</h3>
</div>
<div class="col-md-6 col-lg-4">
<ul class="list-unstyled">
<li><a href="shop.php">Leather wallet</a></li>
</ul>
</div>
<div class="col-md-6 col-lg-4">
<ul class="list-unstyled">
<li><a href="shop.php">Leather belts</a></li>
</ul>
</div>
<div class="col-md-6 col-lg-4">
<ul class="list-unstyled">
<li><a href="shop.php">Leather bag</a></li>
</ul>
</div>
</div>
</div>
<div class="col-md-6 col-lg-3 mb-4 mb-lg-0">
<h3 class="footer-heading mb-4">Receive notification</h3>
<form action="receive-email.php" method="post">
<input type="email" name="r_email" placeholder="Enter your email" class="form-control">
<input type="submit" name="sub" value="Subscribe" class="btn">
</form>
</div>
<div class="col-md-6 col-lg-3">
<div class="block-5 mb-5">
<h3 class="footer-heading mb-4">Contact Info</h3>
<ul class="list-unstyled">
<li class="address">273 An Duong Vuong street, District 5, Ho Chi Minh city</li>
<li class="phone"><a href="#">039 548 2136</a></li>
<li class="email">[email protected]</li>
</ul>
</div>
</div>
</div>
<div class="row pt-5 mt-5 text-center">
<div class="col-md-12">
<p>
<!-- Link back to Colorlib can't be removed. Template is licensed under CC BY 3.0. -->
Copyright ©<script data-cfasync="false" src="/cdn-cgi/scripts/5c5dd728/cloudflare-static/email-decode.min.js"></script><script>document.write(new Date().getFullYear());</script> All rights reserved | Made with <i class="icon-heart" aria-hidden="true"></i> by <a href="#" target="_blank" class="text-primary">Team</a>
<!-- Link back to Colorlib can't be removed. Template is licensed under CC BY 3.0. -->
</p>
</div>
</div>
</div>
</footer>
</div>
<script src="js/jquery-3.3.1.min.js"></script>
<script src="js/jquery-ui.js"></script>
<script src="js/popper.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/owl.carousel.min.js"></script>
<script src="js/jquery.magnific-popup.min.js"></script>
<script src="js/aos.js"></script>
<script src="js/main.js"></script>
</body>
</html>