Backups Created:
/home/japatmex/public_html/wp-content/edit-wolf.php
Savvy
W
olf -
MANAGER
Edit File: my_cart.php
<?php $ci =& get_instance(); $total_cart_amt=$delivery_charge=0; ?> <style type="text/css"> th { padding: 10px; } .btn_remove_cart:hover { text-decoration: none !important; } .shopping_cart{ padding: 60px 0; } .btn-outline-success:hover{ color: #fff !important; background-color: var(--site-main-color) !important; border-color: var(--site-main-color) !important; } .btn-outline-success{ color: var(--site-main-color) !important; border-color: var(--site-main-color) !important; } /* Chrome, Safari, Edge, Opera */ /*input::-webkit-outer-spin-button, input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; } /* Firefox */ /*input[type=number] { -moz-appearance: textfield; }*/ </style> <section class="shopping_cart"> <div class="container"> <div class="row"> <div class="col-12"> <h2 class="font-weight-bold mb-3 mb-md-5">Shopping cart </h2> </div> </div> <div class="row justify-content-center"> <div class="col-xl-9 col-lg-12 col-md-12 col-sm-12 col-12"> <?php $is_items=false; if(!empty($my_cart)) { $is_items=true; ?> <?php foreach($my_cart as $key => $value) { $image = $ci->get_single_info(array('id' => $value->product_id),'product_slug','tbl_gf_ecomm_product '); $img_file = 'uplds'.$rowSettings->Theme.'/ecomm/images/products/'.$value->featured_image; if(!$img_file) { $img_file = 'assets/images/image-icon.png'; } /*$img_file= $ci->_create_thumbnail('assets/images/products/',$ci->get_single_info(array('id' => $value->product_id),'product_slug','tbl_product'),$value->featured_image,50,50);*/ ?> <div class="card_block"> <table> <tr> <td colspan="2" align="center" style="min-width: 155px !important;">Product</td> <td>Quantity</td> <td>Per Unit Price</td> <td>Total Price</td> <td>Action</td> </tr> <tr> <td> <!-- <div class="row align-items-center justify-content-between"> --> <div class"col-xl-2 col-lg-2 col-md-6 col-sm-4 col-4"> <div class="product_img"> <a href="<?php echo site_url('product/'.$ci->get_single_info(array('id' => $value->product_id),'product_slug','tbl_gf_ecomm_product')); ?>"> <img class="img-fluid" src="<?php echo base_url().$img_file?>" alt="<?php //echo $value->product_title; ?>" /> </a> </div> </div> </td> <td> <div class"col-xl-4 col-lg-4 col-md-6 col-sm-8 col-8"> <div class="product_detail"> <a href="<?php echo site_url('product/'.$ci->get_single_info(array('id' => $value->product_id),'product_slug','tbl_gf_ecomm_product')); ?>"> <?php if(strlen($value->product_title) > 30){ echo ucwords(substr(stripslashes($value->product_title), 0, 30).'...'); }else{ echo ucwords($value->product_title); } ?> </a> </div> </div> </td> <td> <div class"col-xl-2 col-lg-2 col-md-4 col-sm-4 col-12 mb-2 mb-md-0 mt-3 mt-lg-0"> <!-- <form class="shop-form cartUpdate" method="post" action="<?=site_url('Ecomm/update_cart')?>"> <div class="quantity_box"> <input type="hidden" name="max_unit_buy" class="max_unit_buy form-control" value="<?php echo $value->max_unit_buy; ?>"> <input type="number" name="product_qty[]" class="product_qty form-control" value="<?php echo $value->product_qty; ?>"> <div class="col-2"> <input type="hidden" name="cart_id[]" class="crt_id" value="<?=$value->id?>"> <input type="hidden" name="product_qty[]" class="" class=" form-control" value="<?php echo $value->product_qty; ?>"> </div> </div> </form> --> <form action="<?=base_url('Ecomm/add_to_cart')?>" method="post" id="cartForm" class="my-2 my-lg-0"> <div class="quantity"> <input type="hidden" name="max_unit_buy" value="<?=$value->max_unit_buy ? $value->max_unit_buy: '1'?>" class="max_unit_buy"> <input type="hidden" name="preview_url" value="<?=current_url()?>"> <input type="hidden" name="product_id" value="<?=$value->product_id?>" /> <!-- <input class="input-text product_qty" name="product_qty" value="<?= $value->product_qty ?: 1?>" type="number" min="1" <?php if ($value->max_unit_buy != 0) { echo "max=" . $value->max_unit_buy; } ?> onkeypress="return isNumberKey(event)"> --> <input type="hidden" name="product_selected_variation"> <!-- <button class="cst_button qty-btn" type="submit"><?php if($ci->check_cart($value->id,$this->session->userdata('GSM_FUS_UserId'))){ echo 'Update to Cart'; }else{ echo 'Update to Cart'; } ?></button> --> <div class="input-group mb-0" style="min-width: 155px;"> <input type="number" name="product_qty" min="1" value="<?= $value->product_qty ?: 1?>" class="form-control input-text product_qty" aria-describedby="basic-addon2" required onkeypress="return isNumberKey(event)"> <div class="input-group-append"> <button class="btn btn-outline-success cst_button qty-btn" type="submit" style="max-width: 125px;padding: 0px 14px;font-size: 12px;font-weight: 600;"><?php if($ci->check_cart($value->id,$this->session->userdata('GSM_FUS_UserId'))){ echo 'Update to Cart'; }else{ echo 'Update to Cart'; } ?></button> </div> </div> </div> </form> </div> </td> <td> <div class"col-xl-2 col-lg-2 col-md-4 col-sm-4 col-auto mt-lg-0 mt-3"> <div class="price_box"> <h5> <?php $actual_price=''; if($value->you_save_amt!='0'){ ?> <ins><?php echo getusercurrency().' '.getuserprice($value->selling_price); ?></ins> <br /> <small><del><?php echo getusercurrency().' '.getuserprice($value->product_mrp); ?></del></small> <?php } else{ ?> <?php echo getusercurrency().' '.getuserprice($value->product_mrp); ?> <?php } ?> <?php //echo CURRENCY_CODE.' '.$actual_price*$value->product_qty; ?> </h5> </div> </div> </td> <td> <div class"col-xl-2 col-lg-2 col-md-4 col-sm-4 col-auto mt-lg-0 mt-3"> <div class="price_box"> <h5> <?php $actual_price=''; if($value->you_save_amt!='0'){ $actual_price=$value->selling_price; ?> <ins><?php echo getusercurrency().' '.getuserprice($value->selling_price*$value->product_qty); ?></ins> <br /> <small> <del><?php echo getusercurrency().' '.getuserprice($value->product_mrp*$value->product_qty); ?></del></small> <?php } else{ ?> <?php $actual_price=$value->product_mrp; echo getusercurrency().' '.getuserprice($value->product_mrp*$value->product_qty); ?> <?php } ?> <?php //echo CURRENCY_CODE.' '.$actual_price*$value->product_qty; ?> </h5> </div> </div> </td> <td> <div class"col-xl-2 col-lg-2 col-md-4 col-sm-4 col-auto text-right mt-lg-0 mt-2"> <div class="wish_buttons"> <button class="btn btn_remove_cart" data-id="<?php echo $value->id; ?>"><i class="fa fa-trash"></i></button> </div> </div> <!-- </div> --> </td> </tr></table> </div> <?php $total_cart_amt+=$actual_price*$value->product_qty; $delivery_charge+=$value->delivery_charge; } $total_cart_amt+=$delivery_charge; }else{ ?> <center style="margin-bottom: 50px;"> <img src="<?=base_url('assets/images/empty-cart.png')?>" style=""> <br /> <a href="<?=base_url('/shop')?>"><img src="<?=base_url('assets/images/continue-shopping-button.png')?>"></a> </center> <?php } ?> </div> <?php if(!empty($my_cart)) { ?> <div class="col-xl-3 col-lg-12 col-md-12 col-sm-12 col-12 mt-lg-0 mt-3"> <div class="card_block"> <div class="row justify-content-between" style="border-bottom: 1px solid #ddd;"> <div class="col-auto"> <p>Sub Total:</p> </div> <div class="col-auto"> <p> <?php echo getusercurrency().' '.getuserprice($total_cart_amt-$delivery_charge)?> </p> </div> </div> <div class="row justify-content-between" style="border-bottom: 1px solid #ddd; margin-top: 15px;"> <div class="col-auto"> <p>Shipping</p> </div> <div class="col-auto"> <p><?php echo getusercurrency().' '.getuserprice($delivery_charge); ?></p> </div> </div> <!-- <div class="row justify-content-between" style="border-bottom: 1px solid #ddd; margin-top: 15px;"> <div class="col-auto"> <p>GST Tax:</p> </div> <div class="col-auto"> <p><?php echo getusercurrency().' '; ?>0</p> </div> </div> --> <div class="row justify-content-between" style="border-bottom: 1px solid #ddd; margin-top: 15px;"> <div class="col-auto"> <p><b>Total Amount:</b></p> </div> <div class="col-auto"> <p class="text-right"><b><?=getusercurrency().' '.getuserprice($total_cart_amt)?></b></p> </div> </div> <div class="row justify-content-end" style="margin-top: 15px;"> <div class="col-auto"> <div class="wish_buttons d-flex justify-content-between"> <a href="<?=base_url('shop');?>"><button type="submit" class="checkout-button btn mr-1">Continue Shopping</button></a> <?php echo form_open('checkout', ['id' => 'frmUsers','method' => 'POST']); echo form_input(['type' => 'hidden', 'name' => 'delivery_charge', 'class' => 'form-control', 'value' => ($delivery_charge!=0) ? $delivery_charge:'Free']); echo form_input(['type' => 'hidden', 'name' => 'checkout_type', 'class' => 'form-control', 'value' => 'fromCart']); ?> <button type="submit" class="checkout-button btn">Proceed to checkout</button> <?php echo form_close(); ?> </div> </div> </div> </div> </div> <?php } ?> </div> </div> </section> <?php //var_dump($this->session->flashdata('msg')["success"]); if(($this->session->flashdata('msg')["success"] == 1)){ ?> <script> $( document ).ready(function (){ swal({ title: "Done!", text: "<?=$this->session->flashdata('msg')['msg']?>", type: "success", }); }); </script> <?php } if(($this->session->flashdata('msg')["success"] == 2)){ ?> <script> $( document ).ready(function (){ swal({ title: "Failed!", text: "<?=$this->session->flashdata('msg')['msg']?>", type: "warning", }); }); </script> <?php } ?> <script> $('.btn_remove_cart').click(function(){ var cart_product_id = $(this).data('id'); swal({ title: "Are you sure ?", type: "warning", showCancelButton: true, confirmButtonClass: "btn-danger btn_edit", cancelButtonClass: "btn-warning btn_edit", confirmButtonText: "Yes", cancelButtonText: "No", closeOnConfirm: false, closeOnCancel: false, showLoaderOnConfirm: true }, function(isConfirm) { if(isConfirm) { $.ajax({ type : 'POST', url : '<?php echo base_url().'ecomm/remove_cart' ?>', data : { cart_product_id : cart_product_id }, success:function (response){ location.reload(); } }); }else { swal.close(); } }); }); // for cart form /*$("#cartForm").submit(function(event) { event.preventDefault(); $(".process_loader").show(); var formData = $(this).serialize(); var _form = $(this); $.ajax({ type: 'POST', url: $(this).attr('action'), data: formData }) .done(function(response) { var res = $.parseJSON(response); $(".process_loader").hide(); if (res.success == '1') { swal({ title: "Done!", text: res.msg, type: "success" }, function() { $.ajax({ type: 'POST', url: '<?php echo base_url().'Ecomm/get_cart'?>', data: { count: true }, success: function(response) { console.log(response); if (response > 0) { $('.add-cart-btn').find('.cart-add') .empty(); setTimeout(function() { $('.add-cart-btn').find( '.cart-add').append( response); }, 100); var html = `<a class="nav-link" href="<?php echo site_url('my-cart'); ?>"> <div class="add-cart-btn"><i class="fa fa-cart-arrow-down"></i><span class="cart-add"><?=$cartCount;?></span></div> </a>`; location.reload(); } else { var html = `<li class="cart-item text-center"> <h4 style="font-weight: 500">Cart is empty !!!</h4></li>`; } $('.cart_buttons').html(html) } }) }); } else if (res.success == '2') { swal({ title: "Failed!", text: res.msg, type: "warning" }, function() { location.reload(); }); } else if (res.success == '0') { window.location.href = '<?=base_url()?>login-register'; } }) .fail(function(response) { $(".process_loader").hide(); swal("Something gone wrong!", res); }); });*/ </script>