-
Notifications
You must be signed in to change notification settings - Fork 0
/
Deals_BW.php
77 lines (68 loc) · 3.25 KB
/
Deals_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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?php
$currentPage = 'deals';
?>
<!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.css">
</head>
<body>
<div id="navBar">
<?php include './Deals_header.php'; ?>
</div>
<button id="back-to-top-btn" onclick="scrollToTop()"><i class="fa-solid fa-arrow-up fa-bounce"></i></button>
<div class="container">
<div class="container_pr">
<?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='colum_product'>";
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 style='display: none;'><strong>Material:</strong> {$row['material']}</p>
<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.php'>
<input type='hidden' name='id' value='" . $row['id'] . "'>
<button type='submit' class='add-to-cart'>ADD TO CART</button>
</form>
</div>";
echo "</div>"; //'.colum_product'
} 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> <!--'.container_pr' -->
</div> <!--'.container'-->
<div class="banner animated tada">
<div class=" big-text animated tada">UP TO 25% OFF</div>
<div class="mid_text">the entire store</div>
</div>
<script src="./js/goTotTop.js"></script>
<?php include_once("./footer.php"); ?>
</body>
</html>