<?php
include_once("include/main.inc.php");
$hover = 'category';
@extract($_REQUEST);
if (preg_match('webpulse\.co$/', $_SERVER['HTTP_HOST'], $match)) {
    $match1 = $match[1];
    $vanity_url = 'http://' . $_SERVER['HTTP_HOST'];
}
$actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";
$urlarray = explode('/', $actual_link);
array_splice($urlarray, 3, 0, 'amp');
$amp_url = implode("/", $urlarray);

// if (is_mobile()) {
//   header("Location: " . $amp_url);
//   exit();
// }

$ee = explode('/', $actual_link);
$mm = $ee[3];
$ss = explode('.', $mm);
$cc = $ss[0];
$cat_url = $cc;
$cat = str_replace("-", " ", $cc);
$cats = ucfirst($cat);
$cat_s = "select catName, catID from category_tbl where catName='$cats' or catUrl='$cat_url'";
$cat_q = mysqli_query($GLOBALS['dbconn'], $cat_s);
$product_idss = end(explode('-', $cc));
$sql_latest = mysqli_query($dbconn, "select product_image,product_title,catalog,product_id,product_video,product_specfi,product_name,product_cat from product_tbl where product_id='$product_idss'");

if (mysqli_num_rows($cat_q) > 0) {
} elseif (mysqli_num_rows($sql_latest) > 0) {
    include "product-details.php";
    exit;
} else {
    header("Location: " . site_url);
    exit;
}

$num = mysqli_num_rows($cat_q);
$cat_r = mysqli_fetch_array($cat_q);
$category_id = $cat_r['catID'];
$hover = $category_id;
$catn = $cat_r['catName'];
$cat_sql = "select catImage, catName, displayName, catDesc, catID, catDesc1, parentID,catUrl from category_tbl where parentID='$category_id' and status='Y'";
$cat_qry = mysqli_query($GLOBALS['dbconn'], $cat_sql);
$cccnum = mysqli_num_rows($cat_qry);
$cat_sql1 = "select catName, displayName, catID, parentID,catImage,catDesc1,catBanner,keyword1,keyword2,keyword3,catHeading1, catHeading2,alt,pageTitle,pageKeywords,pageDescription,multi_image,catDesc2 from category_tbl where catID='$category_id'";
$cat_qry1 = mysqli_query($GLOBALS['dbconn'], $cat_sql1);
$cat_res = mysqli_fetch_array($cat_qry1);
$pageTitles = $cat_res['catName'];
$disTitles = $cat_res['displayName'];
$pdes = $cat_res['catDesc'];
$page_desc = $cat_res['catDesc1'];
$page_desc = str_ireplace('{companyName}', $admin_res['companyName'], $page_desc);
$page_desc1 = $cat_res['catDesc2'];
$page_desc1 = str_ireplace('{companyName}', $admin_res['companyName'], $page_desc1);
$parent = $cat_res['parentID'];
$cat_sql2 = "select catName, displayName, catID, parentID from category_tbl where catID='$parent'";
$cat_qry2 = mysqli_query($GLOBALS['dbconn'], $cat_sql2);
$num2 = mysqli_num_rows($cat_qry2);
$cat_res2 = mysqli_fetch_array($cat_qry2);
$mparent = $cat_res2['parentID'];
$cat_sql3 = "select catName, displayName, catID, parentID from category_tbl where catID='$mparent'";
$cat_qry3 = mysqli_query($GLOBALS['dbconn'], $cat_sql3);
$num3 = mysqli_num_rows($cat_qry3);
$cat_res3 = mysqli_fetch_array($cat_qry3);
$mmparent = $cat_res3['parentID'];
$cat_sql4 = "select catName, displayName, catID, parentID from category_tbl where catID='$mmparent'";
$cat_qry4 = mysqli_query($GLOBALS['dbconn'], $cat_sql4);
$num4 = mysqli_num_rows($cat_qry4);
$cat_res4 = mysqli_fetch_array($cat_qry4);
$mobile = $admin_res['mobile'];
$city = $admin_res['city'];
$state = $admin_res['state'];
$country = $admin_res['country'];
$companyName = $admin_res['companyName'];
$address = $admin_res['address'];
$multi_image = explode(',', $cat_res['multi_image']);

if ($cat_res['catImage'] != '') {
    $imglink = getImage($cat_res[catImage], 420, 630, $cat_res[catName], "/uploaded-files/category/images/");
} else {
    $imglink = getImage("noimage.jpg", 420, 630, "noimages", "/uploaded-files/category/images/");
}

if ($cat_res['keyword1'] != '' && $cat_res['keyword2'] != '' && $cat_res['keyword3'] != '') {
    // echo "3";
    // exit;

    $m_title = "hotkeyword1 Manufacturers in state, hotkeyword2 Suppliers Importers in country";
    $page_metatitle = str_replace('hotkeyword1', $cat_res['keyword1'], str_replace('hotkeyword2', $cat_res['keyword2'],  str_replace('state', $admin_res[targetlocation], str_replace('country', $admin_res[country], $m_title))));

    $m_keyword = "hotkeyword1, hotkeyword2, hotkeyword1 Manufacturers, hotkeyword2 Manufacturers, hotkeyword1 Suppliers, hotkeyword2 Suppliers, hotkeyword1 Importers, hotkeyword2 Importers, hotkeyword1 Manufacturers in state, hotkeyword2 Suppliers in country, hotkeyword2 Importers in country";
    $page_metakey = str_replace('hotkeyword1', $cat_res['keyword1'], str_replace('hotkeyword2', $cat_res['keyword2'], str_replace('hotkeyword3', $cat_res['keyword3'], str_replace('state', $admin_res[targetlocation], str_replace('country', $admin_res[country], $m_keyword)))));

    $m_desc = "companyName leading hotkeyword1 Manufacturers in state, Since 2016. Premium Quality hotkeyword2 Suppliers Importers in country, Get latest factory price for hotkeyword3. ✓Fast Delivery ✓Good Price ✓Premium Quality";
    $page_metadesc = str_replace('hotkeyword1', $cat_res['keyword1'], str_replace('hotkeyword2', $cat_res['keyword2'], str_replace('companyName', $admin_res[companyName], str_replace('phone', $admin_res[mobile_meta], str_replace('hotkeyword3', $cat_res['keyword3'], str_replace('state', $admin_res[targetlocation], str_replace('country', $admin_res[country], $m_desc)))))));
} else if ($cat_res['keyword1'] != '' && $cat_res['keyword2'] != '') {
    // echo "2";
    // exit;

    $m_title = "hotkeyword1 Manufacturers in state, hotkeyword2 Suppliers Importers in country";
    $page_metatitle = str_replace('hotkeyword1', $cat_res['keyword1'], str_replace('hotkeyword2', $cat_res['keyword2'],  str_replace('state', $admin_res[targetlocation], str_replace('country', $admin_res[country], $m_title))));

    $m_keyword = "hotkeyword1, hotkeyword2, hotkeyword1 Manufacturers, hotkeyword2 Manufacturers, hotkeyword1 Suppliers, hotkeyword2 Suppliers, hotkeyword1 Importers, hotkeyword2 Importers, hotkeyword1 Manufacturers in state, hotkeyword2 Suppliers in country, hotkeyword2 Importers in country";
    $page_metakey = str_replace('hotkeyword1', $cat_res['keyword1'], str_replace('hotkeyword2', $cat_res['keyword2'],  str_replace('state', $admin_res[targetlocation], str_replace('country', $admin_res[country], $m_keyword))));

    $m_desc = "companyName leading hotkeyword1 Manufacturers in state, since 2016. Premium Quality hotkeyword2 Suppliers Importers in country, Get latest factory price for hotkeyword1. ✓Fast Delivery ✓Good Price";
    $page_metadesc = str_replace('hotkeyword1', $cat_res['keyword1'], str_replace('hotkeyword2', $cat_res['keyword2'], str_replace('companyName', $admin_res[companyName], str_replace('phone', $admin_res[mobile_meta], str_replace('state', $admin_res[targetlocation], str_replace('country', $admin_res[country], $m_desc))))));
} else if ($cat_res['keyword1'] != '') {
    // echo "1";
    // exit;

    $m_title = "hotkeyword1 Manufacturers in state, hotkeyword1 Suppliers Importers in country";
    $page_metatitle = str_replace('hotkeyword1', $cat_res['keyword1'], str_replace('state', $admin_res[targetlocation], str_replace('country', $admin_res[country], $m_title)));

    $m_keyword = "hotkeyword1 in state, hotkeyword1 Manufacturers state, hotkeyword1 Suppliers in country, hotkeyword1 Importers in country";
    $page_metakey = str_replace('hotkeyword1', $cat_res['keyword1'], str_replace('state', $admin_res[targetlocation], str_replace('country', $admin_res[country], $m_keyword)));

    $m_desc = "companyName leading hotkeyword1 Manufacturers in state, Since 2016. Premium Quality hotkeyword1 Suppliers Importers in country, Get latest factory price for hotkeyword1. ✓Fast Delivery ✓Good Price ✓Premium Quality";
    $page_metadesc = str_replace('hotkeyword1', $cat_res['keyword1'], str_replace('companyName', $admin_res[companyName], str_replace('phone', $admin_res[mobile_meta], str_replace('state', $admin_res[targetlocation], str_replace('country', $admin_res[country], $m_desc)))));
} else {

    // echo "0";
    // exit;

    $page_metatitle = $cat_res['pageTitle'];
    $page_metakey = $cat_res['pageKeywords'];
    $page_metadesc = $cat_res['pageDescription'];
}

// if ($cat_res['catHeading1'] != '') {
//     $heading1 = $cat_res['catHeading1'] . ' Manufacturers';
// } else {
//     $heading1 = $disTitles . ' Manufacturers';
// }

// if ($cat_res['catHeading2'] != '') {
//     $heading2 = $cat_res['catHeading2'] . '<span> Manufacturers in ' . $admin_res['targetlocation'] . '</span>';
// } else {
//     $heading2 = $disTitles . '<span> Manufacturers in ' . $admin_res['targetlocation'] . '</span>';
// }

// if ($cat_res['alt'] != '') {
//     $alttag = $cat_res['alt'] . ' Manufacturers in ' . $admin_res['targetlocation'];
// } else {
//     $alttag = $disTitles . ' Manufacturers in ' . $admin_res['targetlocation'];
// }

if ($cat_res['catID'] == 8) {
    $label1 = 'Services'; 
    $label2 = 'Service'; 
} else {
    $label1 = 'Manufacturers';
    $label2 = 'Manufacturers';
}

if ($cat_res['catHeading1'] != '') {
    $heading1 = $cat_res['catHeading1'] . ' ' . $label1;
} else {
    $heading1 = $disTitles . ' ' . $label1;
}

if ($cat_res['catHeading2'] != '') {
    $heading2 = $cat_res['catHeading2'] . '<span> ' . $label2 . ' in ' . $admin_res['targetlocation'] . '</span>';
} else {
    $heading2 = $disTitles . '<span> ' . $label2 . ' in ' . $admin_res['targetlocation'] . '</span>';
}

if ($cat_res['alt'] != '') {
    $alttag = $cat_res['alt'] . ' ' . $label2 . ' in ' . $admin_res['targetlocation'];
} else {
    $alttag = $disTitles . ' ' . $label2 . ' in ' . $admin_res['targetlocation'];
}

?>

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <?php include "app_top.php"; ?>
</head>

<body>

    <?php include "app_header.php"; ?>

    <section class="heading_banner" style="background-image: url(<?= site_url; ?>/designer/images/about-banner.jpg)">
        <div class="container">
            <div class="row">
                <div class="col-xxl-12 col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12 text-center">
                    <h1 class="cat_title"><?= $heading1; ?></h1>
                </div>
            </div>
        </div>
    </section>

    <div class="inner_breadcrumb hidden_xs">
        <div class="container">
            <div class="row">
                <div class="col-xxl-12 col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12">
                    <ul class="breadcrumb">
                        <li><a href="<?= site_url; ?>" title="Home">Home</a></li>
                        <?php if ($num4 > 0) { ?>
                            <li>
                                <a href="<?= site_url; ?>/<?= getValidFileName($cat_res4['catName']); ?>.htm"
                                    title="<?php echo $cat_res4['catName']; ?>"><?php echo $cat_res4['catName']; ?></a>
                            </li>
                        <?php } ?>

                        <?php if ($num3 > 0) { ?>
                            <li>
                                <a href="<?= site_url; ?>/<?= getValidFileName($cat_res3['catName']); ?>.htm"
                                    title="<?php echo $cat_res3['catName']; ?>"><?php echo $cat_res3['catName']; ?></a>
                            </li>
                        <?php } ?>

                        <?php if ($num2 > 0) { ?>
                            <?php if ($cat_res2['catID'] == '0') { ?>
                                <li>
                                    <a href="<?= site_url; ?>/<?= getValidFileName($cat_res2['catName']); ?>.htm"
                                        title="<?php echo $cat_res2['catName']; ?>"><?php echo $cat_res2['catName']; ?></a>
                                </li>
                            <?php } else {  ?>

                                <li>
                                    <a href="javascript:void(0);"
                                        title="<?php echo $cat_res2['catName']; ?>"><?php echo $cat_res2['catName']; ?></a>
                                </li>
                        <?php  }
                        } ?>
                        <li class="active"><?php echo $cat_res['catName']; ?></li>
                    </ul>
                </div>
            </div>
        </div>
    </div>

    <section class="category_page">
        <div class="container">
            <div class="right_side">
                <h2 class="title_h2"><?= $heading2; ?></h2>
                <div class="wps_right">
                    <div class="product_right_image">
                        <a href="javascript:void(0);" data-bs-toggle="modal" data-bs-target="#productID"
                            onclick="$('.catID').val('<?php echo $cat_res['catID']; ?>');  
                     $('.catName').html('<?php echo $cat_res['catName']; ?>'); 
                     $('.catImg').attr('src','<?= $imglink; ?>');  
                     $('.catImg').attr('alt','<?= $alttag; ?>'); 
                     $('.catImg').attr('title','<?= $alttag; ?>');" title="Get Best Quote">
                            <div class="detail_image">
                                <img class="img-responsive" src="<?= $imglink; ?>" alt="<?= $alttag; ?>" title="<?= $alttag; ?>">
                            </div>
                            <span class="read_more_btn_2"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
                                    <path d="M.05 3.555A2 2 0 0 1 2 2h12a2 2 0 0 1 1.95 1.555L8 8.414.05 3.555ZM0 4.697v7.104l5.803-3.558L0 4.697ZM6.761 8.83l-6.57 4.027A2 2 0 0 0 2 14h12a2 2 0 0 0 1.808-1.144l-6.57-4.027L8 9.586l-1.239-.757Zm3.436-.586L16 11.801V4.697l-5.803 3.546Z"></path>
                                </svg> Get Best Quote</span>
                        </a>
                    </div>
                    <?php echo html_entity_decode($page_desc); ?>



                    <?php
$limit = 8;

// Total image count for this category
$total_sql = mysqli_query($GLOBALS['dbconn'], "SELECT COUNT(*) AS total FROM catgallery_tbl WHERE FIND_IN_SET('" . $cat_res['catID'] . "', gallery_cat)");
$total_res = mysqli_fetch_assoc($total_sql);
$total_images = $total_res['total'];

// Initial 8 images
$certificate_sql = mysqli_query($GLOBALS['dbconn'], "SELECT * FROM catgallery_tbl WHERE FIND_IN_SET('" . $cat_res['catID'] . "', gallery_cat) ORDER BY id ASC LIMIT $limit");
?>

<div id="gallery-section" class="row g-3 row-cols-1 row-cols-md-2 row-cols-lg-4 mb-4">
    <?php while($catlog_stand = mysqli_fetch_assoc($certificate_sql)){ ?>
        <div class="col gallery-item">
            <div class="gallery-bx">
                <a data-fancybox="" href="<?=site_url;?>/uploaded-files/cat-gallery/<?=$catlog_stand['gallery_image'];?>" 
                    title="<?= $catlog_stand['gallery_title']; ?> in <?=$admin_res['targetlocation'];?>" class="img">
                    <img src="<?=site_url;?>/uploaded-files/cat-gallery/<?=$catlog_stand['gallery_image'];?>" alt="<?= $catlog_stand['gallery_title']; ?> in <?=$admin_res['targetlocation'];?>" title="<?= $catlog_stand['gallery_title']; ?> in <?=$admin_res['targetlocation'];?>">
                </a>
            </div>
        </div>
    <?php } ?>
</div>

<?php if($total_images > $limit){ ?>
    <div class="text-center mt-3">
        <button id="loadMoreBtn" class="btn btn-primary">View More</button>
        <div id="loader" style="display:none;">Loading...</div>
    </div>
<?php } ?>

<script>
  const targetLocation = "<?= isset($admin_res['targetlocation']) ? $admin_res['targetlocation'] : (isset($locationName) ? $locationName : '') ?>";
</script>


<script>
let offset = 8;
const limit = 8;
const catID = <?= $cat_res['catID']; ?>;

$('#loadMoreBtn').click(function() {
    $('#loader').show();
    $.ajax({
        url: 'load_more_images.php',
        type: 'POST',
        data: { offset: offset, limit: limit, catID: catID, targetlocation: targetLocation },
        success: function(response) {
            if($.trim(response) != ''){
                $('#gallery-section').append(response);
                offset += limit;
            } else {
                $('#loadMoreBtn').hide();
            }
            $('#loader').hide();
        }
    });
});

</script>


                    <?php
                    $product_s = mysqli_query(
                        $GLOBALS['dbconn'],
                        "SELECT product_image, product_title, product_name, catalog, product_id, product_video, product_specfi 
     FROM product_tbl 
     WHERE FIND_IN_SET('" . $cat_res['catID'] . "', product_cat) 
     AND product_status = '1'"
                    );
                    $num = mysqli_num_rows($product_s);
                    if ($num > 0) {
                    ?>
                        <div class="you_may">Products Related to <?php echo $cat_res['catName']; ?></div>

                        <?php
                        $i = 1;
                        while ($product_r = mysqli_fetch_array($product_s)) {
                            $pro_image = explode(',', $product_r['product_image']);
                            $probig_img = $pro_image[0];
                            $prod_img = getImage($probig_img, 600, 600, $product_r['product_title'], "/uploaded-files/product-images/");
                            $prod_imgsmall = getImage($probig_img, 400, 400, $product_r['product_title'], "/uploaded-files/product-images/");
                        ?>
                            <div class="row g-3">
                                <div class="col-12">
                                    <div class="pr-li">
                                        <div class="row g-0">
                                            <div class="col-lg-4 col-md-5 col-12 g_col">
                                                <div class="img_bx">
                                                    <a class="main-img" href="#productID" data-bs-toggle="modal" title="<?= $product_r['product_title']; ?> Manufacturers in <?= $admin_res['targetlocation']; ?>">
                                                        <img id="mainImage<?= $product_r['product_id']; ?>" class="clickable-image w-100" src="<?= $prod_img; ?>" alt="<?= $product_r['product_title']; ?> Manufacturers in <?= $admin_res['targetlocation']; ?>" title="<?= $product_r['product_title']; ?> Manufacturers in <?= $admin_res['targetlocation']; ?>">
                                                    </a>
                                                    <?php if (count($pro_image) > 1 || $product_r['product_video'] != '') { ?>
                                                        <div class="multi-imgs">
                                                            <?php
                                                            $snn = 1;
                                                            foreach ($pro_image as $pro_imag_vals) {
                                                                if (!empty($pro_imag_vals)) {
                                                            ?>
                                                                    <div class="imgs <?= $snn == 1 ? 'active' : ''; ?>"
                                                                        onclick="imgMulti(<?= $product_r['product_id']; ?>, '<?= getImage($pro_imag_vals, 600, 600, $product_r['product_title'] . $product_r['product_id'] . $snn, '/uploaded-files/product-images/'); ?>', this)">
                                                                        <img src="<?= getImage($pro_imag_vals, 100, 100, $product_r['product_title'] . $product_r['product_id'] . $snn, '/uploaded-files/product-images/'); ?>" class="w-100" alt="<?= $product_r['product_title']; ?> Manufacturers in <?= $admin_res['targetlocation']; ?>" title="<?= $product_r['product_title']; ?> Manufacturers in <?= $admin_res['targetlocation']; ?>">
                                                                    </div>
                                                        <?php $snn++;
                                                                }
                                                            }
                                                        } ?>

                                                        <?php if ($product_r['product_video'] != '') { ?>
                                                            <div class="imgs youTube">
                                                                <a data-fancybox="" href="https://www.youtube.com/watch?v=<?= $product_r['product_video']; ?>" title="<?= $product_r['product_title']; ?> in <?= $admin_res['targetlocation']; ?>">
                                                                    <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
                                                                        <path d="m11.596 8.697-6.363 3.692c-.54.313-1.233-.066-1.233-.697V4.308c0-.63.692-1.01 1.233-.696l6.363 3.692a.802.802 0 0 1 0 1.393z">
                                                                        </path>
                                                                    </svg>
                                                                </a>
                                                            </div>
                                                        <?php } ?>
                                                        </div>
                                                </div>
                                            </div>
                                            <div class="col-lg-8 col-md-7 col-12 g_col">
                                                <div class="tx-bx">
                                                    <h4 class="tt text-dark"><?= $product_r['product_title']; ?></h4>
                                                    <div class="bt_bx mb-2">
                                                        <?php if ($product_r['catalog'] != '') { ?>
                                                            <div class="productBrochureandvideo">
                                                                <a href="<?= site_url; ?>/uploaded-files/pdf/<?= $product_r['catalog']; ?>" title="Product Brochure" target="_blank">
                                                                    <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-filetype-pdf" viewBox="0 0 16 16">
                                                                        <path fill-rule="evenodd" d="M14 4.5V14a2 2 0 0 1-2 2h-1v-1h1a1 1 0 0 0 1-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5L14 4.5ZM1.6 11.85H0v3.999h.791v-1.342h.803c.287 0 .531-.057.732-.173.203-.117.358-.275.463-.474a1.42 1.42 0 0 0 .161-.677c0-.25-.053-.476-.158-.677a1.176 1.176 0 0 0-.46-.477c-.2-.12-.443-.179-.732-.179Zm.545 1.333a.795.795 0 0 1-.085.38.574.574 0 0 1-.238.241.794.794 0 0 1-.375.082H.788V12.48h.66c.218 0 .389.06.512.181.123.122.185.296.185.522Zm1.217-1.333v3.999h1.46c.401 0 .734-.08.998-.237a1.45 1.45 0 0 0 .595-.689c.13-.3.196-.662.196-1.084 0-.42-.065-.778-.196-1.075a1.426 1.426 0 0 0-.589-.68c-.264-.156-.599-.234-1.005-.234H3.362Zm.791.645h.563c.248 0 .45.05.609.152a.89.89 0 0 1 .354.454c.079.201.118.452.118.753a2.3 2.3 0 0 1-.068.592 1.14 1.14 0 0 1-.196.422.8.8 0 0 1-.334.252 1.298 1.298 0 0 1-.483.082h-.563v-2.707Zm3.743 1.763v1.591h-.79V11.85h2.548v.653H7.896v1.117h1.606v.638H7.896Z">
                                                                        </path>
                                                                    </svg>
                                                                    <span>Product Brochure</span>
                                                                </a>
                                                            </div>
                                                        <?php } ?>

                                                        <?php if ($product_r['product_video'] != '') { ?>
                                                            <a href="https://www.youtube.com/watch?v=<?= $product_r['product_video']; ?>" title="<?= $product_r['product_title']; ?> in <?= $admin_res['targetlocation']; ?>" data-fancybox="" class="v-btn">
                                                                <svg version="1.1" viewBox="0 0 68 48">
                                                                    <path class="ytp-large-play-button-bg" d="M66.52,7.74c-0.78-2.93-2.49-5.41-5.42-6.19C55.79,.13,34,0,34,0S12.21,.13,6.9,1.55 C3.97,2.33,2.27,4.81,1.48,7.74C0.06,13.05,0,24,0,24s0.06,10.95,1.48,16.26c0.78,2.93,2.49,5.41,5.42,6.19 C12.21,47.87,34,48,34,48s21.79-0.13,27.1-1.55c2.93-0.78,4.64-3.26,5.42-6.19C67.94,34.95,68,24,68,24S67.94,13.05,66.52,7.74z" fill="#f00"></path>
                                                                    <path d="M 45,24 27,14 27,34" fill="#fff"></path>
                                                                </svg>
                                                            </a>
                                                        <?php } ?>
                                                    </div>
                                                    <div class="info">
                                                        <?= html_entity_decode($product_r['product_specfi']); ?>
                                                    </div>
                                                    <div class="bt_bx">
                                                        <button class="read_more_btn_2" data-bs-toggle="modal" data-bs-target="#productID"
                                                            onclick="$('.catID').val('<?= $product_r['product_id']; ?>');
                                             $('.catName').html('<?= $product_r['product_title']; ?>');
                                             $('.catImg').attr('src','<?= $prod_img; ?>');
                                             $('.catImg').attr('alt','<?= $product_r['product_title']; ?> Manufacturers in <?= $admin_res['targetlocation']; ?>');
                                             $('.catImg').attr('title','<?= $product_r['product_title']; ?> Manufacturers in <?= $admin_res['targetlocation']; ?>');"
                                                            title="Get Best Quote"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
                                                                <path d="M.05 3.555A2 2 0 0 1 2 2h12a2 2 0 0 1 1.95 1.555L8 8.414.05 3.555ZM0 4.697v7.104l5.803-3.558L0 4.697ZM6.761 8.83l-6.57 4.027A2 2 0 0 0 2 14h12a2 2 0 0 0 1.808-1.144l-6.57-4.027L8 9.586l-1.239-.757Zm3.436-.586L16 11.801V4.697l-5.803 3.546Z">
                                                                </path>
                                                            </svg> Get Best Quote</button>
                                                        <button class="read_more_btn_2 callback" data-bs-toggle="modal" data-bs-target="#callback"
                                                            onclick="$('.catID').val('<?= $product_r['product_id']; ?>');
                                             $('.catName').html('<?= $product_r['product_title']; ?>');
                                             $('.catImg').attr('src','<?= $prod_imgsmall; ?>');
                                             $('.catImg').attr('alt','<?= $product_r['product_title']; ?> Manufacturers in <?= $admin_res['targetlocation']; ?>');
                                             $('.catImg').attr('title','<?= $product_r['product_title']; ?> Manufacturers in <?= $admin_res['targetlocation']; ?>');"
                                                            title="Request A Callback">
                                                            <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-telephone-fill" viewBox="0 0 16 16">
                                                                <path fill-rule="evenodd" d="M1.885.511a1.745 1.745 0 0 1 2.61.163L6.29 2.98c.329.423.445.974.315 1.494l-.547 2.19a.68.68 0 0 0 .178.643l2.457 2.457a.68.68 0 0 0 .644.178l2.189-.547a1.75 1.75 0 0 1 1.494.315l2.306 1.794c.829.645.905 1.87.163 2.611l-1.034 1.034c-.74.74-1.846 1.065-2.877.702a18.6 18.6 0 0 1-7.01-4.42 18.6 18.6 0 0 1-4.42-7.009c-.362-1.03-.037-2.137.703-2.877z"></path>
                                                            </svg> Request A Callback</button>

                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            <?php $i++;
                        } ?>
                            </div>
                        <?php } ?>




                        <div class="you_may">All Category Range</div>
                        <div class="row g-3">
                            <?php
                            if (mysqli_num_rows($cat_qry) > 1) {
                                $subcat_sql = $cat_qry;
                            } else {

                                $subcat_sql = mysqli_query($GLOBALS['dbconn'], "select catImage, catName, displayName, catDesc, catID, catDesc1, parentID from category_tbl where parentID ='$parent' and status='Y' and catID!='$category_id' order by catOrder Asc");
                            }
                            if (mysqli_num_rows($subcat_sql) < 2) {
                                $subcat_sql = mysqli_query($GLOBALS['dbconn'], "select catImage, catName, displayName, catDesc, catID, catDesc1, parentID from category_tbl where parentID ='0' and status='Y' and catID!='$category_id' order by catOrder Asc");
                            }
                            while ($sub_res = mysqli_fetch_array($subcat_sql)) {

                                if ($sub_res['catImage'] != '') {
                                    $img_link = getImage($sub_res[catImage], 500, 500, $sub_res[catName], "/uploaded-files/category/images/");
                                    $img_link1 = getImage($sub_res[catImage], 437, 437, $sub_res[catName], "/uploaded-files/category/images/");
                                } else {
                                    $img_link = getImage("noimage.jpg",  500, 500, "noimages", "/uploaded-files/category/images/");
                                    $img_link1 = getImage("noimage.jpg", 437, 437, "noimages", "/uploaded-files/category/images/");
                                }
                                // echo $sub_res['catDesc'];
                                $sub_desc = $sub_res['catDesc'];
                                $sub_desc = str_ireplace('{companyName}', $admin_res['companyName'], $sub_desc);
                            ?>
                                <div class="col-12">
                                    <div class="pr-li">
                                        <div class="row g-0">
                                            <div class="col-lg-4 col-md-5 col-12 g_col">
                                                <div class="img_bx">
                                                    <a class="main-img" href="<?= site_url; ?>/<?= getValidFileName($sub_res['catName']); ?>.htm" data-bs-toggle="modal" data-bs-target="#productEnquiry"
                                                        onclick="$('.catID').val('<?php echo $sub_res['catID']; ?>');
                                               $('.catName').html('<?php echo $sub_res['catName']; ?>');
                                               $('.catImg').attr('src','<?= $img_link1; ?>'); 
                                               $('.catImg').attr('alt','<?= $sub_res['displayName']; ?> Manufacturers in <?= $admin_res['targetlocation']; ?>'); 
                                               $('.catImg').attr('title','<?= $sub_res['displayName']; ?> Manufacturers in <?= $admin_res['targetlocation']; ?>');"
                                                        title="<?= $sub_res['displayName']; ?> Manufacturers in <?= $admin_res['targetlocation']; ?>">
                                                        <img id="mainImage<?php echo $sub_res['catID']; ?>" src="<?= $img_link; ?>"
                                                            alt="<?= $sub_res['displayName']; ?> Manufacturers in <?= $admin_res['targetlocation']; ?>"
                                                            title="<?= $sub_res['displayName']; ?> Manufacturers in <?= $admin_res['targetlocation']; ?>">
                                                    </a>
                                                </div>
                                            </div>
                                            <div class="col-lg-8 col-md-7 col-12 g_col">
                                                <div class="tx-bx">
                                                    <h4 class="tt"><a href="<?= site_url; ?>/<?= getValidFileName($sub_res['catName']); ?>.htm"
                                                            title="<?= $sub_res['displayName']; ?> Manufacturers in <?= $admin_res['targetlocation']; ?>"><?= $sub_res['displayName']; ?></a></h4>
                                                    <div class="info">
                                                        <p><?= substr($sub_desc, 0, 3000); ?></p>
                                                    </div>
                                                    <div class="bt_bx">
                                                        <a class="read_more_btn_2" href="<?= site_url; ?>/<?= getValidFileName($sub_res['catName']); ?>.htm"
                                                            title="Read More">Read More</a>
                                                        <button class="read_more_btn_2 callback" data-bs-toggle="modal" data-bs-target="#productID"
                                                            onclick="$('.catID').val('<?php echo $sub_res['catID']; ?>');
                             $('.catName').html('<?php echo $sub_res['catName']; ?>');
                             $('.catImg').attr('src','<?= $img_link1; ?>'); 
                             $('.catImg').attr('alt','<?= $sub_res['displayName']; ?> Manufacturers in <?= $admin_res['targetlocation']; ?>'); 
                             $('.catImg').attr('title','<?= $sub_res['displayName']; ?> Manufacturers in <?= $admin_res['targetlocation']; ?>');"
                                                            title="Get Best Quote"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
                                                                <path d="M.05 3.555A2 2 0 0 1 2 2h12a2 2 0 0 1 1.95 1.555L8 8.414.05 3.555ZM0 4.697v7.104l5.803-3.558L0 4.697ZM6.761 8.83l-6.57 4.027A2 2 0 0 0 2 14h12a2 2 0 0 0 1.808-1.144l-6.57-4.027L8 9.586l-1.239-.757Zm3.436-.586L16 11.801V4.697l-5.803 3.546Z">
                                                                </path>
                                                            </svg> Get Best Quote</button>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            <?php } ?>



                        </div>
                </div>
            </div>
        </div>
    </section>
    <script>
        function imgMulti(id, url, elm) {
            document.getElementById(`mainImage${id}`).src = url;
            $(elm).addClass('active').siblings().removeClass('active');
        }
    </script>

<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>


    <?php include "app_footer.php"; ?>
    <?php include "app_bottom.php"; ?>

</body>

</html>