D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home3
/
encodto1
/
siliguritoys.com
/
Filename :
my_account.php
back
Copy
<?php include 'config.php'; session_start(); // Check if the user is logged in, otherwise redirect to login if (!isset($_SESSION['user_id'])) { header("Location: login.php"); exit(); } $user_id = $_SESSION['user_id']; $user_name = $_SESSION['user_name']; // Fetch user details from `slgtoys_customer` table $query = $conn->prepare("SELECT * FROM slgtoys_customer WHERE customer_id = ?"); $query->bind_param("i", $user_id); $query->execute(); $user_result = $query->get_result(); $user = $user_result->fetch_assoc(); // Fetch wishlist items with product image $wishlist_query = $conn->prepare("SELECT p.id,p.image_1, p.name, p.price FROM product_wishlist w JOIN slgtoys_products p ON w.product_id = p.id WHERE w.user_id = ?"); $wishlist_query->bind_param("i", $user_id); $wishlist_query->execute(); $wishlist_result = $wishlist_query->get_result(); // Fetch orders $order_query = $conn->prepare("SELECT * FROM orders WHERE customer_id = ? ORDER BY created_at DESC"); $order_query->bind_param("i", $user_id); $order_query->execute(); $order_result = $order_query->get_result(); ?> <!DOCTYPE html> <html lang="en" class="darkmode" data-theme="light"> <head> <?php include 'style2.php'; ?> <style> .order-table { width: 100%; border-collapse: collapse; background: #fff; box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1); border-radius: 10px; overflow: hidden; } .order-table thead { background-color: #ffcc00; color: #000; text-transform: uppercase; } .order-table th, .order-table td { padding: 15px; text-align: center; border-bottom: 1px solid #ddd; } .product-container { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; padding: 10px; } .product-card { background: #f8f8f8; padding: 10px; border-radius: 8px; text-align: center; box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.1); transition: 0.3s ease; } .product-card:hover { transform: scale(1.05); box-shadow: 3px 3px 15px rgba(0, 0, 0, 0.2); } .product-card img { width: 60px; height: 60px; border-radius: 5px; margin-bottom: 5px; } .product-card small { display: block; font-size: 12px; color: #555; } .btn-invoice { background: #28a745; color: white; border: none; padding: 8px 12px; border-radius: 20px; cursor: pointer; transition: 0.3s ease; } .btn-invoice:hover { background: #218838; } </style> </head> <body> <!--================= Preloader Section Start Here =================--> <div id="weiboo-load"> <div class="preloader-new"> <svg class="cart_preloader" role="img" aria-label="Shopping cart_preloader line animation" viewBox="0 0 128 128" width="128px" height="128px" xmlns="http://www.w3.org/2000/svg"> <g fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="8"> <g class="cart__track" stroke="hsla(0,10%,10%,0.1)"> <polyline points="4,4 21,4 26,22 124,22 112,64 35,64 39,80 106,80" /> <circle cx="43" cy="111" r="13" /> <circle cx="102" cy="111" r="13" /> </g> <g class="cart__lines" stroke="currentColor"> <polyline class="cart__top" points="4,4 21,4 26,22 124,22 112,64 35,64 39,80 106,80" stroke-dasharray="338 338" stroke-dashoffset="-338" /> <g class="cart__wheel1" transform="rotate(-90,43,111)"> <circle class="cart__wheel-stroke" cx="43" cy="111" r="13" stroke-dasharray="81.68 81.68" stroke-dashoffset="81.68" /> </g> <g class="cart__wheel2" transform="rotate(90,102,111)"> <circle class="cart__wheel-stroke" cx="102" cy="111" r="13" stroke-dasharray="81.68 81.68" stroke-dashoffset="81.68" /> </g> </g> </g> </svg> </div> </div> <!--================= Preloader End Here =================--> <div class="anywere"></div> <!--================= Header Section Start Here =================--> <?php include 'header.php'; ?> <!--================= Header Section End Here =================--> <div class="rts-account-section section-gap"> <div class="container"> <div class="account-inner"> <div class="account-side-navigation"> <button class="filter-btn active" data-show=".dashboard"><i class="fal fa-chart-bar"></i> Dashboard</button> <button class="filter-btn" data-show=".orders"><i class="fal fa-shopping-cart"></i> Orders</button> <button class="filter-btn" data-show=".address"><i class="fal fa-map-marker-alt"></i> Manage Address</button> <button class="filter-btn" data-show=".wishlist"><i class="fal fa-shopping-basket"></i> Wishlist</button> <a href="logout.php" class="filter-btn"><i class="fal fa-long-arrow-left"></i> Logout</a> </div> <div class="account-main-area"> <!-- Dashboard Section --> <div class="account-main dashboard filterd-items"> <div class="account-profile-area"> <div class="profile-dp"><img src="assets2/images/blog/img-13.jpg" alt="profile-dp"></div> <div class="d-block"> <span class="profile-name"><span>Hi,</span> <?php echo htmlspecialchars($user['customer_name']); ?></span> <span class="profile-date d-block"><?php echo date("F j, Y"); ?></span> </div> </div> <p>From your account dashboard you can view your recent orders, manage your shipping and billing addresses, and edit your password and account details.</p> <div class="activity-box"> <div class="activity-item"> <div class="icon"><i class="fas fa-box-check"></i></div> <span class="title">Active Orders</span> <span class="value"><?php echo $order_result->num_rows; ?></span> </div> <div class="activity-item"> <div class="icon"><i class="fas fa-map-marker-alt"></i></div> <span class="title">Address</span> <span class="value">Seth Srilal Market, Near Momo Gali, Siliguri</span> </div> <div class="activity-item"> <div class="icon"><i class="fas fa-heart"></i></div> <span class="title">Wishlist</span> <span class="value"><?php echo $wishlist_result->num_rows; ?></span> </div> <a href="logout.php" class="activity-item"> <div class="icon"><i class="fas fa-sign-out-alt"></i></div> <span class="title">Logout</span> </a> </div> </div> <!-- Orders Section --> <div class="account-main orders filterd-items hide"> <h2 class="mb--30">My Orders</h2> <table class="order-table"> <thead> <tr> <th scope="col">ID</th> <th scope="col">Products</th> <th scope="col">Order Date</th> <th scope="col">Price</th> <th scope="col">Invoice</th> </tr> </thead> <tbody> <?php while ($order = $order_result->fetch_assoc()) { $order_id = $order['id']; // Fetch all products for this order $product_query = $conn->prepare(" SELECT p.image_1, p.name, oi.price, oi.quantity FROM order_items oi JOIN slgtoys_products p ON oi.product_id = p.id WHERE oi.order_id = ? "); $product_query->bind_param("i", $order_id); $product_query->execute(); $product_result = $product_query->get_result(); ?> <tr> <th scope="row"><?php echo htmlspecialchars($order['id']); ?></th> <td> <div class="product-container"> <?php while ($product = $product_result->fetch_assoc()) { ?> <div class="product-card"> <img src="slgadmintoys/<?php echo htmlspecialchars($product['image_1']); ?>" alt="Product"> <small><strong><?php echo htmlspecialchars($product['name']); ?></strong></small> <small>₹ <?php echo htmlspecialchars($product['price']); ?> x <?php echo htmlspecialchars($product['quantity']); ?></small> </div> <?php } ?> </div> </td> <td><?php echo htmlspecialchars($order['created_at']); ?></td> <td><strong>₹ <?php echo htmlspecialchars($order['grand_total']); ?></strong></td> <td><button type="button" class="btn-invoice">View Invoice</button></td> </tr> <?php } ?> </tbody> </table> </div> <!-- Wishlist Section --> <div class="account-main wishlist filterd-items hide"> <h2 class="mb--30">My Wishlist</h2> <table class="table"> <thead style="background-color: yellow;"> <tr> <th scope="col">ID</th> <th scope="col">Product Name</th> <th scope="col">Image</th> <th scope="col">Price</th> <th scope="col">View Product</th> </tr> </thead> <tbody> <?php while ($wishlist = $wishlist_result->fetch_assoc()) { ?> <tr> <th scope="row">1</th> <td><?php echo htmlspecialchars($wishlist['name']); ?></td> <td><img src="slgadmintoys/<?php echo htmlspecialchars($wishlist['image_1']); ?>" width="50"></td> <td>₹ <?php echo htmlspecialchars($wishlist['price']); ?></td> <td> <a href="product-details.php?id=<?php echo htmlspecialchars($wishlist['id']); ?>" class="btn btn-success rounded-pill"> View Product </a> </td> </tr> <?php } ?> </tbody> </table> </div> <!-- Address Section --> <div class="account-main address filterd-items hide"> <div class="row justify-content-center"> <!-- Billing Address --> <div class="col-xl-8 col-md-6"> <div class="billing-address card p-4 shadow-sm rounded-lg"> <h2 class="mb-3 text-primary">Billing Address</h2> <hr> <p><strong>Name:</strong> <?php echo htmlspecialchars($user['customer_name']); ?></p> <p><strong>Email:</strong> <?php echo htmlspecialchars($user['customer_email']); ?></p> <p><strong>Phone:</strong> <?php echo htmlspecialchars($user['customer_phone']); ?></p> <p><strong>Address:</strong> <?php echo htmlspecialchars($user['customer_address']); ?></p> <p><strong>Pincode:</strong> <?php echo htmlspecialchars($user['customer_pincode']); ?></p> <a href="#" class="btn btn-primary btn-sm mt-2">Edit</a> </div> </div> </div> </div> <div class="offer-ad mt--40"><img src="assets2/images/banner/wbanner.jpg" alt="ad"></div> </div> </div> </div> </div> <!--================= Jquery latest version =================--> <script src="assets2/js/vendors/jquery-3.6.0.min.js"></script> <!--================= Bootstrap latest version =================--> <script src="assets2/js/vendors/bootstrap.min.js"></script> <!--================= Wow.js =================--> <script src="assets2/js/vendors/wow.min.js"></script> <!--================= Swiper Slider =================--> <script src="assets2/js/vendors/swiper-bundle.min.js"></script> <!--================= Nice Select =================--> <script src="assets2/js/vendors/jquery.nice-select.js"></script> <!--================= Swiper Slider =================--> <script src="assets2/js/vendors/zoom.js"></script> <!--================= metisMenu Plugin =================--> <script src="assets2/js/vendors/metisMenu.min.js"></script> <!--================= Main Menu Plugin =================--> <script src="assets2/js/vendors/rtsmenu.js"></script> <!--================= Magnefic Popup Plugin =================--> <script src="assets2/js/vendors/isotope.pkgd.min.js"></script> <!--================= Magnefic Popup Plugin =================--> <script src="assets2/js/vendors/jquery.magnific-popup.min.js"></script> <!--================= Main Script =================--> <script src="assets2/js/main.js"></script> </body> </html>