One Hat Cyber Team
Your IP :
216.73.216.186
Server IP :
88.222.243.99
Server :
Linux in-mum-web1837.main-hosting.eu 5.14.0-503.34.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Mar 27 06:00:50 EDT 2025 x86_64
Server Software :
LiteSpeed
PHP Version :
8.2.28
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
home
/
u322583024
/
domains
/
awaha.in
/
public_html
/
Edit File:
index.php
<?php session_name('vaishnavi_awaha'); session_start(); ?> <!DOCTYPE html> <html lang="zxx"> <head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta name="description" content="Awaha Soaps offers soothing Rose, brightening Lemon, pure Sandalwood, rejuvenating Jasmine, and stress-relieving Avocado for natural skin care."> <meta name="keywords" content="natural soap, organic soap, handmade skincare, rose soap, lemon soap, sandalwood soap, jasmine soap, avocado soap, soothing skincare, brightening face wash, anti-inflammatory soap, stress relief soap, rejuvenating soap, chemical-free soap, herbal bath bar, skin-friendly soap, paraben-free soap, plant-based skincare, luxury soap bar, vegan soap"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <!--====== Title ======--> <title>Awaha Soaps – Rose, Lemon, Sandalwood, Jasmine & Avocado</title> <meta name="google-site-verification" content="QNcuBCAaTIagtFEiUFdb25xjrm_HrzDB3XN2vvTNNzg" /> <!--====== Favicon Icon ======--> <link rel="shortcut icon" href="assets/images/logo/awaha.png" type="image/png"> <!--====== Google Fonts ======--> <link href="https://fonts.googleapis.com/css2?family=Aoboshi+One&family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&display=swap" rel="stylesheet"> <!--====== Flaticon css ======--> <link rel="stylesheet" href="assets/fonts/flaticon/flaticon_pesco.css"> <!--====== FontAwesome css ======--> <link rel="stylesheet" href="assets/fonts/fontawesome/css/all.min.css"> <!--====== Bootstrap css ======--> <link rel="stylesheet" href="assets/vendor/bootstrap/css/bootstrap.min.css"> <!--====== Slick-popup css ======--> <link rel="stylesheet" href="assets/vendor/slick/slick.css"> <!--====== Nice Select css ======--> <link rel="stylesheet" href="assets/vendor/nice-select/css/nice-select.css"> <!--====== Magnific-popup css ======--> <link rel="stylesheet" href="assets/vendor/magnific-popup/dist/magnific-popup.css"> <!--====== Jquery UI css ======--> <link rel="stylesheet" href="assets/vendor/jquery-ui/jquery-ui.min.css"> <!--====== Animate css ======--> <link rel="stylesheet" href="assets/vendor/aos/aos.css"> <!--====== Default css ======--> <link rel="stylesheet" href="assets/css/default.css"> <!--====== Style css ======--> <link rel="stylesheet" href="assets/css/style.css"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/sweetalert2@11.6.0/dist/sweetalert2.min.css"> <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> <style> .marquee-container { width: 100%; overflow: hidden; white-space: nowrap; background: #13172b; /* Highlight background */ color: #ffffff; /* Text color */ padding: 2px 0; font-size: 18px; font-weight: bold; text-align: center; position: relative; } .marquee-container p { display: inline-block; animation: marquee 10s linear infinite; } .hero-shape{ background-image: url(assets/images/hero/hero-two-shape1.png) !important; } @keyframes marquee { from { transform: translateX(100%); } to { transform: translateX(-100%); } } .out-of-stock{ color:red !important; } @media(max-width: 400px){ .list li { font-size: 14px !important; } } @media(max-width: 1000px){ .hero-content.style-two span.tag-line b{ padding: 0 5px; } .text-left{ text-align: left !important; } .mbh1 { color: #423e3e !important; } .mtop{ margin-top: 50% !important; } .hero-content.style-two .mbwhite { color: #020202 !important; } .hero-content.style-two h1 .mbspan { color: #ff789b !important; } .hero-wrapper-two .hero-image > img { filter: brightness(1) !important; height: 250px !important; } .hero-wrapper-two .hero-image{ width: 100% !important; } .hero-content.style-two .mbwhite{ color: black !important; } .hero-content.style-two p { margin: 0 auto 30px !important; } .bmb { color: #b97184 !important; } .soapimg{ margin: 0% 3% !important; } } .section-image-box.style-one .experience-box{ right: 95px !important; top: 80% !important; } .videoheight{ height: 500px !important; width: 700px !important;; } @media(min-width: 1700px){ .videoheight{ height: 600px !important; width: 720px !important;; } } @media(min-width: 1100px) and (max-width: 1399px){ .videoheight{ height: 550px !important; width: 600px !important;; } } /* Default heart color */ .wishlist-icon i { color: #000; /* Default color */ transition: color 0.3s ease; } /* Active heart color (red) */ .wishlist-added i { color: #d7b1bb !important; /* Red color when added to wishlist */ } .icon-btn wishlist-icon :hover-content{ background: white; } .product-item.style-three .product-thumbnail .hover-content a, { background: white; } @media (max-width: 1396px) { .about-us-section .container { max-width: 1300px; /* Adjusted width */ margin: auto; } .section-image-box { display: flex; justify-content: center; } .image-one video { max-width: 100%; height: auto; object-fit: cover; } .section-content-box { padding: 20px; } .section-title h2 { font-size: 28px; /* Adjust title size */ } .list li { font-size: 16px; /* Adjust text size */ } } @media (max-width: 797px) { .row { flex-direction: column; text-align: center; } .col-xl-6 { width: 100%; } .image-one video { height: auto; max-width: 100%; } } @media(min-width: 1396px) and (max-width: 1400px){ .vawahasize{height: 485px !important} } .vawahasize{height: 550px} </style> </head> <body> <!--====== Preloader ======--> <!--<div class="preloader">--> <!-- <div class="loader">--> <!-- <img src="assets/images/loader.gif" alt="Loader">--> <!-- </div>--> <!--</div>--> <!--====== Start Overlay ======--> <div class="offcanvas__overlay"></div> <!--====== Start Sidemenu-wrapper-cart Area ======--> <div class="sidemenu-wrapper-cart"> <div class="sidemenu-content"> <div class="widget widget-shopping-cart"> <h4>My cart</h4> <div class="sidemenu-cart-close"><i class="far fa-times"></i></div> <div class="widget-shopping-cart-content"> <ul class="pesco-mini-cart-list" id="cart-items-list"> <!-- Cart items will be dynamically loaded here --> </ul> <div class="cart-mini-total"> <div class="cart-total"> <span><strong>Subtotal:</strong></span> <span class="amount" id="cart-subtotal">0.00</span> </div> </div> <div class="cart-button-box"> <a href="checkout.php" class="theme-btn style-one">Proceed to checkout</a> </div> </div> </div> </div> </div> <div class="marquee-container"> <p>Free shipping on orders above ₹500!</p> </div> <!--====== End Sidemenu-wrapper-cart Area ======--> <!--====== Start Header Section ======--> <?php include 'header.php' ?> <!--====== End Header Section ======--> <!--====== Main Bg ======--> <main class="main-bg"> <!--====== Start Hero Section ======--> <section class="hero-section"> <!--=== Hero Wrapper ===--> <div class="hero-wrapper-two"> <!--=== Hero shape ===--> <div class="hero-shape bg_cover d-none d-xl-block"></div> <!--=== Hero Image ===--> <div class="hero-image d-block d-xl-block"> <img src="assets/images/banner/banner.gif" loading="lazy" alt="Hero Image"> <div class="hero-img-shape d-none d-md-block"><img src="assets/images/hero/hero-two-img-shape1.png" alt="Image Shape"></div> </div> <div class="container"> <div class="row"> <div class="col-xl-6"> <!--=== hero Post Slider ===--> <div class="hero-post-slider mb-50"> <!--=== Single Post Slider ===--> <div class="single-hero-post"> <div class="hero-content style-two mtop"> <span class="tag-line"><i class="flaticon-star-2"></i><b class="bmb">Nature’s Essence in Every Bar</b><i class="flaticon-star-2"></i></span> <h1 class="mbh1"><span class="mbspan">Welcome to Awaha</span> Premium Soaps for All Skin Types</h1> <p class="mbwhite">Welcome to the world of Awaha, where nature's essence meets you in every bar of our soaps. As a vibrant name in skincare, Awaha offers five unique variants, each designed to elevate your daily routine with the finest ingredients and captivating fragrances.</p> <a href="shop.php" class="theme-btn style-one">Explore Now</a> </div> </div> <!--=== Single Post Slider ===--> <div class="single-hero-post"> <div class="hero-content style-two mtop"> <span class="tag-line"><i class="flaticon-star-2"></i><b class="bmb">Crafted with Care</b><i class="flaticon-star-2"></i></span> <h1 class="mbh1"><span class="mbspan">Awaha Soaps</span> For a Gentle Touch</h1> <p class="mbwhite">From the delicate fragrance of Rose Essence to the invigorating zest of Fresh Lemon, Awaha soaps bring luxury and care to your skin. Explore variants like Sandalwood for purity, Jasmine for timeless beauty, and Avocado for nourishing indulgence.</p> <a href="shop.php" class="theme-btn style-one">Shop Now</a> </div> </div> <!--=== Single Post Slider ===--> <div class="single-hero-post"> <div class="hero-content style-two mtop"> <span class="tag-line"><i class="flaticon-star-2"></i><b class="bmb">Made in India</b><i class="flaticon-star-2"></i></span> <h1 class="mbh1"><span class="mbspan">Awaha Soaps</span> Inspired by Nature</h1> <p class="mbwhite">Dedicated to the Make in India initiative, Awaha combines global research with natural ingredients. Experience purity in our Sandalwood, freshness with Lime, and the luxurious touch of Jasmine – all crafted for inclusivity and care.</p> <a href="shop.php" class="theme-btn style-one">Discover More</a> </div> </div> </div> <!--=== Hero Dots ===--> <div class="hero-dots text-center text-xl-start"></div> </div> </div> </div> </div> </section> <!--====== End Hero Section ======--> <!--====== End Hero Section ======--> <!--====== Start Animated-headline Section ======--> <section class="animated-headline-area primary-dark-bg pt-25 pb-25"> <div class="headline-wrap style-one"> <span class="marquee-wrap"> <span class="marquee-inner left"> <span class="marquee-item"><b>Rose</b><i class="fas fa-bahai"></i></span> <span class="marquee-item"><b>Sandalwood</b><i class="fas fa-bahai"></i></span> <span class="marquee-item"><b>Jasmine</b><i class="fas fa-bahai"></i></span> <span class="marquee-item"><b>Lemon</b><i class="fas fa-bahai"></i></span> <span class="marquee-item"><b>Avocado</b><i class="fas fa-bahai"></i></span> </span> <span class="marquee-inner left"> <span class="marquee-item"><b>Rose</b><i class="fas fa-bahai"></i></span> <span class="marquee-item"><b>Sandalwood</b><i class="fas fa-bahai"></i></span> <span class="marquee-item"><b>Jasmine</b><i class="fas fa-bahai"></i></span> <span class="marquee-item"><b>Lemon</b><i class="fas fa-bahai"></i></span> <span class="marquee-item"><b>Avocado</b><i class="fas fa-bahai"></i></span> </span> <span class="marquee-inner left"> <span class="marquee-item"><b>Rose</b><i class="fas fa-bahai"></i></span> <span class="marquee-item"><b>Sandalwood</b><i class="fas fa-bahai"></i></span> <span class="marquee-item"><b>Jasmine</b><i class="fas fa-bahai"></i></span> <span class="marquee-item"><b>Lemon</b><i class="fas fa-bahai"></i></span> <span class="marquee-item"><b>Avocado</b><i class="fas fa-bahai"></i></span> </span> </span> </div> </section><!--====== End Animated-headline Section ======--> <!--====== Start Features Section ======--> <section class="features-section pt-130"> <div class="container"> <div class="row"> <div class="col-lg-12"> <!--=== Features Wrapper ===--> <div class="features-wrapper" data-aos="fade-up" data-aos-delay="10" data-aos-duration="1000"> <!--=== Iconic Box Item ===--> <div class="iconic-box-item icon-left-box mb-25"> <div class="icon"> <i class="fas fa-shipping-fast"></i> </div> <div class="content"> <h5>Secure Delivery</h5> <p>Your order is securely packed and delivered on time.</p> </div> </div> <!--=== Divider ===--> <div class="divider mb-25"> <img src="assets/images/divider.png" alt="divider"> </div> <!--=== Iconic Box Item ===--> <div class="iconic-box-item icon-left-box mb-25"> <div class="icon"> <i class="fas fa-microphone"></i> </div> <div class="content"> <h5>Dedicated Support</h5> <p>Our team is here to assist you from 10 AM to 5 PM. </p> </div> </div> <!--=== Divider ===--> <div class="divider mb-25"> <img src="assets/images/divider.png" alt="divider"> </div> <!--=== Iconic Box Item ===--> <div class="iconic-box-item icon-left-box mb-25"> <div class="icon"> <i class="far fa-handshake"></i> </div> <div class="content"> <h5>FDA Approved</h5> <p>FDA-approved for safety, quality, and effective skincare.</p> </div> </div> <!--=== Divider ===--> <div class="divider mb-25"> <img src="assets/images/divider.png" alt="divider"> </div> <!--=== Iconic Box Item ===--> <div class="iconic-box-item icon-left-box mb-25"> <div class="icon"> <i class="fas fa-sack-dollar"></i> </div> <div class="content"> <h5>Secure Payment</h5> <p>Shop with confidence knowing that our secure payment</p> </div> </div> </div> </div> </div> </div> </section><!--====== End Features Section ======--> <?php include 'admin/connection.inc.php'; error_reporting(E_ALL); ini_set('display_errors', 1); // Fetch products from the database $sql = "SELECT * FROM products"; // Fetch all products $result = $conn->query($sql); ?> <!--===== Start Features Section ======--> <section class="features-products-section pb-120"> <div class="container"> <div class="row"> <div class="col-lg-12"> <!--=== Section Title ===--> <div class="section-title text-center mb-60 mt-50" data-aos="fade-up" data-aos-delay="10" data-aos-duration="800"> <div class="sub-heading d-inline-flex align-items-center"> <i class="flaticon-sparkler"></i> <span class="sub-title">Feature Products</span> <i class="flaticon-sparkler"></i> </div> <h2>Our Features Collection</h2> </div> </div> </div> <?php // Start the session // Check if user is logged in and 'user_id' exists in session if (isset($_SESSION['user_id'])) { $user_id = $_SESSION['user_id']; // Get the user ID from session } else { $user_id = null; // If no user is logged in, set $user_id to null } ?> <div class="products-item-wrapper"> <!--=== Product Item ===--> <?php if ($result->num_rows > 0): ?> <?php while($row = $result->fetch_assoc()): ?> <div class="product-item style-three" data-aos="fade-up" data-aos-duration="900"> <div class="product-thumbnail"> <img src="awaha/<?php echo $row['product_img']; ?>" alt="<?php echo $row['product_name']; ?>"> <?php if ($row['product_stock'] == 0): ?> <div class="discount out-of-stock">Out of Stock</div> <?php endif; ?> <div class="hover-content"> <?php // Check if the product is in the user's wishlist $product_id = $row['id']; if ($user_id !== null) { // Ensure user_id is not null $query = "SELECT * FROM wishlist WHERE user_id = '$user_id' AND product_id = '$product_id'"; $result_wishlist = mysqli_query($conn, $query); $is_in_wishlist = mysqli_num_rows($result_wishlist) > 0; } else { $is_in_wishlist = false; // No wishlist check if user is not logged in } ?> <!-- Wishlist Button --> <a href="add-to-wishlist.php?product_id=<?php echo $product_id; ?>" class="icon-btn wishlist-icon <?php echo $is_in_wishlist ? 'wishlist-added' : ''; ?>" id="wishlist-icon-<?php echo $product_id; ?>"> <i class="fa fa-heart"></i> </a> <!-- Add to Cart Button --> <a href="#" class="cart-btn add-to-cart-btn" data-product-id="<?php echo $row['id']; ?>" <?php echo $row['product_stock'] == 0 ? 'style="pointer-events: none; opacity: 0.5;"' : ''; ?>> <i class="far fa-shopping-basket"></i> </a> <!-- Image Popup Button --> <a href="awaha/<?php echo $row['product_img']; ?>" class="img-popup icon-btn"><i class="fa fa-eye"></i></a> </div> </div> <!-- Product Info --> <div class="product-info-wrap"> <div class="product-info"> <div class="product-meta d-flex"> <span>SKU ID: <a href="#"><?php echo $row['sku_id']; ?></a></span> <?php // Fetch average rating for the product from reviews table $rating_sql = "SELECT AVG(rating) AS avg_rating FROM reviews WHERE product_name = '" . $row['product_name'] . "'"; $rating_result = $conn->query($rating_sql); $rating_row = $rating_result->fetch_assoc(); $avg_rating = !is_null($rating_row['avg_rating']) ? round($rating_row['avg_rating'], 1) : 0; // Default to 0 if no reviews ?> <ul class="ratings rating4"> <?php // Display star ratings based on the average rating for ($i = 1; $i <= 5; $i++) { if ($i <= $avg_rating) { echo '<li><i class="fas fa-star"></i></li>'; } else { echo '<li><i class="far fa-star"></i></li>'; } } ?> </ul> </div> <h4 class="title"><a href="product-details.php?id=<?php echo $row['id']; ?>"><?php echo $row['product_name']; ?></a></h4> </div> <div class="product-price"> <span class="price new-price"><span class="currency">₹</span><?php echo $row['product_discount_price'] ?: $row['product_price']; ?></span> <?php if (!empty($row['product_discount_price'])): ?> <span class="price prev-price"><span class="currency">₹</span><?php echo $row['product_price']; ?></span> <?php endif; ?> </div> </div> </div> <?php endwhile; ?> <?php else: ?> <p>No products found!</p> <?php endif; ?> </div> </div> </section><!--===== End Features Section ======--> <!--====== Start About Us Section ======--> <section class="about-us-section pt-20"> <div class="container"> <div class="row"> <div class="col-xl-6"> <!--====== Section Image Box ======--> <div class="section-image-box style-one mb-50" data-aos="fade-up" data-aos-delay="30" data-aos-duration="1000"> <div class="image-one"> <!--<img src="assets/images/about/GIF_04.gif">--> <video class="vawahasize" src="assets/images/about/FINALVIDEO.mp4" loop autoplay muted playsinline></video> </div> <!--<div class="experience-box d-none d-md-block" style="top: 80% !important; right: 50px !important">--> <!-- <div class="text">--> <!-- <div class="year">--> <!-- 25--> <!-- </div>--> <!-- <div class="duration">--> <!-- Year’s <br> Experience--> <!-- </div>--> <!-- </div>--> <!--</div>--> </div> </div> <div class="col-xl-6"> <!--====== Section Content Box ======--> <div class="section-content-box style-one " data-aos="fade-up" data-aos-delay="50" data-aos-duration="1200"> <div class="section-title mb-10"> <div class="sub-heading d-inline-flex align-items-center"> <i class="flaticon-sparkler"></i> <span class="sub-title">About us</span> </div> <h2>Awaha: Elevating Natural Skincare with Exquisite Soaps</h2> </div> <p>Welcome to awaha, where nature’s essence meets you in every bar of our soaps, suitable for all skin types. Our collection features five distinct variants:</p> <div class="row"> <div class="col-sm-12"> <ul class="list mb-5"> <li class="text-left"><i class="flaticon-star-3"></i> <b>Rose</b> - Soothing and hydrating.</li> <li class="text-left"><i class="flaticon-star-3"></i><b>Fresh Lemon</b> - Invigorating and brightening.</li> <li class="text-left"><i class="flaticon-star-3"></i><b>Sandalwood</b> - Pure and anti-inflammatory.</li> <li class="text-left"><i class="flaticon-star-3"></i><b>Jasmine</b> - Nourishing and rejuvenating.</li> <li class="text-left"><i class="flaticon-star-3"></i><b>Avocado</b> - Relaxing and stress-relieving</li> </ul> </div> </div> </div> </div> </div> </div> </section><!--====== End About Us Section ======--> <!--====== Start Features Section ======--> <!--====== Start Working Section ======--> <section class="work-processing-section pt-30 pb-90"> <div class="container"> <div class="row"> <div class="col-lg-12"> <!--=== Section Title ===--> <div class="section-title text-center mb-60" data-aos="fade-up" data-aos-delay="10" data-aos-duration="800"> <div class="sub-heading d-inline-flex align-items-center"> <i class="flaticon-sparkler"></i> <span class="sub-title">Work Processing</span> <i class="flaticon-sparkler"></i> </div> <h2>How it Work processing</h2> </div> </div> </div> <div class="row"> <div class="col-xl-3 col-sm-6"> <!--=== Iconic Box Item ===--> <div class="iconic-box-item style-two mb-40" data-aos="fade-up" data-aos-duration="1000"> <div class="sn-number">01</div> <div class="icon"> <i class="flaticon-searching"></i> </div> <div class="content"> <h6>Browsing & Choosing</h6> <p>This is where customers visit your online store, browse your products.</p> </div> </div> </div> <div class="col-xl-3 col-sm-6"> <!--=== Iconic Box Item ===--> <div class="iconic-box-item style-two mb-40" data-aos="fade-up" data-aos-duration="1200"> <div class="sn-number">02</div> <div class="icon"> <i class="flaticon-payment-method"></i> </div> <div class="content"> <h6>Checkout & Payment</h6> <p>Once they have picked their items, customers proceed to checkout.</p> </div> </div> </div> <div class="col-xl-3 col-sm-6"> <!--=== Iconic Box Item ===--> <div class="iconic-box-item style-two mb-40" data-aos="fade-up" data-aos-duration="1400"> <div class="sn-number">03</div> <div class="icon"> <i class="flaticon-currency"></i> </div> <div class="content"> <h6>Order Fulfillment</h6> <p>After the order is placed, it's sent to your fulfillment team.</p> </div> </div> </div> <div class="col-xl-3 col-sm-6"> <!--=== Iconic Box Item ===--> <div class="iconic-box-item style-two mb-40" data-aos="fade-up" data-aos-duration="1600"> <div class="sn-number">04</div> <div class="icon"> <i class="flaticon-delivery"></i> </div> <div class="content"> <h6>Delivery to Customer</h6> <p>The packed order is then sent off with a shipping carrier</p> </div> </div> </div> </div> </div> </section><!--====== End Working Section ======--> <!--====== Start Newsletter Sections ======--> <section class="newsletter-section pb-95"> <div class="container"> <!--=== Newsletter Wrapper ===--> <div class="newsletter-wrapper white-bg p-r z-1" data-aos="fade-up" data-aos-duration="1000"> <div class="newsletter-shape pattern-one"><span><img src="assets/images/newsletter/pattern-1.png" alt="Pattern Shape"></span></div> <div class="newsletter-shape pattern-two"><span><img src="assets/images/newsletter/pattern-2.png" alt="Pattern Shape"></span></div> <div class="newsletter-shape shape-one"><span><img src="assets/images/newsletter/shape-1.png" alt="Shape"></span></div> <div class="row"> <div class="col-lg-6"> <div class="newsletter-content-box"> <span class="sub-text">Wanted buy Products in bulk..?</span> <h3>Click below to shop products in bulk <span>at Awaha Soap</span> <br> <a href="bulk-shop.php"> <button class="btn btn-dark">Bulk Order</button></a> </h3> </div> </div> <div class="col-lg-6"> <div class="newsletter-image"> <img src="assets/images/soap/alll.png" height="400" alt="Image"> </div> </div> </div> </div> </div> </section><!--====== End Newsletter Sections ======--> <!--====== Start Category Section ======--> <section class="category-section pt-20 overflow-hidden"> <div class="container"> <div class="row align-items-center"> <div class="col-lg-6 col-md-8"> <!--=== Section Title ===--> <div class="section-title mb-50" data-aos="fade-right" data-aos-delay="10" data-aos-duration="800"> <div class="sub-heading d-inline-flex align-items-center"> <i class="flaticon-sparkler"></i> <span class="sub-title">Categories</span> </div> <h2>Browse Top Category</h2> </div> </div> <div class="col-lg-6 col-md-4"> <!--=== Arrows ===--> <div class="category-arrows style-one mb-60" data-aos="fade-left" data-aos-delay="15" data-aos-duration="1000"></div> </div> </div> </div> <?php // Include the database connection file include 'admin/connection.inc.php'; // Fetch categories from the database $sql = "SELECT * FROM categories"; $result = $conn->query($sql); ?> <!--=== Category Slider ===--> <div class="category-slider-one" data-aos="fade-up" data-aos-delay="20" data-aos-duration="1200"> <!--=== Category Item ===--> <?php if ($result->num_rows > 0): ?> <?php while ($row = $result->fetch_assoc()): ?> <div class="category-item style-one text-center"> <div class="category-img"> <img src="admin/<?php echo $row['category_image']; ?>" alt="<?php echo $row['category_name']; ?> image" height= "262px"; width="323px";> </div> <div class="category-content"> <a href="other-shop.php?id=<?php echo htmlspecialchars($row['id'], ENT_QUOTES, 'UTF-8'); ?>" class="category-btn"> <?php echo htmlspecialchars($row['category_name'], ENT_QUOTES, 'UTF-8'); ?> </a> </div> </div> <?php endwhile; ?> <?php else: ?> <p>No categories found.</p> <?php endif; ?> </div> </section><!--====== End Category Section ======--> <section class="blogs-section pt-110 pb-100"> <div class="container"> <div class="row align-items-center"> <div class="col-md-8"> <!--=== Section Title ===--> <div class="section-title mb-50" data-aos="fade-right" data-aos-duration="1000"> <div class="sub-heading d-inline-flex align-items-center"> <i class="flaticon-sparkler"></i> <span class="sub-title">Explore Our Blogs</span> </div> <h2>Explore Our Blogs</h2> </div> </div> <div class="col-md-4"> <div class="blogs-arrows d-flex style-one mb-60" data-aos="fade-left" data-aos-duration="1200"></div> </div> </div> <!--=== Blog Slider ===--> <div class="blogs-slider-one" data-aos="fade-up" data-aos-duration="1400"> <!--=== Blog Post Item ===--> <?php include 'admin/connection.inc.php'; // Database connection ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); $query = "SELECT * FROM blogs ORDER BY created_at DESC"; // Fetch blogs from DB $result = mysqli_query($conn, $query); function createSlug($string) { $string = strtolower(trim($string)); // Convert to lowercase and trim spaces $string = preg_replace('/[^a-z0-9-]+/', '-', $string); // Replace non-alphanumeric characters with hyphens return rtrim($string, '-'); // Remove trailing hyphens } if (mysqli_num_rows($result) > 0) { while ($row = mysqli_fetch_assoc($result)) { $slug = createSlug($row['blog_name']); // Convert blog name to slug ?> <div class="blog-post-item style-three mb-30"> <div class="post-thumbnail"> <img src="<?php echo $row['blog_img']; ?>" alt="Post Thumbnail"> </div> <div class="post-content"> <div class="post-meta"> <span><a href="#">Awaha Soap</a></span> <span><a href="#"><?php echo date("M d, Y", strtotime($row['created_at'])); ?></a></span> </div> <h3 class="title"> <a href="blog-details.php/<?php echo $slug; ?>"><?php echo $row['blog_name']; ?></a> </h3> <a href="blog-details.php/<?php echo $slug; ?>" class="theme-btn style-one">Read More</a> </div> </div> <?php } } else { echo "<p>No blogs available.</p>"; } ?> </div> </div> </section> <!--====== Start Newsletter Sections ======--> <section class="newsletter-section pb-95"> <div class="container"> <!--=== Newsletter Wrapper ===--> <div class="newsletter-wrapper white-bg p-r z-1" data-aos="fade-up" data-aos-duration="1000"> <div class="newsletter-shape pattern-one"><span><img src="assets/images/newsletter/pattern-1.png" alt="Pattern Shape"></span></div> <div class="newsletter-shape pattern-two"><span><img src="assets/images/newsletter/pattern-2.png" alt="Pattern Shape"></span></div> <div class="newsletter-shape shape-one"><span><img src="assets/images/newsletter/shape-1.png" alt="Shape"></span></div> <div class="row"> <div class="col-lg-6"> <div class="newsletter-content-box"> <span class="sub-text">New at Awaha..?</span> <h3>Sign up for free and get Purchase <span>Awaha Soap</span> <br> <a href="register.php"><button class="btn btn-dark">Sign Up Now</button></a> </h3> </div> </div> <div class="col-lg-6"> <div class="newsletter-image"> <img src="assets/images/soap/soap.avif" height="300" width="300" alt="Image"> </div> </div> </div> </div> </div> </section><!--====== End Newsletter Sections ======--> </main> <?php include 'footer.php' ?> <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <script> document.addEventListener('DOMContentLoaded', () => { const addToCartButtons = document.querySelectorAll('.add-to-cart-btn'); const cartCountElement = document.querySelector('#cart-count'); // Update cart count dynamically addToCartButtons.forEach(button => { button.addEventListener('click', (event) => { event.preventDefault(); const productId = button.getAttribute('data-product-id'); fetch('add-to-cart.php', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ product_id: productId }), }) .then(response => response.json()) .then(data => { if (data.redirect) { // Redirect to login page if not logged in window.location.href = 'login.php'; } else if (data.success) { // Update cart count if successful cartCountElement.textContent = data.cart_count; // Display SweetAlert success message Swal.fire({ icon: 'success', title: 'Added to Cart', text: 'The product has been successfully added to your cart!', timer: 2000, showConfirmButton: false }).then(() => { // Reload the page after the alert is closed location.reload(); }); } else { // Display SweetAlert error message Swal.fire({ icon: 'error', title: 'Error', text: 'Failed to add the product to your cart. Please try again.', timer: 2000, showConfirmButton: false }); } }) .catch(error => { console.error('Error:', error); // Display SweetAlert error message for fetch failure Swal.fire({ icon: 'error', title: 'Error', text: 'An error occurred while processing your request. Please try again later.', timer: 2000, showConfirmButton: false }); }); }); }); }); document.addEventListener('DOMContentLoaded', () => { const cartContainer = document.querySelector('#cart-items-list'); const cartSubtotal = document.querySelector('#cart-subtotal'); if (!cartContainer || !cartSubtotal) { console.error('Cart container or subtotal not found.'); return; } // Fetch cart items from server fetch('fetch-cart-items.php') .then(response => response.json()) .then(data => { if (data.success) { let itemsHTML = ''; let subtotal = 0; data.cart_items.forEach(item => { const { product_id, product_name, product_discount_price, product_img, quantity } = item; // Create cart item list entry itemsHTML += ` <li class="sidebar-cart-item" data-product-id="${product_id}"> <a href="#" class="remove-cart" data-product-id="${product_id}"> <i class="far fa-trash-alt"></i> </a> <a href="#"> <img src="awaha/${product_img}" alt="${product_name}"> ${product_name} </a> <span class="quantity">${quantity} × ₹<span class="price">${product_discount_price}</span></span> </li> `; // Calculate the subtotal subtotal += product_discount_price * quantity; }); // Update cart UI with new cart items cartContainer.innerHTML = itemsHTML; cartSubtotal.innerHTML = `₹${subtotal.toFixed(2)}`; } else { cartContainer.innerHTML = '<li>No items in the cart</li>'; } }) .catch(error => { console.error('Error fetching cart items:', error); cartContainer.innerHTML = '<li>Error loading cart items</li>'; }); // Event delegation for removing items cartContainer.addEventListener('click', async (event) => { const removeButton = event.target.closest('.remove-cart'); if (removeButton) { event.preventDefault(); console.log('Remove button clicked!'); const cartItem = removeButton.closest('.sidebar-cart-item'); if (!cartItem) { console.error('Cart item container not found.'); return; } const productId = cartItem.getAttribute('data-product-id'); if (!productId) { console.error('No product ID found.'); return; } console.log('Removing item with ID:', productId); try { // Call API to remove item const response = await fetch('remove-cart-item.php', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ product_id: productId }), }); const data = await response.json(); if (data.success) { cartItem.remove(); // Remove item from UI updateSubtotal(); // Update subtotal setTimeout(() => { window.location.href = window.location.href; // Ensure a hard reload }, 500); } else { console.error('Error removing item:', data.message); } } catch (error) { console.error('Error removing item:', error); } } }); // Function to update subtotal function updateSubtotal() { let subtotal = 0; const cartItems = document.querySelectorAll('.sidebar-cart-item'); cartItems.forEach(item => { const quantityElement = item.querySelector('.quantity'); const priceElement = item.querySelector('.price'); if (quantityElement && priceElement) { const quantity = parseInt(quantityElement.textContent.split(' × ')[0], 10); const price = parseFloat(priceElement.textContent) || 0; subtotal += quantity * price; } }); cartSubtotal.innerHTML = `₹${subtotal.toFixed(2)}`; } }); </script> <!--====== Back To Top ======--> <!--====== Jquery js ======--> <script src="assets/vendor/jquery-3.7.1.min.js"></script> <!--====== Bootstrap js ======--> <script src="assets/vendor/popper/popper.min.js"></script> <!--====== Bootstrap js ======--> <script src="assets/vendor/bootstrap/js/bootstrap.min.js"></script> <!--====== Slick js ======--> <script src="assets/vendor/slick/slick.min.js"></script> <!--====== Magnific js ======--> <script src="assets/vendor/magnific-popup/dist/jquery.magnific-popup.min.js"></script> <!--====== Nice-select js ======--> <script src="assets/vendor/nice-select/js/jquery.nice-select.min.js"></script> <!--====== Jquery Ui js ======--> <script src="assets/vendor/jquery-ui/jquery-ui.min.js"></script> <!--====== SimplyCountdown js ======--> <script src="assets/vendor/simplyCountdown.min.js"></script> <!--====== Aos js ======--> <script src="assets/vendor/aos/aos.js"></script> <!--====== Main js ======--> <script src="assets/js/theme.js"></script> <script src="assets/js/jquery.min.js"></script> <script src="assets/js/owl.carousel.min.js"></script> <!-- Initialize the slider --> <script> $(document).ready(function () { $('.category-slider-one').owlCarousel({ loop: true, margin: 10, nav: true, dots: false, autoplay: true, autoplayTimeout: 3000, autoplayHoverPause: true, responsive: { 0: { items: 1 }, 600: { items: 3 }, 1000: { items: 5 } } }); }); </script> <script> $(document).ready(function() { $('#wishlist-icon').click(function(e) { e.preventDefault(); // Get the product ID and user ID (assuming the user ID is available, such as in a session or as a data attribute) let productId = $(this).data('item-id'); let userId = 1; // Example: Replace this with actual user ID from your session or auth system // Send the data to the backend via AJAX $.ajax({ url: 'add-to-wishlist.php', // PHP script to handle the database insertion method: 'POST', data: { user_id: userId, product_id: productId }, success: function(response) { // Display success message Swal.fire({ icon: 'success', title: 'Added to Wishlist', text: 'The item has been added to your wishlist.', timer: 2000, showConfirmButton: false }); // Optionally, change the icon to indicate it's added to wishlist $('#wishlist-icon').find('i').removeClass('fa-heart').addClass('fa-heart-o'); }, error: function() { Swal.fire({ icon: 'error', title: 'Error', text: 'Something went wrong, please try again later.', timer: 2000, showConfirmButton: false }); } }); }); }); </script> <script> // Function to handle wishlist toggle (click event) function toggleWishlist(event, productId) { event.preventDefault(); // Prevent the default anchor behavior let url = "add-to-wishlist.php?product_id=" + productId; // URL to send request // Perform the AJAX request to toggle the wishlist status fetch(url) .then(response => response.text()) .then(data => { // Reload the page to reflect the updated wishlist state location.reload(); }) .catch(error => console.error('Error:', error)); } // Handle double-click to remove product from wishlist document.querySelector("#wishlist-icon-<?php echo $product_id; ?>").ondblclick = function(event) { event.preventDefault(); // Prevent the default action on double-click let url = "add-to-wishlist.php?product_id=<?php echo $product_id; ?>"; // Same URL for removal // Perform the AJAX request to remove the product from wishlist fetch(url) .then(response => response.text()) .then(data => { // Reload the page to reflect the updated wishlist state location.reload(); }) .catch(error => console.error('Error:', error)); }; </script> <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11.6.0/dist/sweetalert2.min.js"></script> <script> // main.js or scripts.js function toggleWishlist(product_id) { $.ajax({ url: 'toggle-wishlist.php', type: 'POST', data: { product_id: product_id }, dataType: 'json', success: function(response) { let wishlistIcon = $("#wishlist-icon-" + product_id); if (response.status === 'added') { wishlistIcon.addClass('wishlist-added'); } else if (response.status === 'removed') { wishlistIcon.removeClass('wishlist-added'); } } }); } </script> </body> </html>
Simpan