<?php session_start();
$country_name = ($_REQUEST['country']);
   require_once("./config/config.php");
    $limit =12;  
       if (isset($_GET["page"])) { 
         $pn  = $_GET["page"]; 
       } 
       else { 
         $pn=1; 
       };  
     
       $start_from = ($pn-1) * $limit;  

       $sql_tag = "SELECT * FROM meta_tag_setting WHERE pages = 'view-all-product'";
       $mydara_sql = $conn->query($sql_tag);
       $fetch_tag = $mydara_sql->fetchAll();
       $rows_tag =$mydara_sql->rowCount();
       
       if($rows_tag !=0 ){
          foreach( $fetch_tag  as $rowcon ) {
             $title = $rowcon['title'];
             $description  = $rowcon['description'];
             $keyword = $rowcon['keyword'];
          }
       }

       // This is a code for php minifiers Begin

ob_start("minifier");
function minifier($code) {
    $search = array(
         
        // Remove whitespaces after tags
        '/\>[^\S ]+/s',
         
        // Remove whitespaces before tags
        '/[^\S ]+\</s',
         
        // Remove multiple whitespace sequences
        '/(\s)+/s',
         
        // Removes comments
        '/<!--(.|\s)*?-->/'
    );
    $replace = array('>', '<', '\\1');
    $code = preg_replace($search, $replace, $code);
    return $code;
}

// This is a code for php minifiers End
   ?>
<!DOCTYPE html>
<html lang="en">
   <head>
      <!-- Character set configuration -->
      <meta charset="UTF-8" />
      <title><?=$title?></title>
      <base href="<?=$base_link?>">
      <meta http-equiv="X-UA-Compatible" content="IE=edge" />
      <link id="favicon" rel="icon" type="image/x-icon" href="images/web-images/home/favicon.png"/>
      <meta name="robots" content="index, follow" />
      <link rel="canonical" href="view-all-product.php"/>
      <meta name="description" content="<?=$description?>">
      <meta name="keywords" content="<?=$keyword?>">
      <!-- Viewport configuration, scaling options -->
     <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"/>

      <!-- CSS Stylesheet -->
      <link href="css/icouponworld.css" rel="stylesheet" />
      <!-- Font Awesome icon -->
      <link href="fontawesome/css/fontawesome.css" rel="stylesheet" />
      <!-- Google Analytics Code Begin-->
      <?=$google_ana ?>
      <!-- Google Analytics Code End-->
      <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
      <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
      <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
      <![endif]-->
   </head>
   <body>
         <!-- Preloader Begin-->
         <div class="preloader">
         <div class="loading">
            <img src="images/web-images/home/loader.gif" alt="loader" title="loader" class="mx-auto d-flex"> 
            <h2 class="text-center fw-light">loading...</h2>
         </div>
      </div>
      <!-- Preloader End-->
      <!--Header Begin-->
      <?php include("./includefiles/header.php"); ?>
      <!--Header End-->
      <!--Overlay Begin-->
      <div id="overlay"></div>
      <!--Overlay End-->
      <!--View-all Product Begin-->
      <section class="gap-top">
         <div class="container">
            <div class="row">
               <div class="col-md-12 my-4">
                  <?php    if(!empty($google_adar )){
                     echo $google_adar ;
                     }else{
                     echo ' <img src="admin/forms/'.$adimg4.'" alt="Horizontal Banner" title="Horizontal Banner" class="img-fluid w-100 rounded-3 mt-4 mb-4">';
                     } ?>
               </div>
               <div class="col-md-12">
                  <nav class="mb-4" aria-label="breadcrumb">
                     <ol class="breadcrumb">
                        <li class="breadcrumb-item"><a href="index">Home</a></li>
                        <li class="breadcrumb-item active" aria-current="page">View all product</li>
                     </ol>
                  </nav>
               </div>
            </div>
            <div class="row">
               <div class="col-md-3">
                  <div class="accordion  accordion-flush aside-left" id="accordionExample">
                     <div class="accordion-item">
                        <h1 class="h6 filter-text">
                           Filter by
                        </h1>
                     </div>
                     <!--Category Begin-->
                     <div class="accordion-item">
                        <h3 class="h6 accordion-header " id="headingOne">
                           <button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
                           Category 
                           </button>
                        </h3>
                        <div id="collapseOne" class="accordion-collapse collapse show" aria-labelledby="headingOne" data-bs-parent="#accordionExample1">
                           <div class="accordion-body">
                              <ul class="list-group list-group-flush">
                                 <?php 
                                    $price = $_REQUEST['price'];
                                    $search_cat =($_REQUEST['search_cat']);
                                     $brand_name =$_REQUEST['brand'];
                                      $store_name =$_REQUEST['store'];
                                     $discount =$_REQUEST['discount'];
                                    $low_to_high =$_REQUEST['low_to_high'];
                                    $high_to_low =$_REQUEST['high_to_low'];
                                    $sqlcomp="SELECT category, Count(*) as count FROM product_master group by category order by count DESC";
                                    
                                     $myquerycomp=$conn->query($sqlcomp);
                                    $mydaracomp= $myquerycomp->fetchAll()  ;
                                    
                                    $rows_foundcomp = $myquerycomp->rowCount();
                                    foreach( $mydaracomp as $rowcomp ){
                                    if(!empty($rowcomp['category'])){
                                    $cate_name = $rowcomp['category'];
                                    $cate_name = str_replace(" > ",">","$cate_name");
                                    $cate_name = str_replace(" ","-","$cate_name");
                                    $cate_name = strtolower($cate_name);
                                    echo " <li class='list-group-item d-flex justify-content-between align-items-start'>
                                    <a class='d-content' href='view-all-product-search/".$cate_name."'>
                                      <div title='".$rowcomp['category']."' class='pe-3 me-auto list-txt'>
                                         <p>".$rowcomp['category']."</p>
                                      </div>
                                      <span class='badge bg-primary rounded-pill'>".$rowcomp['count']."</span></a>
                                    </li>";
                                    }  }
                                    
                                    ?>
                              </ul>
                           </div>
                        </div>
                     </div>
                     <!--Category End-->
                     
                     <!--Latest ! Top Brand's Begin-->
                     <div class="accordion-item">
                        <h3 class="h6 accordion-header" id="headingThree">
                           <button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#collapseThree" aria-expanded="true" aria-controls="collapseThree">
                           LATEST! TOP BRANDS
                           </button>
                        </h3>
                        <div id="collapseThree" class="accordion-collapse collapse show" aria-labelledby="headingThree" data-bs-parent="accordionExample3">
                           <div class="accordion-body">
                              <ul class="list-group list-group-flush">
                                 <?
                                    $sqlcomp="SELECT brand_name FROM brand_master ORDER BY rand() LIMIT 4";
                                     $myquerycomp=$conn->query($sqlcomp);
                                    $mydaracomp= $myquerycomp->fetchAll()  ;
                                    
                                    $rows_foundcomp = $myquerycomp->rowCount();
                                    foreach( $mydaracomp as $rowcomp ){
                                    if(!empty($rowcomp['brand_name'])){
                                    $bran_name = strtolower($rowcomp['brand_name']);
                                    echo "<li class='list-group-item d-flex justify-content-between align-items-start'>
                                      <div class='pe-3 me-auto list-txt'>
                                           <a title=".$rowcomp['brand_name']." href='view-all-brand/".$bran_name ."'><p>".$rowcomp['brand_name']."</p></a>
                                      </div>
                                    </li>";
                                    }  }
                                    
                                    ?>
                              </ul>
                           </div>
                        </div>
                     </div>
                     <!--Latest ! Top Brand's End-->
                     <!-- Latest ! Top Store Begin-->
                     <div class="accordion-item">
                        <h3 class="h6 accordion-header" id="headingFour">
                           <button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#collapseFour" aria-expanded="true" aria-controls="collapseFour">
                           LATEST! TOP STORE
                           </button>
                        </h3>
                        <div id="collapseFour" class="accordion-collapse collapse show" aria-labelledby="headingFour" data-bs-parent="accordionExample4">
                           <div class="accordion-body">
                              <ul class="list-group list-group-flush">
                                 <?
                                    $sqlcomp="SELECT store_name FROM store_master ORDER BY rand() LIMIT 4";
                                     $myquerycomp=$conn->query($sqlcomp);
                                    $mydaracomp= $myquerycomp->fetchAll()  ;
                                    
                                    $rows_foundcomp = $myquerycomp->rowCount();
                                    foreach( $mydaracomp as $rowcomp ){
                                    if(!empty($rowcomp['store_name'])){
                                    $stor_name = strtolower($rowcomp['store_name']);
                                    echo "<li class='list-group-item d-flex justify-content-between align-items-start'>
                                      <div class='pe-3 me-auto list-txt'>
                                           <a title=".$rowcomp['store_name']." href='view-all-store/".$stor_name."'><p>".$rowcomp['store_name']."</p></a>
                                      </div>
                                    </li>";
                                    }  }
                                    
                                    ?>
                              </ul>
                           </div>
                        </div>
                     </div>
                     <!-- Latest ! Top Store End-->
                    
                    <!--Accordioncountry Begin-->
           <div class="accordion  accordion-flush " id="accordioncountry">
            <div class="accordion-item">
           
               <h3 class="h6 accordion-header border-bottom" id="countryheading">
                  <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapsecountry" aria-expanded="false">
                  Country
                  </button>
               </h3>
               <div id="collapsecountry" class="accordion-collapse collapse show" aria-labelledby="countryheading" data-bs-parent="#accordioncountry">
               <div class="accordion-body border-0">
                              <ul class="list-group list-group-flush">
                                 <?php
                                    $count_country = "SELECT country_name, COUNT(*) AS 'number' from product_master group by country_name;";
                                     $mydara_country = $conn->query($count_country);
                                     $country_fetch =  $mydara_country->fetchAll();
                                     $count_rows = $mydara_country->rowCount();
                                    // var_dump( $country_fetch );
                                    foreach( $country_fetch  as $rowcount ){  
                                    $country_name = $rowcount['country_name'];
                                    $country_name1 = str_replace(" ","-","$country_name");
                                    $country_name1 = strtolower($country_name1);
                                    $number = $rowcount['number'];
                                    if($country_name != ""){
                                 ?>
                              <li class="list-group-item d-flex justify-content-between align-items-start">
                                    <a class="d-content" href="view-all-product-country/<?=($country_name1)?>">
                                      <div title="<?=$country_name?>" class="pe-3 me-auto list-txt">
                                         <p><?=$country_name?></p>
                                      </div>
                                      <span class="badge bg-primary rounded-pill"> <?=$number?></span></a>
                                    </li>

                                    <?php } }?>
                                    <!-- <li class="list-group-item d-flex justify-content-between align-items-start">
                                    <a class="d-content" href="#">
                                      <div title="Germany" class="pe-3 me-auto list-txt">
                                         <p>Germany</p>
                                      </div>
                                      <span class="badge bg-primary rounded-pill">6</span></a>
                                    </li>
                                    <li class="list-group-item d-flex justify-content-between align-items-start">
                                    <a class="d-content" href="#">
                                      <div title="New York" class="pe-3 me-auto list-txt">
                                         <p>New York</p>
                                      </div>
                                      <span class="badge bg-primary rounded-pill">66</span></a>
                                    </li> -->
                            
                              
                              </ul>
                           </div>
               </div>
            </div>
         </div>
         <!--Accordioncategories End-->
                  </div>
                  <!--Banner BEgin-->
                  <div class="my-4">
                  <?php    if(!empty($google_adar )){
                     echo $google_adar ;
                     }else{
                     echo ' <img src="admin/forms/'.$adimg2.'" alt="Vertical Banner" title="Vertical Banner" class="img-fluid rounded-3">';
                     }
                     
                     ?>
                     </div>
                  <!--Banner End-->
               </div>
               <div class="col-md-9">
                  <div class="mb-5">
                     <!-- Nav pills -->
                     <ul class="nav nav-pills aside-pills" role="tablist">
                        <li class="nav-item">
                           <a class="nav-link <?php if(empty($low_to_high) && empty($high_to_low)){echo 'active';}?>"  href="./view-all-product"><i class="fas fa-star pe-2"></i>Popular</a>
                        </li>
                        <li class="nav-item">
                           <a class="nav-link <?php if(!empty($high_to_low)){echo 'active';}?>"  href="./view-all-product-high-to-low/high-price"><i class="fas fa-arrow-up pe-2"></i>High Price</a>
                        </li>
                        <li class="nav-item">
                           <a class="nav-link <?php if(!empty($low_to_high)){echo 'active';}?>"  href="./view-all-product-low-to-high/low-price"><i class="fas fa-arrow-down pe-2"></i>Low Price</a>
                        </li>
                     </ul>
                     <!-- Tab panes -->
                     <div class="tab-content pt-3">
                        <div id="popular" class="tab-pane active">
                           <div class="row">
                              <?php  
                                 $sqlcou="SELECT * FROM  product_master ";
                                 
                                 if(!empty($search_cat)){
                                    $search_cat = str_replace("-"," ",$search_cat);
                                    $search_cat = str_replace(">"," > ",$search_cat);
                                    $search_cat = ucwords($search_cat);

                                 $sqlcou = $sqlcou."WHERE category='$search_cat' ";
                                 
                                 
                                 }
                                 if(!empty($brand_name)){
                                    $brand_name =  ucwords($brand_name);
                                 $sqlcou = $sqlcou."WHERE category LIKE '%".$brand_name."%' OR title LIKE '%".$brand_name."%' OR discription LIKE '%".$brand_name."%' ";
                                 
                                 
                                 }
                                 
                                 if(!empty($store_name)){
                                    $store_name = ucwords($store_name);
                                 $sqlcou = $sqlcou."WHERE category LIKE '%".$store_name."%' OR title LIKE '%".$store_name."%' OR discription LIKE '%".$store_name."%' ";
                                 
                                 
                                 }

                                 if(!empty($country_name)){
                                    $sqlcou = $sqlcou."WHERE country_name='".$country_name."' AND  country_name!='' ";
                                 }
                                 if(!empty($discount)){
                                 $sqlcou = $sqlcou."WHERE category LIKE '%".$discount."%' OR title LIKE '%".$discount."%' OR discription LIKE '%".$discount."%' ";
                                 
                                 
                                 }
                                 
                                 
                                 
                                 if($price ==5000){
                                 $sqlcou = $sqlcou."WHERE amount BETWEEN 0 AND 5000";
                                 
                                 }
                                 
                                 if($price ==10000){
                                 $sqlcou = $sqlcou."WHERE amount BETWEEN 5000 AND 10000";
                                 
                                 }
                                 
                                 if($price ==18000){
                                 $sqlcou = $sqlcou."WHERE amount BETWEEN 10000 AND 18000";
                                 
                                 }
                                 
                                 if($price ==25000){
                                 $sqlcou = $sqlcou."WHERE amount BETWEEN 18000 AND 25000";
                                 
                                 }
                                 
                                 if($price ==35000){
                                 $sqlcou = $sqlcou."WHERE amount BETWEEN 25000 AND 35000";
                                 
                                 }
                                 
                                 if(!empty($low_to_high)){
                                 $sqlcou = $sqlcou." ORDER BY amount ASC";
                                 
                                 }
                                 
                                 if(!empty($high_to_low)){
                                 $sqlcou = $sqlcou." ORDER BY amount DESC";
                                 
                                 }
                                 
                                 //var_dump($discount);
                                 
                                 
                                 $sqlcou=$sqlcou.    " LIMIT $start_from, $limit ";
                                 
                                 $myquerycou=$conn->query($sqlcou);
                                 
                                 $mydaracou= $myquerycou->fetchAll()  ;
                                 
                                 $rows_foundcou = $myquerycou->rowCount();
                                 
                                
                                 
                                 
                                 foreach( $mydaracou as $rowcou ){
                                 $rowId    = $rowcou["rowId"];
                                 $short_title   = $rowcou["title"];
                                 $discription   = $rowcou["discription"];
                                 $link = $rowcou["product_url"];
                                 $product_image   = $rowcou["product_image"];
                                 $type = $rowcou["exp_date"];
                                 $coupon_code   = $rowcou["country_name"];
                                 $company_name   = $rowcou["company_name"];
                                 $amount   = $rowcou["amount"];  
                                 $total_likes   = $rowcou["total_likes"];  
                                 $currency    = $rowcou["currency"];
                                 if($_SESSION[ADD_TAG.'_UserId_vendor']!=''){
                                 
                                 $user_id=$_SESSION[ADD_TAG.'_UserId_vendor'];
                                 /*for like master vendor*/
                                 $sqlli = "SELECT * FROM like_master_product WHERE coupan_id='$rowId ' AND user_id='$user_id' AND user_type='vendor' ";
                                 $myqueryli=$conn->query($sqlli); 
                                 $mydarali= $myqueryli->fetchAll();
                               
                                 $rows_foundli = $myqueryli->rowCount();
                                 
                                 if($rows_foundli=='0'){
                                 $like='<li class="like'.$rowId .'" ><a onclick="return cwRating('.$rowId .', 1,'.$rowId .');" title="I Like This"><i title="I Like This" class="fas fa-thumbs-up"></i>&nbsp;'.$total_likes.'</a></li>';
                                 
                                 }else{
                                 $like=' <li  class="like'.$rowId .'"><a onclick="return cwRating('.$rowId .', 0,'.$rowId .');" title="I Like This"><i class="fa fa-thumbs-up" title="I Like This"></i>
                                 &nbsp;'.$total_likes.'</a></li>';
                                 }
                                 /*for like master vendor */
                                 /*for fav master vendor*/
                                 $sqlfav = "SELECT * FROM fav_master_product WHERE coupan_id='$rowId ' AND user_id='$user_id' AND user_type='vendor' ";
                                 $myqueryfav=$conn->query($sqlfav); 
                                 $mydarafav= $myqueryfav->fetchAll()  ;
                                 
                                 $rows_foundfav = $myqueryfav->rowCount();
                                 
                                 if($rows_foundfav=='0'){
                                 $fav='<li class="fav'.$rowId .'"><a onclick="return fav('.$rowId .',1);" title="My Favourite"><i class="fas fa-heart"  ></i></a></li>';
                                 }else{
                                 $fav='  <li class="fav'.$rowId .'"><a onclick="return fav('.$rowId .',0);" title="My Favourite"><i class="fas fa-heart" ></i></a></li>';
                                 }
                                 /*for fav master vendor */
                                 
                                 }
                                 elseif($_SESSION[ADD_TAG.'_UserId_user']!=''){
                                 $user_id=$_SESSION[ADD_TAG.'_UserId_user'];
                                 /*for like master user*/
                                 $sqlli = "SELECT * FROM like_master_product WHERE coupan_id='$rowId ' AND user_id='$user_id' AND user_type='user'  ";
                                 $myqueryli=$conn->query($sqlli); 
                                 $mydarali= $myqueryli->fetchAll()  ;
                                 
                                 $rows_foundli = $myqueryli->rowCount();
                                 
                                 if($rows_foundli=='0'){
                                 $like='<li class="like'.$rowId .'"><a onclick="return cwRating('.$rowId .', 1,'.$rowId .');" title="I Like This"><i title="I Like This" class="fas fa-thumbs-up"></i>&nbsp;'.$total_likes.'</a></li>';
                                 // $like=' <li class="mr-0"  id="asd'.$rowId .'"><a onclick="return cwRating('.$rowId .', 1,'.$rowId .');" title="I Like This"><i class="fa fa-thumbs-o-up fa-1x text-success" aria-hidden="true" ></i>&nbsp;'.$total_likes.'</a></li>';
                                 }else{
                                 
                                 $like=' <li  class="like'.$rowId .'"><a onclick="return cwRating('.$rowId .', 0,'.$rowId .');" title="I Like This"><i class="fa fa-thumbs-up text-success" aria-hidden="true"></i>
                                 &nbsp;'.$total_likes.'</a></li>';
                                 }
                                 /*for like master user*/  
                                 /*for fav master user*/
                                 $sqlfav = "SELECT * FROM fav_master_product WHERE coupan_id='$rowId ' AND user_id='$user_id' AND user_type='user' ";
                                 $myqueryfav=$conn->query($sqlfav); 
                                 $mydarafav= $myqueryfav->fetchAll()  ;
                                 
                                 $rows_foundfav = $myqueryfav->rowCount();
                                 
                                 if($rows_foundfav=='0'){
                                 $fav='<li class="fav'.$rowId .'"><a onclick="return fav('.$rowId .',1);" title="My Favourite"><i class="fas fa-heart" ></i></a></li>';
                                 }else{
                                 $fav='  <li class="fav'.$rowId .'"><a onclick="return fav('.$rowId .',0);" title="My Favourite"><i class="fa fa-heart fa-1x text-danger"></i></a></li>';
                                 }
                                 /*for fav master user */
                                 
                                 }else{
                                 
                                 $like='  <li data-bs-toggle="modal" data-bs-target="#like-product"><i title="I Like This" class="fas fa-thumbs-up"></i>'.$total_likes.'</li>';
                                 $fav=' <li data-bs-toggle="modal" data-bs-target="#favorite-product"><i title="My Favourite" class="fas fa-heart"></i></li>';
                                 }
                                 
                                 
                                 
                                 
                                 ?>
                              <div class="col-lg-4 col-6">
                                 <div class="deals">
                                    <div class="card border-0">
                                       <div class="card-body">
                                          <img alt="<?=$short_title?>" title=" <?=$short_title?>" src="<?=$product_image?>"  class="img-fluid mx-auto d-block">
                                          <div class="d-grid">
                                             <small title="<?=$short_title ?>" class="text-muted text-truncate"><?=$short_title ?></small>
                                             <p class="d-para">
                                                <a class="context-menu" title="<?=$discription?>"><?=$discription?></a> 
                                             </p>
                                          </div>
                                          <div class="row align-items-center">
                                             <div class="col-md-7">
                                             <?php
                              $currency_query = "SELECT * FROM country_currency_master WHERE code='$currency' limit 1";
                     $myquerycurr=$conn->query($currency_query); 
                     $mydaracurr= $myquerycurr->fetchAll()  ;
                     
                     $rows_foundcurr = $myquerycurr->rowCount();
                   
                     if( $rows_foundcurr !='0'){
                       // var_dump(  $mydaracurr);
                        foreach( $mydaracurr as $rowcous ){
                          $currency_symbol = $rowcous['symbol'];
                          
                        ?>
                                 <h3 class="mb-2 fw-bold text-truncate">
                                 <?=$currency_symbol?>   <?=$amount?>
                                 </h3>
                                 <?php }}?>
                                             </div>
                                             <div class="col-md-5 text-end">
                                                <h6 class="shop-now"><a target="_blank" href="<?=$link?>">Shop now</a></h6>
                                             </div>
                                          </div>
                                       </div>
                                       <div class="card-footer social-icons bg-white">
                                          <ul class="list-unstyled mb-0">
                                             <?=$fav?>
                                             <?=$like?>
                                             <li  data-bs-toggle="modal" data-bs-target="#share-product<?=$rowId?>"><i title="Share" class="fas fa-share pe-1"></i>Share</li>
                                          </ul>
                                       </div>
                                    </div>
                                 </div>
                              </div>
                              <!--Popular-->
                              <div class="modal fade" id="share-product<?=$rowId?>" tabindex="-1"  aria-hidden="true">
                                 <div class="modal-dialog modal-dialog-centered modal-lg">
                                    <div class="modal-content">
                                       <div class="modal-header border-0">
                                          <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                                       </div>
                                       <div class="modal-body p-5">
                                          <div id="removemodalproductdealoftheday">
                                             <div class="row justify-content-center align-items-center">
                                                <div class="col-md-5">
                                                   <div class="d-modal-left">
                                                      <img src="<?=$product_image?>" alt="<?=$short_title?>" title="<?=$short_title?>" class="img-fluid mx-auto d-block">
                                                   </div>
                                                </div>
                                                <div class="col-md-7">
                                                   <div class="dm-price">
                                                      <h3 title="<?=$short_title?>" class="fw-bold text-truncate"><?=$short_title?></h3>
                                                      <a href="product-details-ref/<?=($rowId)?>" class="btn btn-view-deal w-100 d-block mt-2 mb-4">View Product Deal</a>
                                                      <!--Copy URL Begin-->
                                                      <div class="mb-3 row">
                                                         <label class="col-sm-4 col-form-label">Copy URL</label>
                                                         <div class="col-sm-8">
                                                            <!--copy to copyclipboardproductdealoftheday Begin-->
                                                            <div class="input-group clipboarddealoftheday">
                                                            <input  class="form-control form-control-sm" value="<?php echo $link; ?>" id="<?=$rowId?>">
                                          <span class="input-group-text bg-secondary text-white" onclick="copy(<?=$rowId?>)"><i class="far fa-copy"></i></span>
                                                            </div>
                                                            <div id="copiedtextproductdealsday" class="copieddealoftheday">
                                                               <span>Copied!</span>
                                                            </div>
                                                            <!--copy to copyclipboardproductdealoftheday End-->
                                                         </div>
                                                      </div>
                                                      <!--Share Via Begin-->
                                                      <div class="mb-3 row">
                                                         <label class="col-sm-4 col-form-label">Share via</label>
                                                         <div class="col-sm-8">
                                                            <!--share Via Begin-->
                                                            <div class="d-flex justify-content-start align-items-center">
                                                               <a title="share via linkedin" href="https://www.linkedin.com/sharing/share-offsite/?url=<?=$link?>" class="share-linkedin ms-2"><i class="fab fa-linkedin-in"></i></a>
                                                               <a title="share via facebook" href="https://www.facebook.com/sharer.php?u=<?=$link?>" class="share-facebook ms-2"><i class="fab fa-facebook-f"></i></a>
                                                               <a title="share via twitter" href="https://twitter.com/intent/tweet?url=<?=$link?>" class="share-twitter ms-2"><i class="fab fa-twitter"></i></a>
                                                               <a title="share via pinterest" href="https://www.pinterest.com/pin/create/button/?url=<?=$link?>" class="share-pinterest ms-2"><i class="fab fa-pinterest-p"></i></a>
                                                               <a title="share via whatsapp" href="https://web.whatsapp.com/send?text=<?=$link?>" class="share-whatsapp ms-2"><i class="fab fa-whatsapp"></i></a>
                                                               <a title="share via telegram" href="https://t.me/share/url?url=<?=$link?>&text=telegram" class="share-telegram ms-2"><i class="fab fa-telegram"></i></a>
                                                               <a title="share via reddit" href="http://www.reddit.com/submit?url=<?=$link?>" class="share-reddit ms-2"><i class="fab fa-reddit"></i></a>
                                                               <a title="share via tumblr" href="http://www.tumblr.com/share?v=3&u=<?=$link?>&t=tumblr" class="share-tumblr ms-2"><i class="fab fa-tumblr"></i></a>
                                                            </div>
                                                            <!--share Via End-->
                                                         </div>
                                                      </div>
                                                   </div>
                                                </div>
                                             </div>
                                          </div>
                                       </div>
                                    </div>
                                 </div>
                              </div>
                              <?php } 
                             
                              ?>   
                              <!--Popular-->
                              <div class="col-lg-12">
                                 <!-- Paginations-->
                                 <nav aria-label="Page navigation example">
                                    <ul class="pagination justify-content-center pt-4 pb-4">
                                       <!--<li>
                                          <a href="javascript:void(0)" class="navigation previous disabled" rel="prev">Previous page</a>
                                          </li>-->
                                       <?php   
                                          $sqlpa= "SELECT COUNT(*) FROM product_master "; 
                                          if(!empty($search_cat)){
                                          $sqlpa = $sqlpa." WHERE category='$search_cat'";
                                          $search_cat = str_replace(" > ",">",$search_cat);
                                          $search_cat = str_replace(" ","-",$search_cat);
                                   
                                    $search_cat = strtolower($search_cat);
                                          $sr='&search_cat='.($search_cat);
                                          }
                                          if(!empty($brand_name)){
                                          $sqlpa = $sqlpa."WHERE category LIKE '%".$brand_name."%' OR title LIKE '%".$brand_name."%' OR discription LIKE '%".$brand_name."%' ";
                                          
                                          $sr='&brand='.$brand_name;
                                          }
                                          if(!empty($store_name)){
                                          $sqlpa = $sqlpa."WHERE category LIKE '%".$store_name."%' OR title LIKE '%".$store_name."%' OR discription LIKE '%".$store_name."%' ";
                                          // var_dump($sqlpa);
                                          // die;
                                          $sr='&store='.$store_name;
                                          }
                                          if(!empty($low_to_high)){
                                          $sqlcou = $sqlcou." ORDER BY amount ASC";
                                          $sr='&low_to_high=low-price';
                                          } 
                                          
                                          if(!empty($high_to_low)){
                                          $sqlcou = $sqlcou." ORDER BY amount DESC";
                                          $sr='&high_to_low=high-price';
                                          
                                          }
                                          if($price ==5000){
                                          $sqlpa = $sqlpa." WHERE amount BETWEEN 0 AND 5000";
                                          $sr='&price=5000';
                                          
                                          }
                                          if($price ==10000){
                                          $sqlcou = $sqlcou." WHERE amount BETWEEN 5000 AND 10000";
                                          $sr='&price=10000';
                                          }
                                          
                                          if($price ==18000){
                                          $sqlcou = $sqlcou." WHERE amount BETWEEN 10000 AND 18000";
                                          $sr='&price=18000';
                                          }
                                          
                                          if($price ==25000){
                                          $sqlcou = $sqlcou." WHERE amount BETWEEN 18000 AND 25000";
                                          $sr='&price=25000';
                                          }
                                          
                                          if($price ==35000){
                                          $sqlcou = $sqlcou." WHERE amount BETWEEN 25000 AND 35000";
                                          $sr='&price=35000';
                                          }
                                          
                                          if(!empty($discount)){
                                          $sqlcou = $sqlcou."WHERE category LIKE '%".$discount."%' OR title LIKE '%".$discount."%' OR discription LIKE '%".$discount."%' ";
                                           $sr='&discount='.$discount;
                                          
                                          }
                                          
                                          
                                          
                                          
                                          
                                          $myquerypa=$conn->query($sqlpa);
                                         
                                          $row = $myquerypa->fetch(PDO::FETCH_BOTH);
                                          // do loop stuff
                                          
                                          
                                          $rows_foundpa = $myquerypa->rowCount();   
                                          $total_records = $row[0];  
                                          
                                          //echo $rows_foundpa;
                                          if($total_records > 9){
                                          $total_pages = ceil($total_records / $limit);
                                          
                                          $k = (($pn+1>$total_pages)?$total_pages-1:(($pn-1<1)?2:$pn));   
                                          
                                          $pagLink = "";
                                          if($pn>=2){
                                          echo "<li class='page-item'><a class='page-link' href='view-all-products/1".$sr."'> << </a></li>";
                                          echo "<li class='page-item'><a class='page-link' href='view-all-products/".($pn-1).$sr." '> < </a></li>";
                                          }
                                          for ($i=-1; $i<=1; $i++) {
                                          if($total_pages>=$k+$i && $k+$i!='0' ){
                                          if($k+$i==$pn){
                                          $pagLink .= "<li class='page-item active'><a class='page-link' href='view-all-products/".($k+$i).$sr." ' >".($k+$i)."</a></li>";
                                          }
                                          else{
                                          $pagLink .= "<li class='page-item'><a class='page-link' href='view-all-products/".($k+$i).$sr." '>".($k+$i)."</a></li>";  
                                          } }
                                          };  
                                          echo $pagLink;
                                          if($pn<$total_pages){
                                          echo "<li class='page-item'><a class='page-link' href='view-all-products/".($pn+1).$sr." '> > </a></li>";
                                          echo "<li class='page-item'><a class='page-link' href='view-all-products/".$total_pages.$sr." '> >> </a></li>";
                                          }  }  ?>
                                    </ul>
                                 </nav>
                              </div>
                           </div>
                        </div>
                     </div>
                  </div>
               </div>
               <div class="col-md-12 my-4">
                  <!--banner Footer-->
                  <?php    if(!empty($google_adar )){
                     echo $google_adar ;
                     }else{
                     echo ' <img src="admin/forms/'.$adimg3.'" alt="Horizontal Banner" title="Horizontal Banner"  class="img-fluid rounded-3 my-5">';
                     }
                     
                     ?>
               </div>
            </div>
         </div>
      </section>
      <!--View-all Product End-->
      <!--like Product Modal -->
      <div class="modal fade" id="like-product" tabindex="-1" aria-labelledby="likeproductLabel" aria-hidden="true">
         <div class="modal-dialog modal-dialog-centered">
            <div class="modal-content">
               <div class="modal-header border-0">
                  <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
               </div>
               <div class="modal-body">
                  <div class="mx-auto d-block text-center">
                     <h6 class="likethead">Please <a href="#">Sign in </a><strong> for like</strong></h6>
                     <img src="images/web-images/home/like.png" alt="like" title="like" width="50" class="img-fluid">
                  </div>
               </div>
               <div class="modal-footer bg-transparent">
                  <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
               </div>
            </div>
         </div>
      </div>
      <!--favourate  Product Modal -->
      <div class="modal fade" id="favorite-product" tabindex="-1" aria-labelledby="favoriteproductLabel" aria-hidden="true">
         <div class="modal-dialog modal-dialog-centered">
            <div class="modal-content">
               <div class="modal-header border-0">
                  <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
               </div>
               <div class="modal-body">
                  <div class="mx-auto d-block text-center">
                     <h6 class="likethead">Please <a href="#">Sign in </a><strong> for favorite</strong></h6>
                     <img src="images/web-images/home/favorite.png" alt="favorite" title="favorite" width="50" class="img-fluid">
                  </div>
               </div>
               <div class="modal-footer bg-transparent">
                  <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
               </div>
            </div>
         </div>
      </div>
      <!--Popular Category Begin-->
      <?php include("./contentpages/home/popular_cateogories.php"); ?>
      <!--Popular Category End-->
      <!--footer Section Begin-->
      <?php include("./includefiles/footer.php"); ?>
      <!--footer Section End-->
      <!--scroll to top Begin-->
      <button onclick="topFunction()" id="gobackToTop" title="Go To Top"><i class="fas fa-angle-up"></i></button>
      <!--scroll to top end-->
      <!-- jquery-3.4.1.min js Begin -->
      <script src="js/jquery-3.4.1.min.js"></script>
      <!-- jquery-3.4.1.min js End -->
      <!-- bootstrap.bundle.min js Begin-->
      <script src="js/bootstrap.bundle.min.js"></script>
      <!-- bootstrap.bundle.min js End-->
      <!-- icouponworld js Begin-->
      <script src="js/icouponworld.js"></script>
      <!--icouponworld js End--> 
      <!-- owl.carousel.js Begin-->
      <!-- <script src="js/owl.carousel.js"></script> -->
      <!-- owl.carousel.js End-->
      <!-- sweetalert.min.js Begin-->
      <script src="js/sweetalert.min.js"></script>
      <!-- sweetalert.min.js End-->
      <!--script for googleTranslateElementInit Begin-->
      <!-- <script>
         function googleTranslateElementInit() {
  new google.translate.TranslateElement({pageLanguage: 'en'}, 'google_translate_element');
}
      </script> -->
      <!--script for googleTranslateElementInit End-->
      <!--script for googleTranslate Begin-->
      <!-- <script src="js/googletranslate.js"></script> -->
      <!--script for googleTranslate End-->
      <!-- owl-carousel Script Begin-->
      <!-- <script>
         $('#product.owl-carousel, #fashion.owl-carousel, #top-deals.owl-carousel').owlCarousel({
         loop:true,
         responsiveClass:true,
         responsive:{
         0:{
          items:1,
          nav:true
         },
         600:{
          items:3,
          margin:7,
          nav:true,
          loop:false
         },
         1000:{
          items:4,
          margin:7,
          nav:true,
          loop:false
         },
         1500:{
          items:4,
          margin:17,
          nav:true,
          loop:false
         }
         }
         })
         $( ".owl-prev").html('<i class="fa fa-chevron-left"></i>');
         $( ".owl-next").html('<i class="fa fa-chevron-right"></i>');
      </script> -->
      <!-- owl-carousel Script End-->
      <!--like_dislike_product Script Begin-->
      <script type="text/javascript">  
         function cwRating(id,type,target){
         $.ajax({
           type:'POST',
           url:'forms/like_dislike_product.php',
           data:'id='+id+'&type='+type,
           success:function(msg){
               if(msg == 'err'){
                   alert('Some problem occured, please try again.');
               }else{
                   $('.like'+target).html(msg);
                   swal({
         title: "Hurray!",
         text: "Your liking was just saved.",
         imageUrl: 'thumbs-up.jpg'
         });
               }
           }
         });
         }
      </script>
      <!--like_dislike_product Script End-->
      <!--fav_master_product Script Begin-->
      <script type="text/javascript">  
         function fav(id,type){
         $.ajax({
           type:'POST',
           url:'forms/fav_master_product.php',
           data:'id='+id+'&type='+type,
           success:function(msg){
               if(msg == 'err'){
                   alert('Some problem occured, please try again.');
               }else{
                   $('.fav'+id).html(msg);
                   swal({
         title: "Yay!",
         text: "We just saved your favourite.",
         imageUrl: 'thumbs-up.jpg'
         });
               }
           }
         });
         }
      </script>
      <!--fav_master_product Script End-->
       <!-- Script for copy to clipboard Begin-->
      <script>
    function copy(inputId) {
        /* Get the text field */

        // Changed to get the Element by the parameter containing the ElementID
        var copyText = document.getElementById(inputId);

        /* Select the text field */
        copyText.select();
        copyText.setSelectionRange(0, 99999); /* For mobile devices */

        /* Copy the text inside the text field */
        navigator.clipboard.writeText(copyText.value);

        /* Alert the copied text */
        alert("Copied the text: " + copyText.value);
    }
</script>
  <!-- Script for copy to clipboard End-->
    <!-- Script for copyproduct to clipboard Begin-->
<script>
    function copyproduct(inputId) {
        /* Get the text field */

        // Changed to get the Element by the parameter containing the ElementID
        var copyproductText = document.getElementById(inputId);

        /* Select the text field */
        copyproductText.select();
        copyproductText.setSelectionRange(0, 99999); /* For mobile devices */

        /* Copy the text inside the text field */
        navigator.clipboard.writeText(copyproductText.value);

        /* Alert the copied text */
        alert("Copied the text: " + copyproductText.value);
    }
</script>
  <!-- Script for copyproduct to clipboard End-->
   </body>
</html>
<?php
ob_end_flush();  // This is a code for php minifiers
?>