One Hat Cyber Team
Your IP :
216.73.216.186
Server IP :
147.79.69.90
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
/
loveberi.com
/
public_html
/
Edit File:
category.php
<?php require('connection.inc.php'); require('security.php'); error_reporting(E_ALL); ini_set('display_errors', 1); $wishlist_product_ids = []; if (isset($_SESSION['user_id'])) { $user_id = $_SESSION['user_id']; $wishlist_sql = "SELECT product_id FROM wishlist WHERE user_id = $user_id"; $wishlist_result = mysqli_query($conn, $wishlist_sql); while ($row = mysqli_fetch_assoc($wishlist_result)) { $wishlist_product_ids[] = $row['product_id']; } } ?> <!doctype html> <html class="no-js" lang="zxx"> <head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <title>Love Beri</title> <meta name="description" content=""> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- Place favicon.ico in the root directory --> <link rel="shortcut icon" type="image/x-icon" href=".../assets/img/allnew/logo.png"> <!-- CSS here --> <link rel="stylesheet" href="../assets/css/bootstrap.min.css"> <link rel="stylesheet" href="../assets/css/animate.css"> <link rel="stylesheet" href="../assets/css/swiper-bundle.css"> <link rel="stylesheet" href="../assets/css/slick.css"> <link rel="stylesheet" href="../assets/css/magnific-popup.css"> <link rel="stylesheet" href="../assets/css/spacing.css"> <link rel="stylesheet" href="../assets/css/meanmenu.css"> <link rel="stylesheet" href="../assets/css/nice-select.css"> <link rel="stylesheet" href="../assets/css/fontawesome.min.css"> <link rel="stylesheet" href="../assets/css/icon-dukamarket.css"> <link rel="stylesheet" href="../assets/css/jquery-ui.css"> <link rel="stylesheet" href="../assets/css/main.css"> <style> .form-select.weight-select { background-color: #f9f9f9; padding: 0px 14px; border-radius: 6px; font-size: 14px; } .tpproduct__content { padding: 2px; height: 220px !important; } .nice-select:after{ content: unset !important; } .tpproduct{ margin-bottom: 110px !important; } @media(min-width: 1389px) and (max-width: 1500px){ .tpproduct__content { padding: 2px; height: 240px !important; } .tpproduct{ margin-bottom: 190px !important; } } @media(min-width: 1501px) and (max-width: 1700px){ .tpproduct__content { padding: 2px; height: 250px !important; } .tpproduct{ margin-bottom: 230px !important; } } @media(min-width: 1701px){ .tpproduct__content { padding: 2px; height: 260px !important; } .tpproduct{ margin-bottom: 270px !important; } } </style> </head> <body> <!-- Scroll-top --> <button class="scroll-top scroll-to-target" data-target="html"> <i class="icon-chevrons-up"></i> </button> <!-- Scroll-top-end--> <?php require('connection.inc.php'); $cartCount = 0; if (isset($_SESSION['user_id'])) { $user_id = $_SESSION['user_id']; $stmt = $conn->prepare("SELECT COUNT(*) FROM (SELECT 1 FROM cart WHERE user_id = ? GROUP BY product_id, unit_id) AS distinct_items"); $stmt->bind_param("i", $user_id); $stmt->execute(); $stmt->bind_result($cartCount); $stmt->fetch(); $stmt->close(); } ?> <header> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css"> <div class="header__top theme-bg-1 d-none d-md-block ps-5 pe-5"> <div class="container-fluid"> <div class="row align-items-center"> <div class="col-lg-6 col-md-12"> <div class="header__top-left"> <span>Best quality berries? Let us be your first and last stop for it.</span> </div> </div> <div class="col-lg-6 col-md-12"> <div class="d-flex justify-content-end align-items-center"> <div class="text-white me-2"> <?php if (isset($_SESSION['username'])) { echo '<a href="index.php">Welcome, ' . htmlspecialchars($_SESSION['username']) . '</a>'; } else { echo '<a href="log-in.php">Login/Register</a>'; } ?> </div> <div class="header__top-right d-flex align-items-center gap-3"> <a href="https://www.facebook.com/profile.php?id=61550353618807" target="_blank" class="text-white"><i class="fab fa-facebook-f"></i></a> <a href="https://x.com/ethnic_foods" target="_blank" class="text-white"><i class="fab fa-twitter"></i></a> <a href="https://www.youtube.com/@EthnicFoodProduct" target="_blank" class="text-white"><i class="fab fa-youtube"></i></a> <a href="https://www.instagram.com/ethnicfoodproduct/" target="_blank" class="text-white"><i class="fab fa-instagram"></i></a> </div> </div> </div> </div> </div> </div> <div id="header-sticky" class="header__main-area d-none d-xl-block p-2"> <div class="container-fluid"> <div class="header__for-megamenu p-relative"> <div class="row align-items-center"> <div class="col-xl-3"> <div class="header__logo ps-5"> <a href="../index.php"><img src="../assets/img/allnew/logo.png" alt="logo"></a> </div> </div> <div class="col-xl-4"> <div class="header__menu main-menu text-center"> <nav id="mobile-menu"> <ul> <li > <a href="../index.php">Home</a> </li> <li><a href="../product.php">Shop</a></li> <li><a href="../about.php">About Us</a></li> <li><a href="../contact.php">Contact Us</a></li> <li> <a href="../blog.php">Blog</a> </li> </ul> </nav> </div> </div> <div class="col-xl-5"> <div class="header__info d-flex align-items-center pe-5"> <div class="header__info-user tpcolor__yellow ml-10"> <?php if (isset($_SESSION['username'])): ?> <a href="javascript:void(0)" class="user-icon" onclick="toggleDropdown()"> <i class="icon-user"></i> </a> <?php endif; ?> <div id="dropdownMenu" class="dropdown-menu"> <a href="../order.php" class="dropdown-item">Order Page</a> <a href="../wishlist.php" class="dropdown-item">Wishlist</a> <a href="../logout.php" class="dropdown-item">Logout</a> </div> </div> <style> .dropdown-menu { display: none; position: absolute; background-color: #fff; border: 1px solid #ccc; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); z-index: 1000; } .dropdown-item { padding: 10px; text-decoration: none; color: #333; display: block; } .dropdown-item:hover { background-color: #f1f1f1; } </style> <script> function toggleDropdown() { const dropdown = document.getElementById("dropdownMenu"); dropdown.style.display = (dropdown.style.display === "block") ? "none" : "block"; } </script> <div class="header__info-cart tpcolor__oasis ml-10 tp-cart-toggle"> <a href="../cart.php"><i><img src="../assets/img/icon/cart-1.svg" alt=""></i></a> <span><?php echo $cartCount; ?></span> </div> </div> </div> </div> </div> </div> </div> <!-- header-search --> <div class="tpsearchbar tp-sidebar-area"> <button class="tpsearchbar__close"><i class="icon-x"></i></button> <div class="search-wrap text-center"> <div class="container"> <div class="row justify-content-center"> <div class="col-6 pt-100 pb-100"> <h2 class="tpsearchbar__title">What Are You Looking For?</h2> <div class="tpsearchbar__form"> <form action="#"> <input type="text" name="search" placeholder="Search Product..."> <button class="tpsearchbar__search-btn"><i class="icon-search"></i></button> </form> </div> </div> </div> </div> </div> </div> <div class="search-body-overlay"></div> <!-- header-search-end --> <!-- header-cart-start --> <div class="cartbody-overlay"></div> <!-- header-cart-end --> <!-- mobile-menu-area --> <div id="header-sticky-2" class="tpmobile-menu d-xl-none"> <div class="container-fluid"> <div class="row align-items-center"> <div class="col-lg-4 col-md-4 col-3 col-sm-3"> <div class="mobile-menu-icon"> <button class="tp-menu-toggle"><i class="icon-menu1"></i></button> </div> </div> <div class="col-lg-4 col-md-4 col-6 col-sm-4"> <div class="header__logo text-center"> <a href="index.php"><img src="../assets/img/allnew/logo.png" alt="logo"></a> </div> </div> <div class="col-lg-4 col-md-4 col-3 col-sm-5"> <div class="header__info d-flex align-items-center"> <div class="header__info-search tpcolor__purple ml-10 d-none d-sm-block"> <button class="tp-search-toggle"><i class="icon-search"></i></button> </div> <div class="header__info-user tpcolor__yellow ml-10 d-none d-sm-block"> <a href="#"><i class="icon-user"></i></a> </div> <div class="header__info-cart tpcolor__oasis ml-10 tp-cart-toggle"> <button><i><img src="../assets/img/icon/cart-1.svg" alt=""></i> </button> </div> </div> </div> </div> </div> </div> <div class="body-overlay"></div> <!-- mobile-menu-area-end --> <!-- sidebar-menu-area --> <div class="tpsideinfo"> <button class="tpsideinfo__close">Close<i class="fal fa-times ml-10"></i></button> <div class="tpsideinfo__search text-center pt-35"> <span class="tpsideinfo__search-title mb-20">What Are You Looking For?</span> <form action="#"> <input type="text" placeholder="Search Products..."> <button><i class="icon-search"></i></button> </form> </div> <div class="tpsideinfo__nabtab"> <div class="tab-content" id="pills-tabContent"> <div class="tab-pane fade show active" id="pills-home" role="tabpanel" aria-labelledby="pills-home-tab" tabindex="0"> <div class="mobile-menu"></div> </div> <div class="tab-pane fade" id="pills-profile" role="tabpanel" aria-labelledby="pills-profile-tab" tabindex="0"> <div class="tpsidebar-categories"> <ul> <li><a href="shop-details.php">Dairy Farm</a></li> <li><a href="shop-details.php">Healthy Foods</a></li> <li><a href="shop-details.php">Lifestyle</a></li> <li><a href="shop-details.php">Organics</a></li> <li><a href="shop-details.php">Photography</a></li> <li><a href="shop-details.php">Shopping</a></li> <li><a href="shop-details.php">Tips & Tricks</a></li> </ul> </div> </div> </div> </div> <div class="tpsideinfo__account-link"> <a href="log-in.php"><i class="icon-user icons"></i> Login / Register</a> </div> </div> <!-- sidebar-menu-area-end --> </header> <main> <!-- breadcrumb-area-start --> <div class="breadcrumb__area grey-bg pt-5 pb-5"> <div class="container"> <div class="row"> <div class="col-lg-12"> <div class="tp-breadcrumb__content"> <div class="tp-breadcrumb__list"> <span class="tp-breadcrumb__active"><a href="../index.php">Home</a></span> <span class="dvdr">/</span> <span>Shop</span> </div> </div> </div> </div> </div> </div> <!-- breadcrumb-area-end --> <!-- shop-area-start --> <?php // Extract category URL name from the URL path $currentUrlPath = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH); $customPath = trim(basename($currentUrlPath)); // Match with category_url_name if exists $category_filter_extra = ''; if (!empty($customPath) && $customPath !== 'category.php') { $decodedName = urldecode($customPath); // Get category ID from URL-friendly name $cat_sql = "SELECT category_id FROM categories WHERE category_url_name = '" . mysqli_real_escape_string($conn, $decodedName) . "' AND deleted_at IS NULL"; $cat_res = mysqli_query($conn, $cat_sql); if ($cat_row = mysqli_fetch_assoc($cat_res)) { $category_id_from_url = (int)$cat_row['category_id']; $_GET['categories'][] = $category_id_from_url; // Automatically apply filter } } // 1. Category filter $category_filter = ''; if (!empty($_GET['categories'])) { $category_ids = array_map('intval', $_GET['categories']); $category_filter = " AND p.category_id IN (" . implode(',', $category_ids) . ")"; } // 2. Sorting $sort = $_GET['sort'] ?? 'default'; $order_by = 'p.product_id DESC'; if ($sort == 'price_low_high') $order_by = 'pu.unit_price ASC'; if ($sort == 'price_high_low') $order_by = 'pu.unit_price DESC'; // 3. Pagination $limit = 9; $page = $_GET['page'] ?? 1; $offset = ($page - 1) * $limit; // 4. Count total products $count_sql = "SELECT COUNT(DISTINCT p.product_id) AS total FROM products p LEFT JOIN product_units pu ON p.product_id = pu.product_id WHERE p.deleted_at IS NULL AND p.product_status = 1 $category_filter"; $count_query = mysqli_query($conn, $count_sql); $total_products = mysqli_fetch_assoc($count_query)['total']; $total_pages = ceil($total_products / $limit); // 5. Fetch products $product_sql = "SELECT DISTINCT p.* FROM products p LEFT JOIN product_units pu ON p.product_id = pu.product_id WHERE p.deleted_at IS NULL AND p.product_status = 1 $category_filter ORDER BY $order_by LIMIT $limit OFFSET $offset"; $product_query = mysqli_query($conn, $product_sql); $products = []; while ($row = mysqli_fetch_assoc($product_query)) { $products[$row['product_id']] = $row; } // 6. Fetch images $image_sql = "SELECT product_id, MIN(product_img) AS product_img FROM product_imgs WHERE deleted_at IS NULL GROUP BY product_id"; $image_query = mysqli_query($conn, $image_sql); $product_images = []; while ($img = mysqli_fetch_assoc($image_query)) { $product_images[$img['product_id']] = $img['product_img']; } // 7. Fetch units $unit_sql = "SELECT * FROM product_units WHERE deleted_at IS NULL"; $unit_query = mysqli_query($conn, $unit_sql); $product_units = []; while ($unit = mysqli_fetch_assoc($unit_query)) { $product_units[$unit['product_id']][] = $unit; } // Utility function to build URL with updated query function build_query($params) { return http_build_query(array_merge($_GET, $params)); } ?> <!-- HTML starts --> <form method="GET" id="filterForm"> <section class="shop-area-start grey-bg pb-200"> <div class="container"> <div class="row"> <!-- Category Sidebar --> <div class="col-xl-2 col-lg-12 col-md-12"> <div class="tpshop__leftbar"> <div class="tpshop__widget mb-30 pb-25"> <h4 class="tpshop__widget-title">Product Categories</h4> <?php $cat_sql = "SELECT * FROM categories WHERE deleted_at IS NULL"; $cat_res = mysqli_query($conn, $cat_sql); while ($cat = mysqli_fetch_assoc($cat_res)) { $checked = (!empty($_GET['categories']) && in_array($cat['category_id'], $_GET['categories'])) ? "checked" : ""; ?> <div class="form-check"> <input class="form-check-input" type="checkbox" name="categories[]" value="<?= $cat['category_id'] ?>" <?= $checked ?> onchange="document.getElementById('filterForm').submit();"> <label class="form-check-label"><?= htmlspecialchars($cat['category_name']) ?></label> </div> <?php } ?> </div> </div> </div> <!-- Product Content --> <div class="col-xl-10 col-lg-12 col-md-12"> <div class="tpshop__top ml-60"> <div class="product__filter-content mb-30"> <div class="row align-items-center"> <div class="col-sm-4"> <div class="product__item-count"> <span>Showing <?= $offset + 1 ?> - <?= min($offset + $limit, $total_products) ?> of <?= $total_products ?> Products</span> </div> </div> <div class="col-sm-4"></div> <div class="col-sm-4"> <div class="product__navtabs d-flex justify-content-end align-items-center"> <div class="tp-shop-selector"> <select name="sort" onchange="document.getElementById('filterForm').submit();"> <option value="default" <?= $sort == 'default' ? 'selected' : '' ?>>Default sorting Price</option> <option value="price_low_high" <?= $sort == 'price_low_high' ? 'selected' : '' ?>>Price: Low to High</option> <option value="price_high_low" <?= $sort == 'price_high_low' ? 'selected' : '' ?>>Price: High to Low</option> </select> </div> </div> </div> </div> </div> <!-- Product Grid --> <div class="tab-content" id="nav-tabContent"> <div class="tab-pane fade show active whight-product" id="nav-popular"> <div class="row row-cols-xxl-3 row-cols-xl-3 row-cols-lg-3 row-cols-md-3 row-cols-sm-2 row-cols-1 tpproduct__shop-item"> <?php foreach ($products as $product_id => $product): ?> <div class="col"> <div class="tpproduct p-relative mb-20"> <div class="tpproduct__thumb p-relative text-center"> <a href="../product-details.php/<?= urlencode($product['product_url_name']); ?>"> <img src="../admin/<?= htmlspecialchars($product_images[$product_id] ?? 'default.jpg'); ?>" alt="<?= htmlspecialchars($product['product_name']); ?>"> </a> <div class="tpproduct__shopping"> <?php $is_wishlisted = in_array($product_id, $wishlist_product_ids); $wishlist_class = $is_wishlisted ? 'wishlist-active' : ''; ?> <a class="tpproduct__shopping-wishlist <?php echo $wishlist_class; ?>" href="javascript:void(0);" onclick="addOrRemoveFromWishlist(<?php echo $product_id; ?>)"> <?php if ($is_wishlisted): ?> <svg xmlns="http://www.w3.org/2000/svg" class="icon-heart-filled" viewBox="0 0 24 24" fill="red" width="20" height="20"> <path d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41 0.81 4.5 2.09 C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5 c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"/> </svg> <?php else: ?> <i class="icon-heart icons"></i> <?php endif; ?> </a> </div> </div> <div class="tpproduct__content p-3"> <h4 class="tpproduct__title"> <a href="../product-details.php/<?= urlencode($product['product_url_name']); ?>"> <?= htmlspecialchars($product['product_name']); ?> </a> </h4> <div class="tpproduct__rating mb-5"> <a href="#"><i class="icon-star_outline1"></i></a> <a href="#"><i class="icon-star_outline1"></i></a> <a href="#"><i class="icon-star_outline1"></i></a> <a href="#"><i class="icon-star_outline1"></i></a> <a href="#"><i class="icon-star_outline1"></i></a> </div> <div class="mb-10 w-100"> <label for="weightSelect<?php echo $product_id; ?>" class="form-label fw-semibold mb-2" style="font-size: 14px;">Select Weight</label> <select id="weightSelect<?php echo $product_id; ?>" class="form-select weight-select w-100" onchange="updatePrice(this, <?php echo $product_id; ?>)"> <?php if (isset($product_units[$product_id])) { foreach ($product_units[$product_id] as $unit) { ?> <option value="<?php echo htmlspecialchars($unit['unit_id']); ?>" data-price="<?php echo htmlspecialchars($unit['unit_price']); ?>" data-old="<?php echo htmlspecialchars($unit['unit_price'] * 1.2); ?>"> <?php echo htmlspecialchars($unit['unit_name']) . ' - ₹' . htmlspecialchars($unit['unit_price']); ?> </option> <?php } } ?> </select> </div> <?php $first_price = isset($product_units[$product_id][0]['unit_price']) ? $product_units[$product_id][0]['unit_price'] : 0; ?> <div class="tpproduct__price mt-60"> <span id="currentPrice<?php echo $product_id; ?>" class="current-price">₹<?php echo number_format($first_price, 2); ?></span> <del id="oldPrice<?php echo $product_id; ?>" class="old-price">₹<?php echo number_format($first_price * 1.2, 2); ?></del> </div> <div class="tpproduct__hover-btn d-flex justify-content-center mb-10"> <a class="tp-btn-2" href="javascript:void(0);" onclick="addToCart(this, <?php echo $product_id; ?>)">Add to cart</a> </div> </div> </div> </div> <?php endforeach; ?> </div> </div> </div> <!-- Pagination --> <div class="basic-pagination text-center mt-35"> <nav> <ul> <?php for ($i = 1; $i <= $total_pages; $i++): ?> <li> <?php if ($i == $page): ?> <span class="current"><?= $i; ?></span> <?php else: ?> <a href="?<?= build_query(['page' => $i]) ?>"><?= $i; ?></a> <?php endif; ?> </li> <?php endfor; ?> </ul> </nav> </div> </div> </div> </div> </div> </section> </form> <!-- JS to update price on dropdown change --> <script> function updatePrice(select, productId) { let price = select.options[select.selectedIndex].getAttribute('data-price'); let old = select.options[select.selectedIndex].getAttribute('data-old'); document.getElementById('currentPrice' + productId).innerText = '₹' + parseFloat(price).toFixed(2); document.getElementById('oldPrice' + productId).innerText = '₹' + parseFloat(old).toFixed(2); } </script> <section class="feature-area mainfeature__bg grey-bg pt-50 pb-40" data-background="../assets/img/shape/footer-shape-1.svg"> <div class="container"> <div class="mainfeature__border pb-15"> <div class="row row-cols-lg-4 row-cols-md-3 row-cols-2"> <div class="col"> <div class="mainfeature__item text-center mb-30"> <div class="mainfeature__icon"> <img src="../assets/img/icon/feature-icon-1.svg" alt=""> </div> <div class="mainfeature__content"> <h4 class="mainfeature__title">Fast Delivery</h4> <p>Across West & East India</p> </div> </div> </div> <div class="col"> <div class="mainfeature__item text-center mb-30"> <div class="mainfeature__icon"> <img src="../assets/img/icon/feature-icon-2.svg" alt=""> </div> <div class="mainfeature__content"> <h4 class="mainfeature__title">safe payment</h4> <p>100% Secure Payment</p> </div> </div> </div> <div class="col"> <div class="mainfeature__item text-center mb-30"> <div class="mainfeature__icon"> <img src="../assets/img/icon/feature-icon-3.svg" alt=""> </div> <div class="mainfeature__content"> <h4 class="mainfeature__title">Online Discount</h4> <p>Add Multi-buy Discount </p> </div> </div> </div> <div class="col"> <div class="mainfeature__item text-center mb-30"> <div class="mainfeature__icon"> <img src="../assets/img/icon/feature-icon-4.svg" alt=""> </div> <div class="mainfeature__content"> <h4 class="mainfeature__title">Help Center</h4> <p>Dedicated 24/7 Support </p> </div> </div> </div> </div> </div> </div> </section> <footer> <div class="tpfooter__area theme-bg-2"> <div class="tpfooter__top pb-15"> <div class="container"> <div class="row"> <div class="col-xl-3 col-lg-4 col-md-6 col-sm-6"> <div class="tpfooter__widget footer-col-2 mb-50"> <h4 class="tpfooter__widget-title"><img src="../assets/img/WhiteLogo.png" height="150px"></h4> <p>Address <br> </p> <div class="tpfooter__widget-time-info mt-35"> <span>Monday – Friday: <b>8:10 AM – 6:10 PM</b></span> <span>Saturday: <b>10:10 AM – 06:10 PM</b></span> <span>Sunday: <b>Close</b></span> </div> </div> </div> <div class="col-xl-3 col-lg-4 col-md-6 col-sm-6"> <div class="tpfooter__widget footer-col-1 mb-50"> <h4 class="tpfooter__widget-title">Customer Support</h4> <div class="tpfooter__widget-links"> <ul> <li><a href="../cancel.php">Cancellation & Refund</a></li> <li><a href="../privacypolicy.php">Privacy Policy</a></li> <li><a href="../s&d.php">Shipping & Delivery</a></li> <li><a href="../terms.php">Terms & Condition</a></li> </ul> </div> </div> </div> <div class="col-xl-2 col-lg-4 col-md-4 col-sm-5"> <div class="tpfooter__widget footer-col-3 mb-50"> <h4 class="tpfooter__widget-title">Quick Links</h4> <div class="tpfooter__widget-links"> <ul> <li><a href="../index.php">Home</a></li> <li><a href="../about.php">About Us</a></li> <li><a href="../contactus.php">Contact Us</a></li> <li><a href="../Blog.php">Blog</a></li> </ul> </div> </div> </div> <div class="col-xl-4 col-lg-6 col-md-8 col-sm-7"> <div class="tpfooter__widget footer-col-4 mb-50"> <h4 class="tpfooter__widget-title">Our newsletter</h4> <div class="tpfooter__widget-newsletter"> <iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3770.5884245265042!2d73.00838082418423!3d19.081825101791654!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x3be7c1394978006b%3A0x12fd6d16abacf57!2sCommodity%20Exchange!5e0!3m2!1sen!2sin!4v1703678311152!5m2!1sen!2sin" width="400" height="200" style="border:0;" allowfullscreen="" loading="lazy" referrerpolicy="no-referrer-when-downgrade"></iframe> </div> </div> </div> </div> </div> </div> <div class="tpfooter___bottom pt-40 pb-40"> <div class="container"> <div class="row"> <div class="col-lg-6 col-md-7 col-sm-12"> <div class="tpfooter__copyright"> <span class="tpfooter__copyright-text">Copyright © <a href="#">Love Beri</a> all rights reserved. Developed by <a target="_blank" href="https://hsdigitalmedia.com/">HS Digital Media®</a>.</span> </div> </div> </div> </div> </div> </div> </footer> </main> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <script> $(document).ready(function () { $('.weight-select').on('change', function () { const selected = $(this).find(':selected'); const newPrice = selected.data('price'); const newOldPrice = selected.data('old'); const productBox = $(this).closest('.tpproduct'); productBox.find('.current-price').text(`₹${newPrice}.00`); productBox.find('.old-price').text(`₹${newOldPrice}.00`); }); }); </script> <script> function updatePrice(selectElement, productId) { var selectedOption = selectElement.options[selectElement.selectedIndex]; var newPrice = selectedOption.getAttribute('data-price'); var newOldPrice = selectedOption.getAttribute('data-old'); // Find the price elements and update var currentPriceElement = document.querySelector('#currentPrice' + productId); var oldPriceElement = document.querySelector('#oldPrice' + productId); if (currentPriceElement && oldPriceElement) { currentPriceElement.textContent = '₹' + parseFloat(newPrice).toFixed(2); oldPriceElement.textContent = '₹' + parseFloat(newOldPrice).toFixed(2); } } </script> <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> <script> function addToCart(button, productId) { const parent = button.closest('.tpproduct'); // or appropriate wrapper if class is different const selectEl = parent.querySelector(`#weightSelect${productId}`); const unitId = selectEl ? selectEl.value : null; console.log("Selected unit ID:", unitId); if (!unitId) { Swal.fire({ icon: 'warning', title: 'Please select a unit', text: 'You must choose a unit to add the product to cart.', }); return; } fetch("../add-to-cart.php", { method: "POST", headers: { "Content-Type": "application/x-www-form-urlencoded", }, body: `product_id=${productId}&unit_id=${unitId}` }) .then(res => res.json()) .then(data => { if (data.status === 'success') { Swal.fire({ icon: 'success', title: 'Added to cart!', text: 'Product has been added to your cart.', timer: 2000, showConfirmButton: false }); } else if (data.status === 'login_required') { // Redirect to login with message parameter window.location.href = "../log-in.php?message=login_required"; } else { Swal.fire({ icon: 'error', title: 'Error', text: 'Something went wrong. Please try again.', }); } }); } </script> <!-- add to wishlist script --> <script> function addOrRemoveFromWishlist(productId) { fetch('../add-to-wishlist.php', { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, body: 'product_id=' + encodeURIComponent(productId) }) .then(res => res.json()) .then(data => { if (data.status === 'added') { Swal.fire('Added!', 'Product added to wishlist.', 'success').then(() => { location.reload(); }); } else if (data.status === 'removed') { Swal.fire('Removed!', 'Product removed from wishlist.', 'success').then(() => { location.reload(); }); } else if (data.status === 'login_required') { // Redirect to login with message parameter window.location.href = "../log-in.php?message=login_required"; } else { Swal.fire('Error', 'Something went wrong.', 'error'); return; } // Toggle heart icon style document.querySelectorAll(`[onclick="addOrRemoveFromWishlist(${productId})"]`).forEach(el => { el.classList.toggle('wishlist-active'); }); }) .catch(err => { console.error(err); Swal.fire('Error', 'Network error. Try again later.', 'error'); }); } </script> <!-- JS here --> <script src="../assets/js/jquery.js"></script> <script src="../assets/js/waypoints.js"></script> <script src="../assets/js/bootstrap.bundle.min.js"></script> <script src="../assets/js/swiper-bundle.js"></script> <script src="../assets/js/nice-select.js"></script> <script src="../assets/js/slick.js"></script> <script src="../assets/js/magnific-popup.js"></script> <script src="../assets/js/counterup.js"></script> <script src="../assets/js/wow.js"></script> <script src="../assets/js/isotope-pkgd.js"></script> <script src="../assets/js/imagesloaded-pkgd.js"></script> <script src="../assets/js/countdown.js"></script> <script src="../assets/js/ajax-form.js"></script> <script src="../assets/js/jquery-ui.js"></script> <script src="../assets/js/meanmenu.js"></script> <script src="../assets/js/main.js"></script> </body> </html>
Simpan