]]jkjjgdjffksdkdxdsghfghdfghfgdfsdsdfsdfsfdsbcxvxcbccwewqeqwewqskfgj
במ12[cxvbcxvbxcvbcxvcxvbcvxcvbsdfsdfsdfsdfsdfsdfxcvbxcvxbbxqwqewqewv;'
/
home
/
u506006416
/
domains
/
crystalmiracle.co.in
/
public_html
/
Upload FileeE
HOME
<?php include_once("header.php"); /*============= Offers Discount Function =============*/ function offers_discount($p_id='', $qty=''){ $sel_obj = new config(); $p_cond="`p_id`=".$p_id; $p_qu=$sel_obj->display_rcd("product",$p_cond); if(is_array($p_qu) AND !empty($p_qu)) { foreach($p_qu as $p_da) { } } $offer_array = array( 'offer_discount_amount' => 0 , 'offer_name' => NULL, 'shipping_price' => $p_da['shipping_price'], 'packaging_price' => $p_da['packaging_price'] ); $total_amount = $p_da['d_price']*$qty; $offers = json_decode($p_da['offers'], true); if (!empty($offers)) { foreach ($offers as $offer) { if ($qty >= $offer['offer_qty']) { if ($offer['offer_discount_type']=="percent") { $offer_discount_amount = ($offer['offer_discount']*$total_amount)/100; } if ($offer['offer_discount_type']=="flat") { $offer_discount_amount = $offer['offer_discount']; } if ($offer['free_delivery']==1) { $shipping_price = 0; }else{ $shipping_price = $p_da['shipping_price']; } if ($offer['free_packaging']==1) { $packaging_price = 0; }else{ $packaging_price = $p_da['packaging_price']; } $offer_array = array( 'offer_discount_amount' => round($offer_discount_amount) , 'offer_name' => $offer['offer_title'], 'shipping_price' => $shipping_price, 'packaging_price' => $packaging_price ); } } return $offer_array; }else { $offer_array = array( 'offer_discount_amount' => 0 , 'offer_name' => NULL, 'shipping_price' => $p_da['shipping_price'], 'packaging_price' => $p_da['packaging_price'] ); return $offer_array; } } // $off_array = offers_discount(1050, 8); // print_r($off_array); // die(); /*====================================================*/ /*----- Back Url ----*/ if ($_SERVER['HTTP_REFERER']) { $back_url = $_SERVER['HTTP_REFERER']; } else{ $back_url = "#"; } ?> <div class="my_load"> <div id="full_load"> <!-- Header End --> <!-- Breadcrumb Area start --> <section class="breadcrumb-area"> <div class="container"> <div class="row"> <div class="col-md-12"> <div class="breadcrumb-content"> <h1 class="breadcrumb-hrading">Cart</h1> <ul class="breadcrumb-links"> <li><a href="index.php">Home</a></li> <li><a href="<?php echo $back_url; ?>">Back</a></li> <li>Cart</li> </ul> </div> </div> </div> </div> </section> <!-- Breadcrumb Area End --> <!-- cart area start --> <div class="cart-main-area mtb-60px"> <div class="container"> <!--<div class="text-center">--> <!-- <b class="text-center">--> <!-- <a href="saved_item.php">Go to your saved items</a>--> <!-- </b>--> <!--</div>--> </div> <?php if(isset($checksession) and !empty($checksession)) { $where_con="`user_id`="."'$checksession' AND `status`= 1"; $count = $sel_obj->all_count_row('temp_cart',$where_con); } else { $where_con="`temp_id`="."'$temp_session_id' AND `status`= 1"; $count = $sel_obj->all_count_row('temp_cart',$where_con); } if($count>=1) { ?> <div class="container"> <h3 class="cart-page-title">Your cart items</h3> <div class="row"> <div class="col-lg-12 col-md-12 col-sm-12 col-12" > <form action="#" class="cartbosh"> <div class="table-content table-responsive cart-table-content"> <table class="table table-bordered"> <thead> <tr> <th>Image</th> <th>Product Name</th> <th style="padding:10px;">Unit Price</th> <th style="padding:10px;">Qty</th> <th>Subtotal</th> <th>GST</th> <th>total</th> <th style="padding:10px;">Weight</th> <th style="padding:4px!important;">Remove</th> <th style="padding:4px!important;">Save</th> </tr> </thead> <tbody> <?php if(isset($checksession) and !empty($checksession)) { $where_con="`user_id`="."'$checksession' AND `status`= 1"; $fetch_temp_cart = $sel_obj->display_rcd('temp_cart',$where_con); } else { $where_con="`temp_id`="."'$temp_session_id' AND `status`= 1"; $fetch_temp_cart = $sel_obj->display_rcd('temp_cart',$where_con); } if(is_array($fetch_temp_cart) || is_object($fetch_temp_cart)) { $total_gst = 0; $sub_total=""; $shipping_charge = 0; $packaging_charge = 0; $shipp_discount = 0; foreach($fetch_temp_cart as $temp_items) { /*----Product Info ------*/ $p_id = $temp_items['p_id']; $get_product_condition="`p_id`="."'$p_id'"; $get_product_query=$sel_obj->display_rcd("product",$get_product_condition); foreach($get_product_query as $get_product) { } /*---- check Quantity -------*/ if ($get_product['quan_available']<1) { $where = array( 'id' => $temp_items['id'], 'status' => 1 ); $sel_obj->delete("temp_cart", $where); } if ($temp_items['quantity'] > intval($get_product['quan_available'])) { $quantity = intval($get_product['quan_available']); }else{ $quantity = $temp_items['quantity']; } /*----Update Cart Values ----*/ $check_data = array( 'id' => $temp_items['id'], ); $update_data = array( 'p_name' => $get_product['p_name'], 'p_code' => $get_product['p_code'], 'img' => $get_product['p_img'], 'price' => $get_product['price'], 'd_price' => $get_product['d_price'], 'gst' => $get_product['gst'], 'quantity' => $quantity, // 'shipping_price' => $get_product['shipping_price'], // 'packaging_price' => $get_product['packaging_price'] ); /*---------- Check Offer Discount -------------*/ $off_array = offers_discount($temp_items['p_id'], $quantity); $update_data['shipping_price'] = $off_array['shipping_price']; $update_data['packaging_price'] = $off_array['packaging_price']; $update_data['offer_discount'] = $off_array['offer_discount_amount']; $update_data['offer_name'] = $off_array['offer_name']; /*---------------------------------------------*/ $update_rating=$sel_obj->update('temp_cart', $update_data, $check_data); /*---------------------------*/ if($temp_items['d_price']!='') { $price=$temp_items['d_price']; } else { $price=$temp_items['price']; } $gst=str_replace("%"," ",$temp_items['gst']); ?> <tr> <td class="product-thumbnail"> <a href="product_details.php?p_id=<?php echo $temp_items['p_id'];?>"><img class="img-responsive" src="admin/upload/<?php echo $temp_items['img'];?>" alt="" /></a> </td> <td class="product-name"> <a href="product_details.php?p_id=<?php echo $temp_items['p_id'];?>"><?php echo $temp_items['p_name'];?></a> <input type="hidden" value="<?php echo $temp_items['p_id'];?>" id="p_id<?php echo $temp_items['id'];?>"> </td> <td class="product-price-cart3"> <span class="amount">₹<?php echo round($price, 2);?></span> </td> <script> $(document).ready(function(){ var aValue = $('#qtn<?php echo $temp_items['id'];?>').val(); if (aValue == 0) { $('#qtn<?php echo $temp_items['id'];?>').val('1'); } }); </script> <td class="product-quantity"> <div class="cart-plus-minus"> <div class="dec qtybutton" id="qty_dec<?php echo $temp_items['id'] ?>">-</div> <input class="cart-plus-minus-box" type="number" id="qtn<?php echo $temp_items['id'];?>" value="<?php echo $temp_items['quantity'];?>" min="1"/> <div class="inc qtybutton" id="qty_inc<?php echo $temp_items['id'] ?>">+</div> </div> </td> <td class="product-subtotal"> <?php $totalamount=($temp_items['quantity']*$price); echo "₹". round($totalamount,'2');?> </td> <td> <?php if ($gst!="") { echo $gst."%"; }else{ echo "0%"; } ?> </td> <td class="product-subtotal"> <?php $finalgst=$sel_obj->get_percentage($totalamount,$gst); $finaltotal=$finalgst+$totalamount; echo "₹". round($finaltotal,'2'); $total_gst+=$finalgst; $sub_total+=$totalamount; $packaging_charge += $temp_items['packaging_price']*$temp_items['quantity']; /*------- Shipping Charge -------*/ $shipping_charge += $temp_items['shipping_price']*$temp_items['quantity']; /*------ Offer DIscount ---------*/ $offer_discount += $temp_items['offer_discount']; /*---------------------------------*/ /*------------ Dimension / Volume -----*/ $volume += $get_product['length_cm'] * $get_product['breadth_cm'] * $get_product['height_cm'] * $temp_items['quantity']; /*------------- Height ---------------*/ $total_height += $get_product['height_cm']*$temp_items['quantity'];; $length_array[] = $get_product['length_cm']; $breadth_array[] = $get_product['breadth_cm']; /*--------- Sorting --------*/ rsort($length_array); rsort($breadth_array); /*-------------------------------------*/ ?> </td> <td> <!-- ---- Weight ------- --> <?php $sum_weight = $get_product['weight']*$temp_items['quantity']; ?> <?php if($get_product['weight']!=0){ ?> <span ><?php echo round($sum_weight, 2);?>Kg</span> <?php } ?> <!-- --------------------- --> </td> <td class="product-remove"> <a href="javascript:;" style="color:#fff;" id="update<?php echo $temp_items['id'] ?>" data-id="<?php echo $temp_items['id'];?>" class="btn btn-primary btn-xs qtybuttonupdate d-none"><i class="fa fa-refresh" aria-hidden="true"></i> update</a> <a class="btn btn-danger btn-xs" style="color:#fff;" href="action.php?remove=<?php echo base64_encode($temp_items['id']);?>" onclick="return confirm('Do you want to delete..?');"><i class="fa fa-times"></i></a> </td> <td class=""> <a class="btn btn-primary btn-xs" style="color:#fff;" href="action.php?savetolater=<?php echo base64_encode($temp_items['id']);?>">Save for later</a> </td> </tr> <script> $(document).ready(function(){ $("#qtn<?php echo $temp_items['id'];?>").change(function() { var aValue = $('#qtn<?php echo $temp_items['id'];?>').val(); if (aValue < 0 || aValue == 0) { $('#qtn<?php echo $temp_items['id'];?>').val('1'); } // alert("UDIT"); $("#update<?php echo $temp_items['id'] ?>").trigger('click'); }); /*----------- + Button ---------------*/ $("#qty_inc<?php echo $temp_items['id'] ?>").on("click", function() { var $button = $(this); var oldValue = $button.parent().find("input").val(); if ($button.text() === "+") { var newVal = parseFloat(oldValue) + 1; } else { // Don't allow decrementing below zero if (oldValue > 1) { var newVal = parseFloat(oldValue) - 1; } else { newVal = 1; } } $button.parent().find("input").val(newVal); $("#update<?php echo $temp_items['id'] ?>").trigger('click'); }); /*----------- - Button ---------------*/ $("#qty_dec<?php echo $temp_items['id'] ?>").on("click", function() { var $button = $(this); var oldValue = $button.parent().find("input").val(); if ($button.text() === "+") { var newVal = parseFloat(oldValue) + 1; } else { // Don't allow decrementing below zero if (oldValue > 1) { var newVal = parseFloat(oldValue) - 1; } else { newVal = 1; } } $button.parent().find("input").val(newVal); $("#update<?php echo $temp_items['id'] ?>").trigger('click'); }); /*-------------------------------------*/ }); </script> <?php $total_weight += $sum_weight; } } ?> </tbody> </table> </div> <div class="row"> <div class="col-lg-12"> <div class="cart-shiping-update-wrapper"> <div class="cart-shiping-update"> <a href="index.php" >Continue Shopping</a> </div> <div class="cart-clear"> <a href="saved_item.php" class="btn" >Go to your saved items</a> </div> </div> </div> </div> </form> <div class="row mt-2"> <div class="col-lg-6 col-md-6 col-sm-12"> <?php if(isset($checksession) and !empty($checksession)) { $where_con_u="`id`="."'$checksession'"; $query_u=$sel_obj->display_rcd('tblusers',$where_con_u); if(is_array($query_u) || !empty($query_u)) { foreach ($query_u as $different_data ) { } } if($different_data['str_address1']!=""){ ?> <div class="card mb-4 div_load " style="min-height: 10px;"> <h6 class="bg-info pl-4 pt-1 pb-1 text-light">Deliver To : </h6> <div class="p-4"> <address> <b><?php echo $different_data['FullName']." ".$different_data['last_name'];?></b><br> <?php echo $different_data['str_address1'];?> <?php echo $different_data['str_address2'];?><br> <?php echo $different_data['town'];?><br> <?php echo $different_data['state']." - ".$different_data['pincode'];?><br> Email : <?php echo $different_data['UserEmail'];?><br> Phone : <b><?php echo $different_data['phonenumber'];?></b><br> </address> </div> <div class="place"> <?php $address = $different_data['str_address1'].", ".$different_data['str_address2'].", ".$different_data['town'].", ".$different_data['state']." - ".$different_data['pincode']; echo '<iframe width="100%" height="280" frameborder="0" src="https://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=' . str_replace(",", "", str_replace(" ", "+", $address)) . '&z=14&output=embed"></iframe>'; ?> </div> </div> <?php } } ?> </div> <?php // $shipping_charge = max(array_column($fetch_temp_cart, 'shipping_price')); /*----- New Shipping Charge ------*/ if ($shipping_charge>100 && $shipping_charge<181) { $shipp_discount = ($shipping_charge*10)/100; } if ($shipping_charge>180 && $shipping_charge<251) { $shipp_discount = ($shipping_charge*20)/100; } if ($shipping_charge>250) { $shipp_discount = ($shipping_charge*30)/100; } $shipping_charge = $shipping_charge-$shipp_discount; if ($shipping_charge>300) { $shipping_charge = 300; }else{ $shipping_charge = $shipping_charge; } /*------ New Packaging Charge ----*/ if ($packaging_charge>250) { $packaging_charge = 250; }else{ $packaging_charge = $packaging_charge; } /*--------------------------------*/ $grandTotal = $sub_total; $sub_total = $sub_total+$shipping_charge; ?> <div class="col-lg-6 col-md-6 col-sm-12"> <div class="grand-totall cartbosh"> <div class="title-wrap"> <h4 class="cart-bottom-title section-bg-gary-cart">Cart Total</h4> </div> <input type="hidden" name="weight" id="weight" value="<?php echo $total_weight; ?>"> <input type="hidden" value="<?php echo round($grandTotal,'2');?>" id="subtotal_input"> <input type="hidden" value="<?php echo $temp_session_id;?>" id="temp_id"> <input type="hidden" value="<?php echo $checksession;?>" id="user_id"> <h5>Sub Total <span id="subtotal_div">₹<?php echo round($grandTotal,'2');?></span></h5> <h5>Total TAX <span>₹<?php echo round($total_gst,'2');?></span></h5> <?php if($total_weight!=0){ ?> <h5>Total Weight <span><?php echo round($total_weight,'2');?>Kg</span></h5> <?php } ?> <?php if($offer_discount!=0){ ?> <h5>Offer Discount <span>₹<?php echo round($offer_discount,'2');?></span></h5> <?php } ?> <div class="l_shiping"> <div class="total-shipping"> <!-- <h5>Total Shipping</h5> --> <ul> <li> <h5>Shipping Charge <span id="shipping_cost_div">₹<?php echo round($shipping_charge,2); ?></span></h5> </li> <br> <li> <h5>Packaging Charge <span>₹<?php echo round($packaging_charge,2); ?></span></h5> </li> </ul> </div> </div> <h4 class="grand-totall-title">Grand Total <?php $grandtotal=($grandTotal+$total_gst); $grandtotal=($grandtotal+ $shipping_charge+ $packaging_charge - $offer_discount); ?> <span id="t_price_div"><?php echo "₹". @round($grandtotal); ?></span> </h4> <!-- ======================= For Shiprocket ================== --> <input type="hidden" name="pincode" id="pincode" value="<?php echo $different_data['pincode']; ?>"> <!-- ============== Dimensions ======== --> <input type="hidden" name="length" id="length" value="<?php echo round($length_array[0],2);?>"> <input type="hidden" name="breadth" id="breadth" value="<?php echo round($breadth_array[0],2);?>"> <input type="hidden" name="height" id="height" value="<?php echo round($total_height,2);?>"> <!-- ================================== --> <input type="hidden" name="t_price" id="t_price_input" value="<?php echo round($grandtotal);?>"> <input type="hidden" name="shipping_price" id="shipping_cost_input" value="<?php echo round($shipping_charge,2); ?>"> <input type="hidden" name="packaging_price" value="<?php echo round($packaging_charge,2); ?>"> <input type="hidden" name="weight" id="weight" value="<?php echo round($total_weight,3);?>"> <!-- ========================================================== --> <a href="javascript:;" class="" id="proceed">Proceed to Checkout</a> </div> </div> </div> </div> </div> </div> <?php } else { ?> <div class="container"> <div class="row"> <div class="col-lg-12 col-md-12 col-sm-12 col-12 text-center"> <img src="assets/images/emptycart.jpg"> </div> </div> </div> <?php } ?> </div> <!-- cart area end --> <!-- Footer Area start --> </div> </div> <?php include_once("footer.php");?> <script type="text/javascript"> $(document).ready(function() { var pincode = $("#pincode").val(); var weight = $("#weight").val(); var shipping_cost = $("#shipping_cost_input").val(); var t_price = $("#t_price_input").val(); var check_cod = 1; var subtotal_cost = $("#subtotal_input").val(); /*--------------- Check COD -----------*/ if (pincode!='') { $.ajax({ url:'ajax_action.php', method:'POST', data:{pincode:pincode, weight:weight, check_cod:check_cod, shipping_cost:shipping_cost, subtotal:subtotal_cost, t_price:t_price}, success:function(responce){ var obj = JSON.parse(responce); if (obj.cod == '0'){ // alert(obj.rate); // alert('COD not available at this pincode'); console.log(responce); $('#Cash1').attr("disabled",true); } $("#shipping_cost_div").html("₹"+obj.rate); $("#shipping_cost_input").val(obj.rate); $("#subtotal_input").val(obj.subtotal); $("#subtotal_div").html("₹"+obj.subtotal); $("#t_price_div").html("₹"+obj.t_price); $("#t_price_input").val(obj.t_price); } }); } }); </script>