<?php if(!empty($products)){foreach($products as $featp){?>
    <div class=" product-items col-6 col-sm-4 col-md-4 col-lg-3">
              <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 }?>