-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproduct - Copy.php
346 lines (316 loc) · 14.4 KB
/
product - Copy.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
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
<?php
ob_start();
require('top.php');
if(isset($_GET['id'])){
$product_id=mysqli_real_escape_string($con,$_GET['id']);
if($product_id>0){
$get_product=get_product($con,'','',$product_id);
}else{
?>
<script>
window.location.href='index.php';
</script>
<?php
}
$resMultipleImages=mysqli_query($con,"select product_images from product_images where product_id='$product_id'");
$multipleImages=[];
if(mysqli_num_rows($resMultipleImages)>0){
while($rowMultipleImages=mysqli_fetch_assoc($resMultipleImages)){
$multipleImages[]=$rowMultipleImages['product_images'];
}
}
}else{
?>
<script>
window.location.href='index.php';
</script>
<?php
}
if(isset($_POST['review_submit'])){
$rating=get_safe_value($con,$_POST['rating']);
$review=get_safe_value($con,$_POST['review']);
$added_on=date('Y-m-d h:i:s');
mysqli_query($con,"insert into product_review(product_id,user_id,rating,review,status,added_on) values('$product_id','".$_SESSION['USER_ID']."','$rating','$review','1','$added_on')");
// header('location:product.php?id='.$product_id);
echo "<script>window.location.href='product.php';</script>";
die();
}
$product_review_res=mysqli_query($con,"select users.name,product_review.id,product_review.rating,product_review.review,product_review.added_on from users,product_review where product_review.status=1 and product_review.user_id=users.id and product_review.product_id='$product_id' order by product_review.added_on desc");
?>
<!-- Start Bradcaump area -->
<div class="ht__bradcaump__area" style="background: rgba(0, 0, 0, 0) url(images/bg/4.jpg) no-repeat scroll center center / cover ;">
<div class="ht__bradcaump__wrap">
<div class="container">
<div class="row">
<div class="col-xs-12">
<div class="bradcaump__inner">
<nav class="bradcaump-inner">
<a class="breadcrumb-item" href="index.php">Home</a>
<span class="brd-separetor"><i class="zmdi zmdi-chevron-right"></i></span>
<a class="breadcrumb-item" href="categories.php?id=<?php echo $get_product['0']['categories_id']?>"><?php echo $get_product['0']['categories']?></a>
<span class="brd-separetor"><i class="zmdi zmdi-chevron-right"></i></span>
<span class="breadcrumb-item active"><?php echo $get_product['0']['name']?></span>
</nav>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- End Bradcaump area -->
<!-- Start Product Details Area -->
<section class="htc__product__details bg__white ptb--100">
<!-- Start Product Details Top -->
<div class="htc__product__details__top">
<div class="container">
<div class="row">
<div class="col-md-5 col-lg-5 col-sm-12 col-xs-12">
<div class="htc__product__details__tab__content">
<!-- Start Product Big Images -->
<div class="product__big__images">
<div class="portfolio-full-image tab-content">
<div role="tabpanel" class="tab-pane fade in active imageZoom" id="img-tab-1">
<img width="" data-origin="<?php echo PRODUCT_IMAGE_SITE_PATH.$get_product['0']['image']?>" src="<?php echo PRODUCT_IMAGE_SITE_PATH.$get_product['0']['image']?>">
</div>
<?php if(isset($multipleImages[0])){?>
<div id="multiple_images">
<?php
foreach($multipleImages as $list){
echo "<img src='".PRODUCT_MULTIPLE_IMAGE_SITE_PATH.$list."' onclick=showMultipleImage('".PRODUCT_MULTIPLE_IMAGE_SITE_PATH.$list."')>";
}
?>
</div>
<?php } ?>
</div>
</div>
<!-- End Product Big Images -->
</div>
</div>
<div class="col-md-7 col-lg-7 col-sm-12 col-xs-12 smt-40 xmt-40">
<div class="ht__product__dtl">
<h2><?php echo $get_product['0']['name']?></h2>
<ul class="pro__prize">
<li class="old__prize"><?php echo $get_product['0']['mrp']?></li>
<li><?php echo $get_product['0']['price']?></li>
</ul>
<p class="pro__info"><?php echo $get_product['0']['short_desc']?></p>
<div class="ht__pro__desc">
<div class="sin__desc">
<?php
$productSoldQtyByProductId=productSoldQtyByProductId($con,$get_product['0']['id']);
$pending_qty=$get_product['0']['qty']-$productSoldQtyByProductId;
$cart_show='yes';
if($get_product['0']['qty']>$productSoldQtyByProductId){
$stock='In Stock';
}else{
$stock='Not in Stock';
$cart_show='';
}
?>
<p><span>Availability:</span> <?php echo $stock?></p>
</div>
<div class="sin__desc">
<?php
if($cart_show!=''){
?>
<p><span>Qty:</span>
<select id="qty">
<?php
for($i=1;$i<=$pending_qty;$i++){
echo "<option>$i</option>";
}
?>
</select>
</p>
<?php } ?>
</div>
<div class="sin__desc align--left">
<p><span>Categories:</span></p>
<ul class="pro__cat__list">
<li><a href="#"><?php echo $get_product['0']['categories']?></a></li>
</ul>
</div>
</div>
</div>
<?php
if($cart_show!=''){
?>
<a class="fr__btn" href="javascript:void(0)" onclick="manage_cart('<?php echo $get_product['0']['id']?>','add')">Add to cart</a>
<a class="fr__btn buy_now" href="javascript:void(0)" onclick="manage_cart('<?php echo $get_product['0']['id']?>','add','yes')">Buy Now</a>
<?php } ?>
<div id="social_share_box">
<a href="https://facebook.com/share.php?u=<?php echo $meta_url?>"><img src='images/icons/facebook.png'/></a>
<a href="https://twitter.com/share?text=<?php echo $get_product['0']['name']?>&url=<?php echo $meta_url?>"><img src='images/icons/twitter.png'/></a>
<a href="https://api.whatsapp.com/send?text=<?php echo $get_product['0']['name']?> <?php echo $meta_url?>"><img src='images/icons/whatsapp.png'/></a>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- End Product Details Top -->
</section>
<!-- End Product Details Area
<!-- Start Product Description -->
<section class="htc__produc__decription bg__white">
<div class="container">
<div class="row">
<div class="col-xs-12">
<!-- Start List And Grid View -->
<ul class="pro__details__tab" role="tablist">
<li role="presentation" class="description active"><a href="#description" role="tab" data-toggle="tab">description</a></li>
<li role="presentation" class="review"><a href="#review" role="tab" data-toggle="tab" class="active show" aria-selected="true">review</a></li>
</ul>
<!-- End List And Grid View -->
</div>
</div>
<div class="row">
<div class="col-xs-12">
<div class="ht__pro__details__content">
<!-- Start Single Content -->
<div role="tabpanel" id="description" class="pro__single__content tab-pane fade in active">
<div class="pro__tab__content__inner">
<?php echo $get_product['0']['description']?>
</div>
</div>
<!-- End Single Content -->
<div role="tabpanel" id="review" class="pro__single__content tab-pane fade active show">
<div class="pro__tab__content__inner">
<?php
if(mysqli_num_rows($product_review_res)>0){
while($product_review_row=mysqli_fetch_assoc($product_review_res)){
?>
<article class="row">
<div class="col-md-12 col-sm-12">
<div class="panel panel-default arrow left">
<div class="panel-body">
<header class="text-left">
<div><span class="comment-rating"> <?php echo $product_review_row['rating']?></span> (<?php echo $product_review_row['name']?>)</div>
<time class="comment-date">
<?php
$added_on=strtotime($product_review_row['added_on']);
echo date('d M Y',$added_on);
?>
</time>
</header>
<div class="comment-post">
<p>
<?php echo $product_review_row['review']?>
</p>
</div>
</div>
</div>
</div>
</article>
<?php } }else {
echo "<h3 class='submit_review_hint'>No review added</h3><br/>";
}
?>
<h3 class="review_heading">Enter your review</h3><br/>
<?php
if(isset($_SESSION['USER_LOGIN'])){
?>
<div class="row" id="post-review-box" style=>
<div class="col-md-12">
<form action="" method="post">
<select class="form-control" name="rating" required>
<option value="">Select Rating</option>
<option>Worst</option>
<option>Bad</option>
<option>Good</option>
<option>Very Good</option>
<option>Fantastic</option>
</select> <br/>
<textarea class="form-control" cols="50" id="new-review" name="review" placeholder="Enter your review here..." rows="5"></textarea>
<div class="text-right mt10">
<button class="btn btn-success btn-lg" type="submit" name="review_submit">Submit</button>
</div>
</form>
</div>
</div>
<?php } else {
echo "<span class='submit_review_hint'>Please <a href='login.php'>login</a> to submit your review</span>";
}
?>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- End Product Description -->
<?php
//unset($_COOKIE['recently_viewed']);
if(isset($_COOKIE['recently_viewed'])){
$arrRecentView=unserialize($_COOKIE['recently_viewed']);
$countRecentView=count($arrRecentView);
$countStartRecentView=$countRecentView-4;
if($countStartRecentView>4){
$arrRecentView=array_slice($arrRecentView,$countStartRecentView,4);
}
$recentViewId=implode(",",$arrRecentView);
$res=mysqli_query($con,"select * from product where id IN ($recentViewId) and status=1");
?>
<section class="htc__produc__decription bg__white">
<div class="container">
<div class="row">
<div class="col-xs-12">
<h3 style="font-size: 20px;font-weight: bold;">Recently Viewed</h3>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<div class="ht__pro__details__content">
<div class="row">
<?php while($list=mysqli_fetch_assoc($res)){?>
<div class="col-xs-3">
<div class="category">
<div class="ht__cat__thumb">
<a href="product.php?id=<?php echo $list['id']?>">
<img src="<?php echo PRODUCT_IMAGE_SITE_PATH.$list['image']?>" alt="product images">
</a>
</div>
<div class="fr__hover__info">
<ul class="product__action">
<li><a href="javascript:void(0)" onclick="wishlist_manage('<?php echo $list['id']?>','add')"><i class="icon-heart icons"></i></a></li>
<li><a href="javascript:void(0)" onclick="manage_cart('<?php echo $list['id']?>','add')"><i class="icon-handbag icons"></i></a></li>
</ul>
</div>
<div class="fr__product__inner">
<h4><a href="product-details.html"><?php echo $list['name']?></a></h4>
<ul class="fr__pro__prize">
<li class="old__prize"><?php echo $list['mrp']?></li>
<li><?php echo $list['price']?></li>
</ul>
</div>
</div>
</div>
<?php } ?>
</div>
</div>
</div>
</div>
</div>
</section>
<?php
$arrRec=unserialize($_COOKIE['recently_viewed']);
if(($key=array_search($product_id,$arrRec))!==false){
unset($arrRec[$key]);
}
$arrRec[]=$product_id;
}else{
$arrRec[]=$product_id;
}
setcookie('recently_viewed',serialize($arrRec),time()+60*60*24*365);
?>
<script>
function showMultipleImage(im){
jQuery('#img-tab-1').html("<img src='"+im+"' data-origin='"+im+"'/>");
jQuery('.imageZoom').imgZoom();
}
</script>
<?php
require('footer.php');
ob_flush();
?>