
<div class="container marg_top">
<div class="col-md-10  bord_rt2 registor_outer"  >
<div class="col-md-12 registor">
<style>

table thead { font-size:14px;}

.quantity {
  position: relative; width:100%; height:30px;
}

input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button
{
  -webkit-appearance: none;
  margin: 0;
}

input[type=number]
{
  -moz-appearance: textfield;
}

.quantity input {
  width: 30px;
  height: 30px;
  line-height: 1.65;
  float: left;
  display: block;
  padding: 0;
  margin: 0;
  text-align:center;
  border: 1px solid #eee;
  margin-right:0px;
 
  
  
}

.quantity input:focus {
  outline: 0;
}

.quantity-nav {
  float: left;
  position: relative; display:none;
}

.quantity-button {
  position: relative;
  cursor: pointer;
  border: 1px solid #eee;
  width: 30px;
  height:30px;
  background-color:#ffffff;
  text-align: center;
  color: #333;
  font-size: 16px;
  font-family: "Trebuchet MS", Helvetica, sans-serif !important;
  line-height: 1.7;

}

.quantity .qur_1 { float:left;}
.quantity .qur_2 { float:left; }
.quantity input { float:left; }
.quantity .qur_1 .quantity-up { float:left;}
.quantity .qur_2 .quantity-down { float:left;}





.quantity-button.quantity-up {


  top: 0;
  border-bottom: 1px solid #eee;
}

.quantity-button.quantity-up:hover { background-color:#cccccc;}
.quantity-button.quantity-down:hover  { background-color:#cccccc;}

.quantity-button.quantity-down {

  bottom: -0px;

}
</style>

<?php if( $thanks!='') { ?>
<p>&nbsp;</p><h4 style=" text-transform:none;"><?php  echo $thanks ?></h4><?php } ?>


<?php  
 $currentURL = current_url(); 
$url=urlencode(base64_encode($currentURL));
echo form_open('Cart/update/'.$url.''); ?>
<form method="post">
<table class="table table-striped fnt_siz">

<h4 class="inner_bt" > <i class="fa fa-shopping-cart"></i> My Basket</h4>
    <tbody>
            <?php $i = 1; ?>
      <?php foreach ($this->cart->contents() as $items): ?>
<?php echo form_hidden($i.'[rowid]', $items['rowid']); ?>
      <tr class="text-left" >

<td align="left"  style="max-width:500px;">
            
<a href="<?php echo site_url( 'Product/view/'.$items['id'].'/'.$items['category_id'].'/'.$items['unit_id'].'/'.url_title($items['name'],'-',true) ) ; ?>">   
<img src="<?php echo base_url('assets/images/'.$items['image']) ; ?>" style="width:50px; border:2px solid #cccccc; padding:5px; margin-right:10px;" align="left" >	
<?php echo $items['name']; ?> 
</a>


<?php if ($this->cart->has_options($items['rowid']) == TRUE): ?>
<p>

					<?php foreach ($this->cart->product_options($items['rowid']) as $option_name => $option_value): ?>



					 <?php  $option_value; ?>



					<?php endforeach; ?>

				</p>



			<?php endif; ?>	 
            
            
            
  

            
            
            
            
            
            
            
            
             </td>

      
<td align="left">
   
<div class="clr"></div>
    
      
<?php
$sql ="SELECT * FROM shop_product where aid=".$items['id']."";

$query = $this->db->query($sql);

if ($query->num_rows() > 0) {
foreach($query->result() as $row) {
$pro_quty=$row->stock2;
$unit_weight=$row->weight; 
}
}
?>  

      
	  <div class="quantity">
      <div class="qur_2"><div class="quantity-button quantity-down">-</div></div>
      
<?php echo form_input(array('name' => $i.'[qty]', 'value' => $items['qty'], 'maxlength' => '3','id'=>'quantity', 'size' => '5','type' => 'number','min' => '0','max' => $pro_quty )); ?>
      
     <div class="qur_1"><div class="quantity-button quantity-up">+</div></div>
     
     
     
      </div>
      <?php echo form_input(array('name' => $i.'[id]', 'value' => $items['id'], 'maxlength' => '3','id'=>'id', 'size' => '5','type' => 'hidden' )); ?>
      
      

<span style="font-size:10px; text-align:left;">Available product quantity : <?=$pro_quty?></span>
      </td>




<td style="text-align:right"><?php echo $this->cart->format_number($items['price']); ?> <?php // echo  $unit_weight; ?> / 


<?php $uid=$items['unit_id']; 


$sql ="SELECT * FROM shop_unit where id=$uid";

$query = $this->db->query($sql);

if ($query->num_rows() > 0) {

  foreach ($query->result() as $row) {?>

<?php echo $row->title;?>
     <?php echo $row->options;?>

<?php } } ?> </td>

      

<td style="text-align:right"><?php echo $this->cart->format_number($items['subtotal']); ?>


<?php  $product_wait=$unit_weight* $items['qty'];  $sum+= $product_wait; ?> 


</td>

<td class="text-center"  >

								
      

      <a href="<?php echo site_url('Cart/delete_item/'.$items['rowid']); ?>" class="remove" onclick="return confirm('Delete this Item ? ')">
<i class="fa fas fa-times btn-danger btn-sm"></i>     </a>




</td>	

</tr>  



<?php $i++; ?>
<?php endforeach; ?>
      
      
      

      
        <tr>
   <td colspan="4">
<p><?php  echo form_submit('update', 'Update Cart','class="add_home pull-right"'); ?>

<?php $currentURL = current_url(); 
$url=urlencode(base64_encode($currentURL));
?>
<a href="<?php echo site_url('Cart/delete/'.$url.'') ; ?>" class="add_home pull-right" onclick="return confirm('Empty Cart ?')">Empty Cart</a></p>

  </td>
  
  <td></td>
    </tr>
      
    </tbody>
  </table>
  
<table class="table table-striped fnt_siz">





<?php if($option_value==1 || $option_value=='' ) {
	
	$total=$this->cart->format_number($this->cart->total());  /*$total=$this->cart->format_number($this->cart->total()); */
  $total=$this->cart->total();
 } else {?> 

      <tr>
        <td>Delivery Charge </td>
        <td>
        
        <?php $total=$this->cart->format_number($this->cart->total());  /*$total=$this->cart->format_number($this->cart->total()); */
  $total=$this->cart->total(); ?>
        
        
 <?php if($total < 2500) { 
 if($site): foreach($site as $site_row):
$dvtcharge=$site_row['dvtcharge'];
endforeach; endif; ?>
<?=$dvtcharge?>.00 <?php  }  else { echo "Free Delivery"; $dvtcharge=0; } ?> 
   
   </td>
        
      </tr>
      <?php } ?>
     
     
        
      <tr>
        <td><b style="font-size:15px;">Total</b></td>
<td ><b style="font-size:15px;">
<?php   if($total!='' ){ $tayal2=$total+$dvtcharge; echo $tayal2; echo ".00"; $total=$this->cart->format_number($tayal2);}  else {echo "00.00"; } ?></b></td>
        
  </tr>
  
  <tr>
   <td colspan="2" >
   <p>&nbsp;</p>

<div class="col-md-4">  
<label class="roundss">Shop Delivery
  <input type="radio" value="1" <?php if($option_value==1){ echo 'checked="checked"'; } ?> required="required" name="dtype">
  <span class="checkmark"></span>
</label>
</div>

<div class="col-md-4">  
<label class="roundss"> Door  Delivery
  <input type="radio" value="2" <?php if($option_value==2){ echo 'checked="checked"'; } ?> required="required"  name="dtype">
  <span class="checkmark"></span>
</label>
</div>
   
   
   
   
<p><?php echo form_submit('placeorder','Place Order','class=" add_home pull-right"') ; ?></p>
  </td>
    </tr>
  
  </table>
  
  </form>
 






<!-------------------increment jquery----------------------->



<script type="text/javascript" src="<?php echo base_url('assets/website/incre/jquery2.js');?>"></script>
<script>    jQuery('<div class="quantity-nav"><div class="quantity-button quantity-up">+</div><div class="quantity-button quantity-down">-</div></div>').insertAfter('.quantity input');
    jQuery('.quantity').each(function() {
      var spinner = jQuery(this),
        input = spinner.find('input[type="number"]'),
        btnUp = spinner.find('.quantity-up'),
        btnDown = spinner.find('.quantity-down'),
        min = input.attr('min'),
        max = input.attr('max');

      btnUp.click(function() {
        var oldValue = parseFloat(input.val());
        if (oldValue >= max) {
          var newVal = oldValue;
        } else {
          var newVal = oldValue + 1;
        }
        spinner.find("input").val(newVal);
        spinner.find("input").trigger("change");
      });

      btnDown.click(function() {
        var oldValue = parseFloat(input.val());
        if (oldValue <= min) {
          var newVal = oldValue;
        } else {
          var newVal = oldValue - 1;
        }
        spinner.find("input").val(newVal);
        spinner.find("input").trigger("change");
      });

    });
//# sourceURL=pen.js
</script>
<!-------------------increment jquery----------------------->


  
</div>
</div>

<div class="clr2"></div>

<?php
$this->load->view('website/side');
?>


</div>


