<div class="breadcrumb-area mb-15">

		<div class="container">

			<div class="row">

				<div class="col">

					<div class="breadcrumb-container">

						<ul>

							<li><a href="<?php echo base_url();?>"><i class="fa fa-home"></i> Home</a></li>

							<li class="active"><?php echo str_replace("-"," ",$this->uri->segment(1));?></li>

						</ul>

					</div>

				</div>

			</div>

		</div>

	</div>

	

<div class="shop-page-container mb-50">

		<div class="container">

			<div class="row">

				<div class="col-lg-3 order-2 order-lg-1">

					<!--=======  sidebar area  =======-->

					

					<div class="sidebar-area">

						<!--=======  single sidebar  =======-->

						

						<div class="sidebar mb-35">

							<h3 class="sidebar-title">PRODUCT CATEGORIES</h3>

							<ul class="product-categories">

								<?php foreach($subcats as $sub){?>

  <li>

  <a class="<?php //if($this->uri->segment(4) && $this->uri->segment(3)==$sub->cid){echo 'active';}?>" href="<?php echo base_url();?><?php echo str_replace(" ","-",$this->uri->segment(1));?>/<?php echo str_replace(" ","-",$sub->subcat_name);?>/<?php echo $sub->cid;?>/<?php echo $sub->sid;?>"><?php echo $sub->subcat_name;?> </a></li><?php }?> 

  

  <!--<span class="pull-right"><?php //echo $this->db->get_where("products",array("sid"=>$sub->sid))->num_rows();?></span></li>-->    

							</ul>

						</div>

						

						<!--=======  End of single sidebar  =======-->



						<!--=======  single sidebar  =======

						

						<div class="sidebar mb-35">

							<h3 class="sidebar-title">Filter By</h3>

							<ul class="product-categories">

								<li><a class="active" href="shop-left-sidebar.html">Gold</a></li>

								<li><a href="shop-left-sidebar.html">Green</a></li>

								<li><a href="shop-left-sidebar.html">White</a></li>

							</ul>

						</div>

						

						<!--=======  End of single sidebar  =======-->



						<!--=======  single sidebar  =======-->

						

						<div class="sidebar mb-35">

							<h3 class="sidebar-title">Filter By Price</h3>

							<div class="sidebar-price">

								<div id="price-range"></div>

								<input type="text" id="price-amount" readonly>

							</div>

						</div>

						

						

					</div>

					

					<!--=======  End of sidebar area  =======-->

				</div>

				<div class="col-lg-9 order-1 order-lg-2 mb-sm-15 mb-xs-15">					

					<div class="shop-header mb-15">

						<div class="row">

							<div class="col-lg-12 col-md-12 col-sm-12 d-flex flex-column flex-sm-row justify-content-between align-items-left align-items-sm-center">

								<!--=======  Sort by dropdown  =======-->

								

								<div class="sort-by-dropdown d-flex align-items-center mb-xs-10">

									<p class="mr-10">Sort By: </p>

									<select name="sort-by" id="sort-by" class="nice-select">

										<option value="0">Sort By Popularity</option>

										<option value="0">Sort By Average Rating</option>

										<option value="0">Sort By Newness</option>

										<option value="0">Sort By Price: Low to High</option>

										<option value="0">Sort By Price: High to Low</option>

									</select>

								</div>

								<p class="result-show-message">Showing 1–12 of 41 results</p>

							</div>

						</div>

					</div>

					

					<!--=======  End of Shop header  =======-->



					<!--=======  Grid list view  =======-->

					

					<div class="shop-product-wrap grid row no-gutters mb-35" id="ajaxpagination">

						<?php if(!empty($products)){foreach($products as $featp){?>

							<div class="col-xl-4 col-lg-4 col-md-6 col-sm-6 col-12">

								<div class="gf-product shop-grid-view-product">

									<div class="image">

												<a href="<?php echo base_url().str_replace(" ","-",$featp->cat_name).'/details/'.str_replace(" ","-",$featp->title).'/'.$featp->pid;?>">

                                    <span class="onsale">Sale!</span>

                                    <img src="<?php echo base_url();?>assets/images/products/<?php echo $featp->img;?>" class="img-fluid" alt="">

												</a>

												<div class="product-hover-icons">

                    <a href="<?php echo $featp->pid;?>" class="wishlist" data-tooltip="Add to wishlist"> <span class="icon_heart_alt"></span> </a>

                     <a href="<?php echo $featp->pid;?>" data-tooltip="Quick view" data-toggle = "modal" data-target="#quick-view-modal-container" class="quick_view"> <span class="icon_search"></span> </a>

												</div>

											</div>

									 <div class="product-content">

												<!--<div class="product-categories">

													<a href="shop-left-sidebar.html">Fast Foods</a>,

													<a href="shop-left-sidebar.html">Vegetables</a>

												</div>-->

												<h3 class="product-title"><a href="<?php echo base_url().str_replace(" ","-",$featp->cat_name).'/details/'.str_replace(" ","-",$featp->title).'/'.$featp->pid;?>"><?php echo $featp->title;?></a></h3>

												<div class="price-box pbox<?php echo $featp->pid;?>">

                                                <?php if($featp->prod_type=="Normal"){if($featp->oprice!=""){?>

                        <span class="main-price"><i class="fa fa-inr"></i> <?php echo $featp->price;?></span>

                        <span class="discounted-price"><i class="fa fa-inr"></i><?php echo $featp->oprice;?></span>

                                                <?php }else{?>

                       <span class="discounted-price"><i class="fa fa-inr"></i><?php echo $featp->price;?></span>

                                                <?php }}else{$prices=explode(",",$featp->prices);$oprices=explode(",",$featp->oprices);

												if($featp->oprices!=""){?>

                       <span class="main-price"><i class="fa fa-inr"></i> <?php echo $prices[0];?></span>

                       <span class="discounted-price"><i class="fa fa-inr"></i><?php echo $oprices[0];?></span>

                                                <?php }else{?>

                       <span class="discounted-price"><i class="fa fa-inr"></i><?php echo $prices[0];?></span>

                                                <?php }}?>

												</div>

                                                <form action="" method="post" class="addtocart">

                                                <input type="hidden" name="pid" value="<?php echo $featp->pid;?>" />

                                                <input type="hidden" name="qty" value="1" />

                                                <div class="row">

                                                <div class="col-md-5">

                                                <?php if($featp->prod_type=="Variant"){$type=explode(",",$featp->packs);$colsize=7;?>

                                                <select name="type" class="form-control prod_type" id="<?php echo $featp->pid;?>"><?php

                                                $i=0;foreach($type as $t){

									echo '<option value="'.$i.'">'.$t.'</option>';

                                                $i++;}?></select><?php }else{$colsize=12;}?></div> <div class="col-md-<?php echo $colsize;?>">

                                                <button class="btn btn-xs btn-success"><i class="fa fa-shopping-cart"></i> Add to Cart</button>

                                                </div></div>

                                                </form>

											</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>

					

					<!--=======  End of Grid list view  =======-->



					<!--=======  Pagination container  =======-->

					

					<div class="pagination-container">

						<div class="container">

							<div class="row">

								<div class="col-lg-12">

									<!--=======  pagination-content  =======-->

									

									<div class="pagination-content text-center">

										<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>

									

									<!--=======  End of pagination-content  =======-->

								</div>

							</div>

						</div>

					</div>

					

					<!--=======  End of Pagination container  =======-->



				</div>

			</div>

		</div>

	</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>