This repository has been archived by the owner on Nov 7, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmyfavourites.php
116 lines (103 loc) · 5.78 KB
/
myfavourites.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
<?php
if (isset($_SESSION["users"])) {
?>
<!-- Start All Title Box -->
<div class="all-title-box">
<div class="container">
<div class="row">
<div class="col-lg-12">
<h2>Favorilerim</h2>
<ul class="breadcrumb">
<li class="breadcrumb-item"><a href="./">Anasayfa</a></li>
<li class="breadcrumb-item active">Favorilerim</li>
</ul>
</div>
</div>
</div>
</div>
<!-- End All Title Box -->
<!-- Start Wishlist -->
<div class="wishlist-box-main">
<div class="container">
<div class="row">
<div class="col-lg-12">
<div class="table-main table-responsive">
<table class="table">
<thead>
<tr>
<th>Resim</th>
<th>Ürün adı</th>
<th>Ürün Fiyatı </th>
<th>Stok Durumu</th>
<th>Link</th>
<th>Favorilerimden Kaldır</th>
</tr>
</thead>
<tbody>
<?php
$favQuery = $db->prepare("SELECT * FROM favourites WHERE userid = ? ORDER BY id DESC");
$favQuery->execute([$userid]);
$favCount = $favQuery->rowCount();
$favRecords = $favQuery->fetchAll(PDO::FETCH_ASSOC);
if ($favCount > 0) {
foreach ($favRecords as $favRecord) {
$productid = $favRecord["productid"];
$productInfoQuery = $db->prepare("SELECT * FROM products WHERE id = ? LIMIT 1");
$productInfoQuery->execute([$productid]);
$productRecord = $productInfoQuery->fetch(PDO::FETCH_ASSOC);
$image = $productRecord["productimage1"];
$name = $productRecord["productName"];
$price = $productRecord["productPrice"];
$taxRate = $productRecord["taxRate"];
$stockFav = $db->prepare("SELECT * FROM sizetableamount WHERE productid = ? LIMIT 1");
$stockFav->execute([$productid]);
$stockFavRecord = $stockFav->fetch(PDO::FETCH_ASSOC);
$stock = $stockFavRecord['XS'] + $stockFavRecord['S'] + $stockFavRecord['M'] + $stockFavRecord['L'] + $stockFavRecord['XL'] + $stockFavRecord['XXL'] + $stockFavRecord['XXXL'];
$lastPrice = $price + ($taxRate * $price * 0.01);
?>
<tr>
<td class="thumbnail-img">
<a href="index.php?P=6&id=<?php echo $productid; ?>">
<img class="img-fluid" src="<?php echo $image; ?>" alt="" />
</a>
</td>
<td class="name-pr">
<a href="index.php?P=6&id=<?php echo $productid; ?>">
<?php echo substr($name, '0', '28') . ".."; ?>
</a>
</td>
<td class="price-pr">
<p><?php echo $lastPrice; ?> TL</p>
</td>
<td class="quantity-box"><?php if ($stock > 1) {
echo "Stokta var";
} else {
echo "Stokta Yok";
} ?></td>
<td class="add-pr">
<a class="btn hvr-hover" href="index.php?P=6&id=<?php echo $productid; ?>">Ürüne Git</a>
</td>
<td class="remove-pr">
<a href="configs/forms.php?favDelete=ok&id=<?php echo $productid; ?>">
<i class="fas fa-times"></i>
</a>
</td>
</tr>
<?php
}
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<!-- End Wishlist -->
<?php
} else {
header("./");
exit();
}
?>