<?php include_once("assets/include/header.php") ?>

<?php
$slug = $_GET['slug'];
//echo $slug;
// exit;
$mid = mysqli_query($conn, "SELECT * FROM `tbl_top_category` where slug='$slug'");
while ($rowd = mysqli_fetch_array($mid)) {
    $mid_id = $rowd['tcat_id'];
    $mcat_name = $rowd['tcat_name'];
}
?>
<div class="c-section product-bg mt-0">
    <div class="container">
        <div class="row justify-content-center">
            <div class="col-lg-12">
                <div class="our-product">
                    <div class="row justify-content-center text-center align-items-center">
                        <div class="col-md-8">

                            <h1><?php echo $mcat_name; ?></h1>
                            <div class="product-tag mb-2 text-center">
                                <span class="d-block"><i class="fa-solid fa-fire text-light"></i> Innovative Solutions
                                    for Fire
                                    Safety Needs.</span>
                            </div>
                        </div>
                        <!-- <div class="col-md-4" style="text-align:end">
                                    <h6 class="m-0 text-dark  view-tag"><i class="fa-solid fa-fire"></i> View All</h6>
                                </div> -->
                    </div>
                </div>

                <!-- ------------------- -->



                <div class="row justify-content-center">
                    <div class="col-md-12">

                        <div class="d-block d-md-flex produc-cards mt-5 justify-content-start prod-cat">
                            <?php
                            if ($slug = 'flower') {
                                $pro = mysqli_query($conn, "SELECT * FROM tbl_product where top_id='$mid_id'");
                                while ($rok = mysqli_fetch_array($pro)) {
                                    $name = $rok['p_name'];
                                    $p_id = $rok['p_id'];
                                    $p_old_price = $rok['p_old_price'];
                                    $p_current_price = $rok['p_current_price'];
                                    $sku = $rok['p_sku'];
                                    ?>
                                    <!-- ----------card-- -->
                                    <div class="product-card-child">
                                        <div class="product-card-icon mb-3">
                                            <i class="fa-solid fa-fire-extinguisher"></i>
                                        </div>
                                        <div class="product-card-heading mt-3">
                                            <h1 class="mb-1"><?php echo $name; ?></h1>
                                            <p>INR <?php echo $p_current_price; ?> <span class="text-dark"><strike>INR
                                                        <?php echo $p_old_price; ?></strike></span></p>
                                        </div>
                                        <?php
                                        $photo = mysqli_query($conn, "SELECT * FROM `tbl_product_photo` where p_id='$p_id'");
                                        while ($roh = mysqli_fetch_array($photo)) {
                                            $img = $roh['photo'];
                                        }
                                        ?>
                                        <div class="product-card-img">
                                            <img src="<?php path(); ?>/admin/assets/images/product-image/<?php echo $img; ?>"
                                                alt="">
                                        </div>
                                        <div class="product-btn">
                                            <a href="<?php path(); ?>product-single.php/<?php echo $slug; ?>" class="">View
                                                product</a>
                                        </div>

                                    </div>
                                    <?php
                                }

                            }

                            ?>
                            <!-- --------card---- -->


                        </div>

                    </div>

                </div>
                <!-- ------------------- -->

            </div>

        </div>
    </div>
</div>


<!-- our-product-page-end -->
</div>
<?php include_once("assets/include/footer.php") ?>
</body>

</html>