관리-도구
편집 파일: userall.php
<?php include 'connection.php'; ?> <!DOCTYPE html> <html lang="en"> <head> <title>Product</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!--===============================================================================================--> <link rel="icon" type="image/png" href="images/icons/favicon.png" /> <!--===============================================================================================--> <link rel="stylesheet" type="text/css" href="vendor/bootstrap/css/bootstrap.min.css"> <!--===============================================================================================--> <link rel="stylesheet" type="text/css" href="fonts/font-awesome-4.7.0/css/font-awesome.min.css"> <!--===============================================================================================--> <link rel="stylesheet" type="text/css" href="fonts/iconic/css/material-design-iconic-font.min.css"> <!--===============================================================================================--> <link rel="stylesheet" type="text/css" href="fonts/linearicons-v1.0.0/icon-font.min.css"> <!--===============================================================================================--> <link rel="stylesheet" type="text/css" href="vendor/animate/animate.css"> <!--===============================================================================================--> <link rel="stylesheet" type="text/css" href="vendor/css-hamburgers/hamburgers.min.css"> <!--===============================================================================================--> <link rel="stylesheet" type="text/css" href="vendor/animsition/css/animsition.min.css"> <!--===============================================================================================--> <link rel="stylesheet" type="text/css" href="vendor/select2/select2.min.css"> <!--===============================================================================================--> <link rel="stylesheet" type="text/css" href="vendor/daterangepicker/daterangepicker.css"> <!--===============================================================================================--> <link rel="stylesheet" type="text/css" href="vendor/slick/slick.css"> <!--===============================================================================================--> <link rel="stylesheet" type="text/css" href="vendor/MagnificPopup/magnific-popup.css"> <!--===============================================================================================--> <link rel="stylesheet" type="text/css" href="vendor/perfect-scrollbar/perfect-scrollbar.css"> <!--===============================================================================================--> <link rel="stylesheet" type="text/css" href="css/util.css"> <link rel="stylesheet" type="text/css" href="css/main.css"> <link rel="stylesheet" type="text/css" href="css/style.css"> <link rel="stylesheet" type="text/css" href="css/responsive.css"> <!--===============================================================================================--> </head> <body class="animsition"> <!-- Header --> <?php include 'userheader.php'; ?> <!-- Cart --> <?php include 'cart-side.php' ?> <?php; $cat=$_GET['cat']; $msct=$_GET['mscat']; ?> <!-- Product --> <div class="bg0 m-t-63 p-b-50" style="margin-top:100px"> <!-- Load all products initially --> <!-- Category buttons for filtering --> <div class="flex-w flex-l-m filter-tope-group m-tb-10"> <?php // Fetch and display category buttons $sql = "SELECT DISTINCT category.cat_id, subcategory.subcat_id, subcategory.subcategory FROM category LEFT JOIN subcategory ON category.cat_id = subcategory.cat_id"; $result = $conn->query($sql); if ($result->num_rows > 0) { while ($row = $result->fetch_assoc()) { $subcategory_id = $row['subcat_id']; $subcategory_name = $row['subcategory']; if ($subcategory_name !== null) { echo '<button class="subcategory-btn stext-106 cl6 hov1 bor3 trans-04 m-r-32 m-tb-5" data-subcatid="' . $subcategory_id . '">' . $subcategory_name . '</button>'; } } } ?> </div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <script> $(document).ready(function() { $('.subcategory-btn').click(function() { var subcat_id = $(this).data('subcatid'); $.ajax({ type: 'GET', url: 'fetch_products.php', data: { subcat_id: subcat_id }, success: function(response) { $('#productDisplay').html(response); }, error: function(xhr, status, error) { console.error(error); } }); }); }); </script> <div class="row isotope-grid" id="productDisplay"> <?php // Display all products initially without any category filter $all_products = "SELECT * FROM product"; $all_res = select($all_products); foreach ($all_res as $row) { ?> <div style="width: 50%;" class="col-12 col-sm-6 col-md-6 col-lg-4 col-xl-3 p-b-35 isotope-item <?php echo $row['subcat_id'] ?>"> <!-- Block2 --> <div class="block2"> <div class="block2-pic hov-img0"> <img src="uploads/<?php echo $row['product_image'] ?>" alt="IMG-PRODUCT"> <a href="product-details.php?id=<?php echo $row['product_id']; ?>&pname=<?php echo $row['product_name'];?>&rate=<?php echo $row['product_price'];?>&cid=<?php echo $row['cat_id'];?>" class="block2-btn flex-c-m stext-103 cl2 size-102 bg0 bor2 hov-btn1 p-lr-15 trans-04"> View </a> </div> <div class="block2-txt flex-w flex-t p-t-14"> <div class="block2-txt-child1 flex-col-l"> <a href="product-details.html" class="stext-104 cl4 hov-cl1 trans-04 js-name-b2 p-b-6"> <?php echo $row['product_name'] ?> </a> <span class="stext-105 cl3"> ₹<?php echo $row['product_price'] ?> </span> </div> <div class="block2-txt-child2 flex-r p-t-3"> <a href="#" class="btn-addwish-b2 dis-block pos-relative js-addwish-b2"> <img class="icon-heart1 dis-block trans-04" src="images/icons/icon-heart-01.png" alt="ICON"> <img class="icon-heart2 dis-block trans-04 ab-t-l" src="images/icons/icon-heart-02.png" alt="ICON"> </a> </div> </div> </div> </div> <?php } ?> </div> </div> </div> <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> <!-- Footer --> <?php include 'userfooter.php' ?> </body> </html>