-
Notifications
You must be signed in to change notification settings - Fork 0
/
deals_div_BW.php
60 lines (54 loc) · 2.38 KB
/
deals_div_BW.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" href="./IMAGES/logo/Copy of Black White Minimalist Aesthetic Letter Initial Name Monogram Logo (3).png" type="image/x-icon">
<title>SK Fashion Hub</title>
<link rel="stylesheet" href="./Styles/Deals_div.css">
</head>
<body>
<div id="items_deals_BW_home">
<?php
require_once './Includes/connection.php';
$database = new connection();
$conn = $database->getConnection();
$query = "SELECT * FROM clothing_items_bridal_wear WHERE discounts IS NOT NULL";
$stmt = $conn->prepare($query);
$stmt->execute();
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
if (is_numeric($row['discounts'])) {
$discounted_price = $row['price'] - ($row['price'] * ($row['discounts'] / 100));
echo "<div class='container'>";
echo "<div class='container_pr'>";
echo "<div class='product'>";
$images = explode(', ', $row['images']);
if (!empty($images)) {
echo '<img class="p_image" src="' . $images[0] . '" alt="Image">';
} else {
echo 'No Image';
}
echo "<h3 class='name'>{$row['productName']}</h3>
<p><strong>Category:</strong> {$row['category']}</p>
<p>Original Price: {$row['price']}</p>
<p>Discount: {$row['discounts']}%</p>
<p class='price'>Discounted Price: {$discounted_price}</p>
<form method='get' action='./item_details_BW.php'>
<input type='hidden' name='id' value='" . $row['id'] . "'>
<button type='submit' class='add-to-cart'>VIEW DETAILS</button>
</form>
</div>";
echo "</div>";
echo "</div>";
} else {
// Debug information for items without a valid discount
// echo "<div>";
// echo "<p>No valid discount available for {$row['productName']}</p>";
// echo "</div>";
}
}
$conn = null;
?>
</div>
</body>
</html>