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
/
recentlyViewed.php
executable file
·66 lines (58 loc) · 3.28 KB
/
recentlyViewed.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
<?php
$result = mysqli_query($connect, "SELECT DISTINCT(product_id) FROM search WHERE customer_id = '$customer_id' ORDER BY product_id DESC LIMIT 0,12");
if($result === FALSE){
mysqli_close($connect);
}
else {
?>
<section class="carousel-banner carousel-info">
<div class="container">
<div class="row">
<div class="col-lg-12">
<h3 style="text-align: center; color: #5d6d7e; font-weight: bold; padding:20px;">Recently Viewed</h3>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div class="product-slider owl-carousel">
<?php while ($row_product = mysqli_fetch_assoc($result)):
$product_id = $row_product['product_id'];
$find_product_data = "SELECT * FROM product WHERE id = '$product_id' ";
$found_product_data =$connect->query($find_product_data);
$product_id_array = $found_product_data ->fetch_assoc();
?>
<div class="product-item">
<div class="pi-pic">
<a href="product.php?id=<?php echo $product_id_array ['id']; ?>">
<img src="uploads/<?php echo $product_id_array ['file'] ?>" alt="Image" style="width: 250px; height:250px; border-radius: 3%;" class="img-responsive">
</a>
<div class="icon">
<?php
$sql_fav = "SELECT * FROM wishlist WHERE customer_id ='$customer_id' AND product_id = '$product_id'";
$run_fav = mysqli_query($connect, $sql_fav);
$row_fav = mysqli_fetch_assoc($run_fav);
if ($row_fav['fav_id'] == null) { ?>
<a href="updateWishlist.php?user=<?php echo $customer_id ?>&action=add&id=<?php echo $product_id ?>" ><i class="far fa-heart" style="color:red"></i></a>
<?php } else { ?>
<a href="updateWishlist.php?user=<?php echo $customer_id ?>&action=remove&id=<?php echo $product_id ?>" ><i class="fas fa-heart" style="color:red"></i></a>
<?php } ?>
</div>
</div>
<div class="pi-text">
<a href="product.php?id=<?php echo $product_id_array ['id']; ?>">
<h4><span class="badge badge-light"><?php echo $product_id_array['name']; ?>
</span></h4>
</a>
<div class="product-price">
₹ <?php echo $product_id_array ['cost']; ?>
<span class="MRP" >₹ <?php echo $product_id_array ['MRP']; ?></span>
</div>
</div>
</div>
<?php endwhile; ?>
</div>
</div>
</div>
</div>
</section>
<?php } ?>