<div class="breadcrumb section pt-60 pb-60">
      <div class="container">
        <h1 class="uppercase"><?php echo $_GET['search_word'];?></h1>
        <ul>
          <li><a href="<?php echo base_url();?>"><i class="fa fa-home"></i> Search</a></li>
          <li class="active"><?php echo $_GET['search_word'];?></li>
        </ul>
      </div>
    </div>
    <!-- =====  BREADCRUMB END===== -->
    <div class="product-section section mt-30">
    <!-- =====  CONTAINER START  ===== -->
    <div class="container">
      <div class="row">
        
        <div class="col-lg-12 col-xl-12 col-sm-12">
          <div class="category-page-wrapper mb-15 pb-10">
            <div class="row">
            
            <!--<div class="col-md-auto page-wrapper order-12">
              <label class="control-label" for="input-limit">Show :</label>
              <div class="limit">
                <select id="input-limit" class="form-control">
                  <option value="8" selected="selected">08</option>
                  <option value="25">25</option>
                  <option value="50">50</option>
                  <option value="75">75</option>
                  <option value="100">100</option>
                </select>
              </div>
            </div>-->
            <!--<div class="col-md-auto sort-wrapper order-11">
              <label class="control-label" for="input-sort">Sort By :</label>
              <div class="sort-inner">
                <select id="input-sort" class="form-control">
                  <option value="ASC" selected="selected">Default</option>
                  <option value="ASC">Price (Low &gt; High)</option>
                  <option value="DESC">Price (High &gt; Low)</option>
                  <option value="DESC">Rating (Highest)</option>
                  <option value="ASC">Rating (Lowest)</option>
                </select>
              </div>
            </div>-->
          </div>
          </div>
          <div class="row">
            <?php if(!empty($products)){foreach($products as $featp){?>
            <div class=" product-items col-6 col-sm-6 col-md-2 col-lg-2">
              <div class="product-thumb transition">
               <div class="image">
      <div class="first_image"> 
      <a href="<?php echo base_url().str_replace(" ","-",$featp->cat_name).'/details/'.str_replace(" ","-",$featp->title).'/'.$featp->pid;?>">
            <img src="<?php echo base_url();?>assets/images/products/<?php echo $featp->img;?>" class="img img-responsive" alt=""></a>
      </div>
      <!--<div class="swap_image"> 
      <a href="product_detail_page.html"> <img src="images/pro/015.jpg" alt="pure-spice-3" title="pure-spice-3" class="img-responsive"> </a></div>
                </div>-->
                <div class="product-details">
                  <div class="caption">
                    <h4><a href="<?php echo base_url().str_replace(" ","-",$featp->cat_name).'/details/'.str_replace(" ","-",$featp->title).'/'.$featp->pid;?>"><?php echo $featp->title;?></a></h4>
    <b class="price text-success"><i class="fa fa-inr"></i><b id="price_<?php echo $featp->pid;?>"><?php echo $featp->selling_price;?></b>
    <del class="price-tax text-danger" id="oldprice_<?php echo $featp->pid;?>"><?php echo $featp->pmrp;?></del></b>
                    <form action="" method="post" class="addtocart">
                    <div class="product_option">
                      <input type="hidden" name="pid" value="<?php echo $featp->pid;?>" />
                      <input type="hidden" name="price" value="<?php echo $featp->selling_price;?>" />
                      <input type="hidden" name="mrp" value="<?php echo $featp->pmrp;?>" />
                      <?php if($featp->prod_type=="Variant"){
						  $this->db->select("*");
						  $this->db->from("prod_variants");
						  $this->db->join("prod_stock","prod_stock.variant_id=prod_variants.pvid");
						  $this->db->where("prod_variants.pid",$featp->pid);
						  $this->db->where("prod_stock.city_id",$this->session->userdata("city"));
						  //$this->db->group_by("prod_variants.pid");
						  $pvs=$this->db->get()->result();?>
                      <div class="form-group required ">
                        <select name="pvariant" class="form-control prod_type" id="<?php echo $featp->pid;?>" required>
                          <option value=""> --- Please Select --- </option>
                          <?php foreach($pvs as $pv){?>
                          <option value="<?php echo $pv->stock_id.'-'.$pv->selling_price.'-'.$pv->pmrp;?>"><?php echo $pv->pptype;?></option>
                          <?php }?>
                        </select>
                      </div>
                      <?php }?>
                      <div class="input-group button-group">
                        <label class="control-label">Qty</label>
                        <input type="number" name="qty" min="1" value="1" step="1" class="qty form-control">
                        <button type="submit" class="addtocart pull-right">Add</button>
                      </div>
                    </div>
                      </form>
                  </div>
                </div>
              </div>
            </div>
            </div>
			<?php }}else{?>

            <div class="col-md-8 col-md-offset-2 text-center">

            <h1 style="font-size:50px;" class="text-danger">No Products Listed in this category...</h1><br/>

            <a href="<?php echo base_url();?>" class="btn btn-lg btn-danger">Back To Home</a>

            </div>

            <?php }?>
          </div>

          <div class="pagination-nav text-center mt-50">
            <ul>
            <?php   $perpage=9;

                                             $totpage=$tot/$perpage;

                                            for($i=0;$i<$totpage;$i++){

                                            $subcat="";

                                            if(is_numeric($this->uri->segment(3)) && is_numeric($this->uri->segment(4)) ){

                                            $cat=$this->uri->segment(3);$subcat=$this->uri->segment(4);$link=$cat.'-'.$subcat;

                                            }else{

                                            $cat=$this->uri->segment(2);$link=$cat;

                                              }?><li class=""><a class="page-number <?php if($i==0){echo 'active ';}echo 'page'.$i;?>" href="<?php echo $i*9;?>" id="<?php echo $link;?>"><?php echo $i+1;?></a></li>

                                            <?php }?>
              
            </ul>
          </div>
        </div>
      </div>
    </div>
    <!-- =====  CONTAINER END  ===== -->

    </div>
    <script>$(document).ready(function(){

<?php   $subcat="";

		if(is_numeric($this->uri->segment(3)) && is_numeric($this->uri->segment(4)) ){

		$cat=$this->uri->segment(3);$subcat=$this->uri->segment(4);$link=$cat.'-'.$subcat;

		}else{

		$cat=$this->uri->segment(2);}

		$link=$cat;?>

		var id="<?php echo $link;?>";

		$("a.page0").trigger("click");

		$(".page-number").click(function(e){e.preventDefault();

		$(".page-number").removeClass("active");

						 $(this).addClass("active");

		$("#ajaxpagination").html("<h1 class='text-center'>Loading Products.....</h1>");

		//$('html, body').animate({
//
//							scrollTop: $(".breadcrumb-container").offset().top
//
//						}, 500);

							var id=$(this).attr("id");

							var href=$(this).attr("href");

							$.ajax({

									 type: "POST",

									 url: '<?php echo base_url();?>home/pagination',

									 data: {href:href,id:id},

									 success: function(res){

										$("#ajaxpagination").html(res);

									}

									 }); 

						});

	});

	</script>