MMCT TEAM
Server IP : 103.53.40.154  /  Your IP : 18.191.93.18
Web Server : Apache
System : Linux md-in-35.webhostbox.net 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64
User : ppcad7no ( 715)
PHP Version : 8.2.25
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0750) :  /home2/ppcad7no/lizatilessolution.com/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home2/ppcad7no/lizatilessolution.com/cart.php
<?php include("site-header.php"); ?>
    
 


<nav class="breadcrumb" aria-label="breadcrumbs" style="margin-top: 90px;">
 
 <?php
//echo date("d-m-Y");
 ?>  
  
  <h1>Shopping Cart</h1>
  <a href="<?=$site_url?>" title="Back to the home">Home</a>

  <span aria-hidden="true" class="breadcrumb__sep">&#47;</span>
  <span>      Shopping Cart </span>

  
</nav>
  <div class="dt-sc-hr-invisible-large"></div>     

      
    <main class="main-content ">  
      
      <div class="wrapper">
        
        <div class="grid__item">           
          <div class="jas-container">
<?php 
$sub_total_cart=0;
$tax_cart=0;
$total_cart=0;
$i=0;
$cart_sql=db_query("select * from tbl_basket where bskt_session_id='$_SESSION[cart_session_id]'");
if(mysqli_num_rows($cart_sql)>0){
?>  
  <table class="shop_table cart wishlist_table">
    <thead>
      <tr>

        <th class="product-name"><span class="nobr">Image</span></th>
        <th class="product-name"><span class="nobr">Product</span></th>
        <th class="product-name" colspan="2"><span class="nobr">Features</span></th>
        <th class="product-price"> <span class="nobr">Price</span></th>
        <th class="product-price"> <span class="nobr">Quantity</span></th>
        <th class="product-price"> <span class="nobr">Total</span></th>
        
        <th class="product-stock-stauts"> <span class="nobr">Action</span> </th>
      </tr>
    </thead>
    <tbody class="wishlist-box">
<?php
while($cart_res=mysqli_fetch_array($cart_sql))
{
     $i++;
$sub_total_cart=$sub_total_cart+$cart_res['bskt_prd_subtotal'];
?>
        <tr>
<td>
    <img style="width:100px;" src="<?=$site_url?>/uploaded_files/<?=$cart_res['bskt_prd_image_name']?>" alt="<?=$cart_res['bskt_prd_name']?>" title="<?=$cart_res['bskt_prd_name']?>">
</td>

<td>
    <a href="<?=$site_url?>/product-details.html?id=<?=$cart_res['bskt_prd_id']?>" target="_blank">
<?=$cart_res['bskt_prd_name']?>
</a>
</td>

<td style="text-align:left;">
<b>Brand:</b> <?=db_scalar("select category_brand  from tbl_category where category_id='$cart_res[bskt_prd_id]' ");?>
<br>
<b>Tile Type:</b> <?=db_scalar("select category_quality  from tbl_category where category_id='$cart_res[bskt_prd_id]' ");?>
<br>
<b>Finish Type:</b> <?=db_scalar("select category_finish_type  from tbl_category where category_id='$cart_res[bskt_prd_id]' ");?>

<br>
<b>Design:</b> <?=db_scalar("select category_design  from tbl_category where category_id='$cart_res[bskt_prd_id]' ");?>

<br>
<b>Category:</b> 
<?php $parent_ID=db_scalar("select category_parent_id  from tbl_category where category_id='$cart_res[bskt_prd_id]' ");
echo db_scalar("select category_name  from tbl_category where category_id='$parent_ID' ");
?>

</td>
<td>
    
    
<?php
$color = db_scalar("select category_color from tbl_category where category_id='$cart_res[bskt_prd_id]'");
$myArray_color = explode(',', $color);
$Arr_color=sizeof($myArray_color);
if($color!=""){
?>
<b>Color: </b>
<select name="cart_pro_color_<?=$i?>" id="cart_pro_color_<?=$i?>" onchange="change_color(<?=$i?>,<?=$cart_res['bskt_id']?>)" style="width:210px;">
<option value="">Choose Color</option>
<?php
for($k=0; $k<$Arr_color; $k++)
{
?>
<option value="<?=$myArray_color[$k]?>" <?php if($cart_res['color']==$myArray_color[$k]){?> selected <?}?> ><?=$myArray_color[$k]?></option>
<?}?>
</select>

<?}?>
<br>

        <?php
$size = db_scalar("select category_size from tbl_category where category_id='$cart_res[bskt_prd_id]'");
$myArray = explode(',', $size);
$Arr_size=sizeof($myArray);
if($size!=""){
?>
<b>Size: </b>
<select name="cart_pro_size_<?=$i?>" id="cart_pro_size_<?=$i?>" onchange="change_size(<?=$i?>,<?=$cart_res['bskt_id']?>)" style="width:220px; margin-top:5px;">
<option value="">Choose Size</option>
<?php
for($j=0; $j<$Arr_size; $j++)
{
?>
<option value="<?=$myArray[$j]?>" <?php if($cart_res['size']==$myArray[$j]){?> selected <?}?> ><?=$myArray[$j]?></option>
<?}?>
</select>

<?}?>

<br>


<?php
$area = db_scalar("select category_area from tbl_category where category_id='$cart_res[bskt_prd_id]'");
$myArray_area = explode(',', $area);
$Arr_area=sizeof($myArray_area);
if($area!=""){
?>
<b>Area: </b>
<select name="cart_pro_area_<?=$i?>" id="cart_pro_area_<?=$i?>" onchange="change_area(<?=$i?>,<?=$cart_res['bskt_id']?>)" style="width:212px; margin-top:5px;">
<option value="">Choose Area</option>
<?php
for($l=0; $l<$Arr_area; $l++)
{
?>
<option value="<?=$myArray_area[$l]?>" <?php if($cart_res['area']==$myArray_area[$l]){?> selected <?}?> ><?=$myArray_area[$l]?></option>
<?}?>
</select>

<?}?>





</td>

<td>
<i class="fa fa-inr"></i> <?=$cart_res['bskt_prd_unit_price']?>
</td>

<td>
    <center>
 <input min="1" value="<?=$cart_res['bskt_prd_qnty']?>" type="number" id="<?=$i?>" onchange="inc_qty('<?=$i?>','<?=$cart_res[bskt_id]?>');" style="width:80px;">
</center>
</td>

<td><i class="fa fa-inr"></i> <?=$cart_res['bskt_prd_subtotal']?></td>


<td>
<a onclick="del_cart_from_cart('<?=$cart_res['bskt_id']?>');" href="javascript:void(0)">
<i class="fa fa-trash-o"></i></a>
</td>
</tr>
<?}?>
       <tr>
<td colspan="8" >

 <table class="shop_table cart wishlist_table" style="width:500px; color:#e81a46;" align="right">
      <thead>
      <tr>
       <th class="product-name"><span class="nobr">
            Subtotal
        </span></th>
           <th class="product-name"><span class="nobr">
           <i class="fa fa-inr"></i><?=$sub_total_cart?>
        </span></th>
        </tr>
        <tr>
        
        <th class="product-name"><span class="nobr">
            Tax Amount
        </span></th>
          <th class="product-name"><span class="nobr">
           <i class="fa fa-inr"></i><?php 
					  echo $tax_cart=calculate_tax($sub_total_cart,$compDATA["admin_gst_rate"]);
					  $total_cart=$tax_cart+$sub_total_cart;
					  ?>
      </span></th>
        </tr>
        <tr>
        <th class="product-name"><span class="nobr">
            Grand Total
        </span></th>
           <th class="product-name"><span class="nobr">
           <i class="fa fa-inr"></i><?=$total_cart?>
       </span></th>
      </tr>
    </thead>
  </table>
  </td>
</tr>
  
    </tbody>
    <tfoot>
      <tr>
        <td colspan="8"  style="text-align:right; border-top:hidden;">

            <a href="javascript:void(0)" id="proceed_checkout" class="btn" onclick="check_size(<?=$i?>);">Proceed to Checkout</a>
        </td>
      </tr>
    </tfoot>
  </table >
    
    
    
 
  
  
  <?}else{?>
  <h1 style="color:red; text-align:center;">
      Your cart is currently empty!
  </h1>
 <?}?>
</div>
		          
        </div>          
        
      </div>
      
      
       <div class="dt-sc-hr-invisible-large"></div>
    </main>  
    
    
    
      <script>
 function change_size(size,bskt_id)
 {
     
var size_value = document.getElementById("cart_pro_size_"+size+"").value;
//alert(bskt_id);
//alert(size_value);
 $.ajax({
            url:"<?=$site_url?>/change_cart_pro_size.php",
            type:"POST",
            data:{size_value:size_value, bskt_id:bskt_id},
            success:function(data){
            if(data=="updated")
            {
                 swal("Size Taken successfully", "", "success");
                
            }
           
       
            }
        });
 }
 
 
  function change_color(color, bskt_id)
 {
     
var color_value = document.getElementById("cart_pro_color_"+color+"").value;
//alert(bskt_id);
//alert(size_value);
 $.ajax({
            url:"<?=$site_url?>/change_cart_pro_color.php",
            type:"POST",
            data:{color_value:color_value, bskt_id:bskt_id},
            success:function(data){
            if(data=="updated")
            {
                 swal("Color Taken successfully", "", "success");
                
            }
           
       
            }
        });
 }
 
 
  function change_area(area, bskt_id)
 {
     
var area_value = document.getElementById("cart_pro_area_"+area+"").value;
//alert(bskt_id);
//alert(size_value);
 $.ajax({
            url:"<?=$site_url?>/change_cart_pro_area.php",
            type:"POST",
            data:{area_value:area_value, bskt_id:bskt_id},
            success:function(data){
            if(data=="updated")
            {
                 swal("Area Taken successfully", "", "success");
                
            }
           
       
            }
        });
 }
 
  function check_size(count_c_s)
 {

var flag_size=0;
var s=1;


var flag_color=0;
var c=1;

var flag_area=0;
var a=1;


if(count_c_s!="" || !empry(count_c_s))
{
while(s<=count_c_s)
{
var size = document.getElementById("cart_pro_size_"+s+"");
if(size){
if(size.value=="")
{
flag_size++;
}
}
s++;
}


while(c<=count_c_s)
{
var color = document.getElementById("cart_pro_color_"+c+"");
if(color){
if(color.value=="")
{
flag_color++;
}
}
c++;
}

while(a<=count_c_s)
{
var area = document.getElementById("cart_pro_area_"+a+"");
if(area){
if(area.value=="")
{
flag_area++;
}
}
a++;
}


 if(flag_color!=0)
 {
swal("Please select color !", "", "error");
 }else  if(flag_size!=0)
 {
swal("Please select size !", "", "error");
 }else if(flag_area!=0)
 {
swal("Please select area !", "", "error");
 }else {
  window.location.href="<?=$site_url?>/checkout.html";
 }
 
  
     }

 }
 
 
 
    function inc_qty(qty,pro_id)
                {
                  
                 var qty_value = document.getElementById(qty).value;
                 
                 //   alert(qty_value);
                 //   alert(pro_id);
                 
                  //  document.getElementById('show_sub_total_'+qty).innerHTML="hello_"+qty;
                    
             $.ajax({
            url:"<?=$site_url?>/inc_qty_ajax.php",
            type:"POST",
            data:{qty_value:qty_value, pro_id:pro_id},
            success:function(data){
            if(data=="updated")
            {
 swal({title: "Updated", text: "Quantity updated successfully",showConfirmButton: true, allowEscapeKey : false, allowOutsideClick: false, type: "success"},
   function(){ 
       location.reload();
   }
);
}else{
   //  swal("Quantity not available !", "", "error");
      swal({title: "Quantity not available !", text: "",showConfirmButton: true, allowEscapeKey : false, allowOutsideClick: false, type: "error"},
   function(){ 
/*$('#update_cart').attr("disabled","disabled");
$('#update_cart').css({"cursor":"no-drop"});*/
$('#proceed_checkout').css({"display":"none"});

   }
);
}
           
       
            }
        });
                    
                }
                
                
   function del_cart_from_cart(id)
    {
     
                $.ajax({
            url:"<?=$site_url?>/delete_cart_item_ajax.php",
            type:"POST",
            data:{id:id},
            success:function(data){

                if(data!=""){
          
          swal({title: "Deleted", text: "Item deleted from your cart",showConfirmButton: true, allowEscapeKey : false, allowOutsideClick: false, type: "success"},
   function(){ 
       location.reload();
   }
);
                }
            }
        });
    }


 </script>
    <?php include("site-footer.php"); ?>

MMCT - 2023