<?php
include_once("include/main.inc.php");
session_start();
$sesion = session_id();
@extract($_GET);
@extract($_POST);
@extract($_REQUEST);
$chunk = $_REQUEST['keyword'];
$chunk = substr($chunk, 0, 5);
if (!empty($keyword)) {
  $query = "SELECT * FROM category_tbl WHERE (catName LIKE '%" . $keyword . "%' 
            OR catName LIKE '%" . $chunk . "%' 
            OR displayName LIKE '%" . $chunk . "%') 
            AND status='1'";
} else {
  $query = "SELECT * FROM category_tbl order by catID desc";
}

$sql_dds = mysqli_query($GLOBALS['dbconn'], $query);
$wnum = mysqli_num_rows($sql_dds);
$page_metatitle = "Top Isopure Whey Protein Suppliers in Haryana, India | Pahal Nutrition Private Limited";
$page_metakey = "Isopure Whey Protein Suppliers in Haryana, Best Whey Protein in Haryana, Isopure Protein Powder Dealers, Whey Protein Distributors Haryana, Fitness Supplements Haryana, Isopure Products India, Isopure Protein Haryana, Isopure Nutrition Products";
$page_metadesc = "Discover top-quality fitness products from trusted Isopure Whey Protein Suppliers in Haryana, India at Pahal Nutrition Private Limited. We offer premium-grade supplements designed for effective muscle growth, recovery, and performance enhancement across India.";
?>
<!DOCTYPE html>
<html lang="en">

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

<body>
  <?php include 'app_header.php'; ?>
  <div class="breadcum-sec" style="background-image: url(<?= site_url; ?>/designer/images/category-banner.jpg);">
    <div class="container">
      <h1 class="main-tt">Search</h1>
      <ul>
        <li><a href="<?= site_url; ?>">Home</a></li>
        <li>Search</li>
      </ul>
    </div>
  </div>
  <div class="section">
    <div class="container">
      <div class="head-sec">
        <div class="tt">Search Result For <span>"<?php echo "  " . $keyword . " (" . $wnum . ") "; ?>"</span></div>
      </div>
      <div class="row g-3">
        <?php
        $num = mysqli_num_rows($sql_dds);
        if ($num > 0) {
          while ($row = mysqli_fetch_array($sql_dds)) {
            if ($row['catImage'] != '') {
              $img_link = getImage($row[catImage], 500, 500, $row[catName], "/uploaded-files/category/images/");
              $img_link1 = getImage($row[catImage], 500, 500, $row[catName], "/uploaded-files/category/images/");
            } else {
              $img_link = NO_IMG_URL;
              $img_link1 = NO_IMG_URL;
            }
            $sub_desc = $row['catDesc'];
            $sub_desc = str_ireplace('{companyName}', $admin_res['companyName'], $sub_desc);
        ?>
            <div class="col-lg-3 col-md-4 col-12">
              <div class="pro-bx">
                <a href="<?= site_url; ?>/<?= getValidFileName($row['catName']); ?>.htm" class="img" title="<?= $row['displayName']; ?> Suppliers in <?= $admin_res['targetlocation']; ?>">
                  <img src="<?= $img_link; ?>" alt="<?= $row['displayName']; ?> Suppliers in <?= $admin_res['targetlocation']; ?>" title="<?= $row['displayName']; ?> Suppliers in <?= $admin_res['targetlocation']; ?>">
                </a>
                <div class="tx-bx">
                  <a href="<?= site_url; ?>/<?= getValidFileName($row['catName']); ?>.htm" class="tt" title="<?= $row['displayName']; ?>"><?= $row['displayName']; ?></a>
                  <div class="d-flex gap-1 flex-wrap justify-content-center">
                    <button class="main-btn" type="button" data-bs-toggle="modal" data-bs-target="#productEnquiry" onclick="$('.catID').val('<?php echo $row['catID']; ?>');
                                             $('.catName').html('<?php echo $row['catName']; ?>');
                                             $('.catImg').attr('src','<?= $img_link1; ?>'); 
                                             $('.catImg').attr('alt','<?= $row['displayName']; ?> Suppliers in <?= $admin_res['targetlocation']; ?>'); 
                                             $('.catImg').attr('title','<?= $row['displayName']; ?> Suppliers in <?= $admin_res['targetlocation']; ?>');"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-envelope" viewBox="0 0 16 16">
                        <path d="M0 4a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2zm2-1a1 1 0 0 0-1 1v.217l7 4.2 7-4.2V4a1 1 0 0 0-1-1zm13 2.383-4.708 2.825L15 11.105zm-.034 6.876-5.64-3.471L8 9.583l-1.326-.795-5.64 3.47A1 1 0 0 0 2 13h12a1 1 0 0 0 .966-.741M1 11.105l4.708-2.897L1 5.383z"></path>
                      </svg> Get a Quote</button>
                  </div>
                </div>
              </div>
            </div>
        <?php }
                                } else { ?>
                                <div class="col-12">
                                    <div style="text-align:center;">
                                        <div class="alert alert-danger" style="display: inline-block;width: 600px;">
                                            <strong>You Search for "<u><?= $keyword; ?></u>" Not Matched, Please Try
                                                with Another Keywords</strong>
                                        </div>
                                    </div>
                                </div>
                                <?php } ?>
      </div>
    </div>
  </div>

  <?php include 'app_footer.php'; ?>
  <?php include 'app_bottom.php'; ?>
</body>

</html>