%PDF- %GIF98; %PNG;
Server : ApacheSystem : Linux sh00666.bluehost.com 5.14.0-687.26.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Jul 14 16:32:02 EDT 2026 x86_64 User : ndkhermy ( 1200) PHP Version : 8.5.12 Disable Function : NONE Directory : /home1/ndkhermy/public_html/website_6ca89795/user/ |
Upload File : |
<style>
.row.whisitlist {
align-items: center;
justify-content: center;
}
th.text-start {
padding: 10px;
background: #fafafa;
}
th.action {
padding: 10px;
background: #fafafa;
}
th.text-start {
padding: 10px;
background: #fafafa;
}
th.text-center {
padding: 10px;
background: #fafafa;
}
th.text-center {
padding: 10px;
background: #fafafa;
}
a.btn.btn--link {
margin-top: 24px;
margin-left: 10px;
background: #222222;
color: #fff;
}
a.btn.btn--link:hover {
background: linear-gradient(to right, #139793, #1edad4);
}
</style>
<?php
session_start();
include('header.php');
include('../dbcon.php');
if (!isset($_SESSION['username']) || !isset($_SESSION['id'])) {
header('Location: ../login.php');
exit();
}
$username = $_SESSION['username'];
$user_id = $_SESSION['id'];
$stmt = $conn->prepare("
SELECT wi.id, wi.product_id, p.price, p.title, p.image
FROM wishlist_items wi
JOIN areawecover p ON wi.product_id = p.id
WHERE wi.user_id = ?
ORDER BY wi.id DESC
");
$stmt->bind_param("i", $user_id);
$stmt->execute();
$result = $stmt->get_result();
$wishlist_items = [];
$subtotal = 0;
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
$row['price'] = (float)$row['price'];
$row['total'] = $row['price'];
$wishlist_items[] = $row;
$subtotal += $row['total'];
}
}
$stmt->close();
$conn->close();
?>
<div id="page-content">
<div class="collection-header">
<div class="collection-hero">
<div class="collection-hero__image"></div>
<div class="collection-hero__title-wrapper container">
<h1 class="collection-hero__title">Your Wishlist</h1>
<div class="breadcrumbs text-uppercase mt-1 mt-lg-2">
<a href="index.php" title="Back to the home page">Home</a><span>|</span><span class="fw-bold">Your Wishlist</span>
</div>
</div>
</div>
</div>
<div class="container">
<div class="row whisitlist">
<div class="col-12 col-lg-8 main-col">
<?php if (empty($wishlist_items)) { ?>
<div class="alert alert-info">
Your wishlist is empty. <a href="../products.php">Browse products</a> to add items to your wishlist.
</div>
<?php } else { ?>
<form action="user-add-to-cart.php" method="post" class="wishlist style2">
<table class="align-middle">
<thead>
<tr>
<th class="action"> </th>
<th colspan="2" class="text-start">Product</th>
<th class="text-center">Price</th>
<th class="text-center">Add to Cart</th>
</tr>
</thead>
<tbody>
<?php foreach ($wishlist_items as $item) { ?>
<tr>
<td class="text-center">
<a href="user-remove-from-wishlist.php?id=<?php echo $item['id']; ?>" class="btn btn--secondary">
<i class="icon an an-times-r"></i>
</a>
</td>
<td>
<a href="../product.php?id=<?php echo $item['product_id']; ?>"><img src="../admin/dataimg/<?php echo htmlspecialchars($item['image']); ?>" alt="<?php echo htmlspecialchars($item['title']); ?>" width="80"></a>
</td>
<td>
<a href="../product.php?id=<?php echo $item['product_id']; ?>"><?php echo htmlspecialchars($item['title']); ?></a>
</td>
<td class="text-center">
$<?php echo number_format($item['price'], 2); ?>
</td>
<td class="text-center">
<!-- <a href="user-add-to-cart.php?id=<?php echo $item['product_id']; ?>" >
Add to Cart
</a> -->
<div class="text-center">
<form action="user-add-to-cart.php" method="POST">
<input type="hidden" name="product_id" value="<?php echo $item['product_id']; ?>">
<input type="hidden" name="user_id" value="<?php
session_start();
if (isset($_SESSION['id'])) {
echo $_SESSION['id'];
} else {
echo 0;
}
?>">
<input type="hidden" name="quantity" value="1">
<button type="submit" name="add_to_cart" class="btn btn--small">
Add To Cart
</button>
</form>
</td>
</tr>
<?php } ?>
</tbody>
<tfoot>
<tr>
<td colspan="3">
<a href="../products.php" class="btn btn--link">Continue Shopping</a>
</td>
<!-- <td colspan="2" class="text-end">
<div><strong>Total:</strong> $<?php echo number_format($subtotal, 2); ?></div>
<a href="../checkout.php" class="btn btn--small">Proceed to Checkout</a>
</td> -->
</tr>
</tfoot>
</table>
</form>
</div>
<?php } ?>
</div>
</div>
</div>
</div>
<!-- Core JS -->
<script src="../assets/vendor/libs/jquery/jquery.js"></script>
<script src="../assets/vendor/libs/popper/popper.js"></script>
<script src="../assets/vendor/js/bootstrap.js"></script>
<script src="../assets/vendor/libs/perfect-scrollbar/perfect-scrollbar.js"></script>
<script src="../assets/vendor/js/menu.js"></script>
<script src="../assets/js/main.js"></script>
</body>
</html>