<script>

$(document).ready(function(){

	$("#addtocart").submit(function(e){e.preventDefault();



			var formdata=$(this).serialize();



			///alert(formdata);



			$.ajax({



				 type: "POST",



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



				 data: {formdata:formdata},



				 success: function(response){



					 //alert(response);



					 $("#cart-floating-box").html(response);



					 swal("Product Added to your Cart.");



				 }



				 });



			setTimeout(function(){



			 $.ajax({



			 type: "POST",



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



			 data: {id:"asdf"},



			 success: function(response){



				 //alert(response);



				 $("#items_total").html(response);



			 }



			 });



			},1000);



		});

	$(".addbtn").click(function(e){e.preventDefault();

		<?php if($pro->prod_type=="Variant"){?>

		if($(".prod_type").val()==''){alert("Please Select Packtype");return false;}

		<?php }?>

		$("form#addtocart").trigger('submit');

	});

});

</script>

<div class="breadcrumb section pt-60 pb-60 mb-30">

      <div class="container">

        <h1 class="uppercase"><?php echo str_replace("-"," ",$this->uri->segment(3));?></h1>

        <ul>

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

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

            <li><a href="#"><?php echo str_replace("-"," ",$this->uri->segment(2));?></a></li>

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

        </ul>

      </div>

    </div>





    <div class="product-section section">

    <!-- =====  CONTAINER START  ===== -->

      <div class="container">

        <div class="row">

          <div class="col-12 mb-20">

            <div class="row mt_10 ">

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

                <div><a class="thumbnails"> 

                <img data-name="product_image" src="<?php echo base_url();?>assets/images/products/<?php echo $pro->img;?>" alt="" /></a></div>

                <div id="product-thumbnail" class="owl-carousel">

                <?php $i=2;$imgs=explode(",",$pro->extimgs);

								foreach($imgs as $img){?>

<div class="item">

<div class="image-additional"><a class="thumbnail" href="<?php echo base_url();?>assets/images/products/<?php echo $img;?>" data-fancybox="group1"> 

<img src="<?php echo base_url();?>assets/images/products/<?php echo $img;?>" alt="" /></a></div>

</div>

<?php }?>

                </div>

              </div>

              <div class="col-md-7 prodetail caption">

                <h4 data-name="product_name" class="product-name">

                <a href="#"><?php echo $pro->title;?></a></h4>

                 <!-- <div class="rating mt-5 mb-5"> 

                  <span class="fa fa-stack"><i class="fa fa-star fa-stack-1x"></i></span> 

                  <span class="fa fa-stack"><i class="fa fa-star fa-stack-1x"></i></span> 

                  <span class="fa fa-stack"><i class="fa fa-star fa-stack-1x"></i></span> 

                  <span class="fa fa-stack"><i class="fa fa-star fa-stack-1x"></i></span> 

                  <span class="fa fa-stack"><i class="fa fa-star fa-stack-x"></i></span> 

                  </div>-->

                <h3 class="price text-success"><i class="fa fa-inr"></i><b id="price_<?php echo $pro->pid;?>"><?php echo $pro->selling_price;?></b>

    <del class="price-tax text-danger" id="oldprice_<?php echo $pro->pid;?>"><?php echo $pro->pmrp;?></del></h3>

                </span>

                <hr>

                <ul class="list-unstyled product_info my-3">

                  <!--<li>

                    <label>Brand:</label>

                    <span> <a href="#"><?php echo $pro->brand;?></a></span></li>

                  <li>

                    <label>Product Code:</label>

                    <span> product 20</span></li>

                  <li>-->

                    <label>Availability:</label>

                    <span> In Stock</span></li>

                </ul>

                <hr>

                <p class="product-desc mt-20"> <?php echo $pro->sdesc;?></p>

                <div id="product">

                  

                  <div class="product_option">

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

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

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

                  <input type="hidden" name="price" value="<?php echo $pro->selling_price;?>" />

                  <input type="hidden" name="mrp" value="<?php echo $pro->pmrp;?>" />

                  <?php if($pro->prod_type=="Variant"){?>

                  <div class="form-group">

                    <div class="row">

                      <div class="Color col-lg-6 col-12 mt-20">

                        <label>Select Pack Type</label>

                        <select name="pvariant" id="<?php echo $pro->pid;?>" required class="selectpicker form-control prod_type">

                          <?php $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",$pro->pid);

						  $this->db->where("prod_stock.city_id",$this->session->userdata("city"));

						  //$this->db->group_by("prod_variants.pid");

						  $pvs=$this->db->get()->result();?>

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

                    </div>

                  </div>

                  <?php }?>

                  <div class="qty mt-30 form-group">

                    <label>Qty</label>

                    <input name="qty" min="1" value="1" type="number">

                  </div>

                  </form>

                  <div class="button-group mt-30">

<div class="add-to-cart" data-toggle="tooltip" title="" data-original-title="Add to cart">

<a href="#" class="addbtn"><span>Add</span></a></div>

<!--<div class="wishlist" data-toggle="tooltip" title="" data-original-title="Wish list">

<a href="#"><span><i class="fa fa-heart"></i></span></a></div>

<div class="compare" data-toggle="tooltip" title="" data-original-title="Compare">

<a href="#"><span><i class="fa fa-share"></i></span></a></div>-->

                  </div>

                  <!--<div class="prodbottominfo">

                    <ul class="list-unstyled">                    

                      <li data-toggle="tooltip" title="" data-original-title="Worldwide Shipping">

                        <img src="<?php echo base_url();?>asset/images/world.png" alt=""> 

                      </li>

                      <li data-toggle="tooltip" title="" data-original-title="100% Original Product">

                        <img src="<?php echo base_url();?>asset/images/original.png" alt=""> 

                      </li>

                      <li data-toggle="tooltip" title="" data-original-title="Best Price Guaranteed">

                        <img src="<?php echo base_url();?>asset/images/inquire.png" alt=""> 

                      </li>

                       <li data-toggle="tooltip" title="" data-original-title="COD Available in India">

                         <img src="<?php echo base_url();?>asset/images/cod.png" alt=""> 

                      </li>

                    </ul>

                  </div>-->


                </div>

              </div>

            </div>

            <div class="row" style="display:none;">

              <div class="col-12 my-5">

                <ul class="nav nav-tabs mb-30" id="myTab" role="tablist">

                  <li class="nav-item">

                    <a class="nav-link active" id="overview-tab" data-toggle="tab" href="#Overview" role="tab" aria-controls="Overview" aria-selected="true">Overview</a>

                  </li>

                  <li class="nav-item">

                    <a class="nav-link" id="reviews-tab" data-toggle="tab" href="#Reviews" role="tab" aria-controls="reviews-tab" aria-selected="false">Reviews (1)</a>

                  </li>

                </ul>

                <div class="tab-content" id="myTabContent">

                  <div class="tab-pane fade show active" id="Overview" role="tabpanel" aria-labelledby="Overview">

                  <?php echo $pro->sdesc;?>

                  </div>

                  <div class="tab-pane fade" id="Reviews" role="tabpanel" aria-labelledby="Reviews">

                    <form>

                      <div id="review"></div>

                      <h4 class="mt-5 mb-10">Write a review</h4>

                      <div class="form-group required">

                        <label for="formGroupExampleInput">Your Name</label>

                        <input type="text" class="form-control" id="formGroupExampleInput" placeholder="Your Name">

                      </div>

                      <div class="form-group required">

                        <label for="formGroupExampleInput2">Your Review</label>

                        <textarea class="form-control" id="formGroupExampleInput2" placeholder="Your Review"></textarea>

                        <div class="help-block"><span class="text-danger">Note:</span> HTML is not translated!</div>

                      </div>

                      <div class="form-group row align-items-center">

                        <div class="col-8 col-md-9">

                          <label class="control-label">Rating</label>

                          <div class="rates"> <span class="ml-10"> Bad</span>

                          <input type="radio" name="rating" value="1">

                          <input type="radio" name="rating" value="2">

                          <input type="radio" name="rating" value="3">

                          <input type="radio" name="rating" value="4">

                          <input type="radio" name="rating" value="5">

                          <span>Good</span></div>

                        </div>

                        <div class="col-4 col-md-3">

                          <div class="buttons pull-right">

                              <button type="submit" class="btn">Continue</button>

                          </div>

                        </div>

                      </div>

                    </form>



                  </div>

                  <div class="tab-pane fade" id="Solution" role="tabpanel" aria-labelledby="Solution"><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut lobortis malesuada mi id tristique. Sed ipsum nisi, dapibus at faucibus non, dictum a diam. Nunc vitae interdum diam. Sed finibus, justo vel maximus facilisis, sapien turpis euismod tellus, vulputate semper diam ipsum vel tellus.applied clearfix to the tab-content to rid of the gap between the tab and the content</p></div>

                </div>



              </div>

            </div>

            <div class="row">

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

                <div class="heading-part text-center mb-10">

                  <h3 class="section_title mt-50">Related Products</h3>

                </div>

                <div class="related_pro">

                  <div class="product-layout related-pro  owl-carousel mb-50 ">

                    <?php 

						$this->db->select("*");

						$this->db->from('products');		

						$this->db->join("category","products.cid=category.cid");

						//$this->db->join("subcategory","products.sid=subcategory.sid");

						$this->db->join("prod_stock","prod_stock.prod_id=products.pid");

						$this->db->join("prod_variants","prod_variants.pid=products.pid");

						$this->db->where("prod_stock.city_id",$this->session->userdata("city"));

						$this->db->where("prod_stock.pin_feat","yes");

						$this->db->where("products.cid",$pro->cid);

						$this->db->where("products.pid!=",$pro->pid);

						$this->db->group_by("prod_stock.prod_id");

						$feat=$this->db->get()->result();

						foreach($feat as $featp){?>

                   	    <div class="product-grid">

                          <div class="item">

                             <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="qty" value="1" />-->

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

                        </div>

                    <?php }?>

                  </div>

                </div>

              </div>

            </div>

          </div>

        </div>



      <!-- =====  Brand start ===== -->

      <div id="brand_carouse" class="section text-center mt-30 pb-15">

        <div class="row">

          <div class="col-12">

            <div class="section_title">Our Popular Brands</div>

          </div>

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

            <div class="brand owl-carousel">

            <?php $brands=$this->db->get("brands")->result();

			foreach($brands as $br){?>

              <div class="product-thumb"><div class="item text-center"> <a href="#">

              <img src="<?php echo base_url().'assets/images/'.$br->brand_logo;?>" class="img-responsive" /></a> </div></div>

              <?php }?>

            </div>

          </div>

        </div>

      </div>

      <!-- =====  Brand end ===== -->



      </div>

    <!-- =====  CONTAINER END  ===== -->

    </div>