Server : Apache/2.4.18 (Ubuntu) System : Linux canvaswebdesign 3.13.0-71-generic #114-Ubuntu SMP Tue Dec 1 02:34:22 UTC 2015 x86_64 User : oppastar ( 1041) PHP Version : 7.0.33-0ubuntu0.16.04.15 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, Directory : /var/www/rabbithabit.com/public_html/application/views/ |
Upload File : |
<style> #shipping_result{ margin-bottom: 80px; } .card { border: 1px solid black; } .table thead th { border-bottom: unset; } .table td, .table th { border-top: 1px solid black; border-bottom: 1px solid black; } .btn.btn-primary{ background: <?= $primary_colortheme;?>; border: none !important; color: #fff !important; border-radius: 0 !important; transition: all 0.3s ease 0s; } .btn.btn-primary:active, .btn.btn-primary:focus, .btn.btn-primary:hover { background-color: #E04926; color: white !important; } @media (max-height: 790px) { #shipping_result{ margin-bottom: 120px; } } @media (min-width: 768px) { #redeemPoint, #redeemVoucher { float: none; } } @media (max-width: 450px) { .customer_info_box form .myCart{ margin-top: 30px; } .customer_info_box form .myCart h3{ font-size: 21px; line-height: 20px; } #shipping_result table thead th { font-size: 13px; } #shipping_result table tbody td{ font-size: 12px; } .div_total_price{ font-size: 16px !important; } #lanjutPembayaran{ font-size: 13px !important; width: 100% !important; } .blok_voucher_div, .blok_point_div{ display: inline-flex; width: 100%; align-items: center; margin: auto; } .blok_voucher, .blok_point{ margin-top: 10px; padding-right: 0px !important; } .blok_voucher:first-child { padding-left: 0px !important; } .blok_point:nth-child(2) { padding-left: 0px !important; } #redeemVoucher, #voucher, #redeemPoint, #point{ width: 100% !important; font-size: 14px !important; } /*.blok_voucher, .blok_point_rewards{ width: 100%; flex: 0 0 100%; max-width: 100%; }*/ } </style> <script> function remove_cart_shipping(rowid) { if (confirm('Are you sure?')) { $.ajax({ 'url' : '<?= base_url(); ?>' + 'ajax/ajax_remove_cart', 'type' : 'POST', 'data' : { 'rowid' : rowid, '<?= $this->security->get_csrf_token_name(); ?>' : '<?= $this->security->get_csrf_hash(); ?>' }, 'success' : function(data) { /*---success----*/ window.location.href=''; } }); } } </script> <div class="customer_info_box container"> <div class="row customer_info_box_head"> <div class="col-sm-12"> <?php $attributes = array( 'name' => 'shipping_post' ); ?> <?= form_open('payment/post_payment', $attributes); ?> <?php if(!$this->session->userdata('customer') || $this->session->userdata('customer')['customer_type'] == 'guest') : ?> <div class="row" style="padding-top: 30px;"> <div class="col-sm-12" style="vertical-align: center; text-align: center;"> <p style="font-size: 16px; vertical-align: center"><a href="<?= base_url('login'); ?>"><strong style="color:<?= $primary_colortheme;?>"><?= strtoupper(lang('signin'));?></strong></a> <?= strtoupper(lang('for_point'));?></p> </div> </div> <?php endif; ?> <div class="myCart"> <h3> <?php if ($this->session->userdata('site_lang') == 'english'): ?> Shipping <?php else: ?> Pengiriman <?php endif; ?> </h3> <?php // echo '<pre>'; // print_r($this->session->userdata('shipping_cart')); // print_r($this->cart->contents()); // echo '</pre>'; ?> <?php if ($this->session->userdata('shipping_cart')): ?> <?php if(!$this->session->userdata('customer') || $this->session->userdata('customer')['customer_type'] == 'guest') : ?> <div class="row" style="padding-top: 20px;"> <div class="col-sm-2"> <p><?= ucwords(lang('name'));?><sup>*</sup></p> </div> <div class="col-sm-8"> <input type="text" id="shippingName" name="name" required style="border-radius: 0;" class="form-control" placeholder="<?= ucwords(lang('fullname'));?>*"> </div> </div> <div class="row" style="padding-top: 20px;"> <div class="col-sm-2"> <p><?= ucwords(lang('phone'));?><sup>*</sup></p> </div> <div class="col-sm-8"> <?php $data = array( 'name' => 'phone', 'class' => 'form-control', 'required' => 'required', 'type' => 'number', 'id' => 'shippingPhone', 'placeholder' => ucwords(lang('phone_number')) ); echo form_input($data); echo '<span style="font-size:12px;">' . form_error('phone') . '</span>'; ?> </div> </div> <div class="row" style="padding-top: 20px;"> <div class="col-sm-2"> <p> <?php if ($this->session->userdata('site_lang') == 'english'): ?> Birth Date and Gender <sup>*</sup> <?php else: ?> Tanggal Lahir dan Gender <sup>*</sup> <?php endif; ?> </p> </div> <div class="col-sm-8"> <div class="row"> <div class="col-sm-6"> <?php $data = array( 'name' => 'birthday', 'class' => 'form-control registerdatepicker', 'type' => 'date', 'required' => 'required' ); // if(!empty($customers->birthday)) { // $data['value'] = date('d-m-Y', strtotime($customers->birthday)); // } echo form_input($data); ?> <?= form_error('birthday'); ?> </div> <div class="col-sm-6"> <?php $options = array( 'male' => 'Male', 'female' => 'Female' ); echo form_dropdown('sex_type', $options,'female', 'class="form-control"'); ?> </div> </div> </div> </div> <div class="row" style="padding-top: 20px;"> <div class="col-sm-2"> <p><?= ucwords(lang('email'));?><sup>*</sup></p> </div> <div class="col-sm-8"> <input type="text" id="email" name="email" required style="border-radius: 0;" class="form-control" placeholder="<?= ucwords(lang('emailadd'));?>*"> </div> </div> <?php endif; ?> <!-- <p><span id="addressMessage" style="color: red;"></span></p> --> <div class="row" style="padding-top: 20px;"> <div class="col-sm-2"> <p><?= ucwords(lang('destination'));?><sup>*</sup></p> </div> <div class="col-sm-8"> <div class="row"> <div class="col-sm-4"> <?php $get_grand_total = 0; foreach ($this->session->userdata('shipping_cart') as $item){ $get_grand_total += $item['subtotal']; } $q_point_rewards = $this->db->get_where("point_rewards",array( 'id_point_rewards'=>1 ))->row(); $q_config_cond = $this->db->select('type_cond_prov_free_shipping, cond_more_prov_free_shipping, cond_less_prov_free_shipping')->from('configuration')->where('id_configuration',1)->get()->row(); $free_shipping_type = $this->db->select('free_shipping_type') ->from('configuration') ->where('id_configuration',1)->get()->row() ->free_shipping_type; $condition_freeshipping = false; if($free_shipping_type == 'region') { $selected_region_province = $this->db->select('*') ->from('free_shipping_region') ->where('configuration_id',1) ->where('province_id',$shipping->shipping_id_province) ->get(); if($selected_region_province->num_rows() > 0){ switch ($q_config_cond->type_cond_prov_free_shipping) { case 'more_than': if ($get_grand_total >= $q_config_cond->cond_more_prov_free_shipping) { $condition_freeshipping = true; }else{ $condition_freeshipping = false; } break; case 'less_than': if ($get_grand_total <= $q_config_cond->cond_less_prov_free_shipping) { $condition_freeshipping = true; }else{ $condition_freeshipping = false; } break; default: $condition_freeshipping = true; break; } } } // echo $condition_freeshipping; exit(); ?> <select style="border-radius: 0;" required id="shipping_province" name="shipping_province" class="form-control"> <option value=""><?= ucwords(lang('choose_province'))?></option> <?php foreach($shipping_provinces as $shipping_province) : ?> <option value="<?= $shipping_province->rajaongkir_province_id; ?>" <?php if($shipping_province->rajaongkir_province_id == $shipping->shipping_id_province) : ?> selected <?php endif; ?> ><?= ucwords($shipping_province->province); ?></option> <?php endforeach; ?> </select> </div> <div class="col-sm-4"> <select style="border-radius: 0;" required id="shipping_district" name="shipping_district" class="form-control"> <option value=""><?= ucwords(lang('choose_district'))?>...</option> <?php if (isset($shipping_district_lists)) : ?> <?php foreach($shipping_district_lists as $shipping_district) : ?> <option value="<?= $shipping_district->rajaongkir_id_district; ?>" <?php if($shipping_district->rajaongkir_id_district == $shipping->shipping_id_district) : ?> selected <?php endif; ?> ><?= ucwords($shipping_district->district); ?></option> <?php endforeach; ?> <?php endif; ?> </select> <?php echo '<span style="font-size:10px;">' . form_error('shipping_district') . '</span>'; ?> </div> <div class="col-sm-4"> <select style="border-radius: 0;" required id="shipping_subdistrict" name="shipping_subdistrict" class="form-control"> <option value=""><?= ucwords(lang('choose_subdistrict'))?>...</option> <?php if (isset($shipping_subdistrict_lists)) : ?> <?php foreach($shipping_subdistrict_lists as $shipping_subdistrict) : ?> <option value="<?= $shipping_subdistrict->rajaongkir_id_subdistrict; ?>" <?php if($shipping_subdistrict->rajaongkir_id_subdistrict == $shipping->shipping_id_subdistrict) : ?> selected <?php endif; ?> ><?= ucwords($shipping_subdistrict->subdistrict); ?></option> <?php endforeach; ?> <?php endif; ?> </select> <?php echo '<span style="font-size:10px;">' . form_error('shipping_subdistrict') . '</span>'; ?> </div> </div> </div> </div> <script> jQuery(document).ready(function() { jQuery('#shipping_province').change(function() { jQuery('#shipping_subdistrict').empty(); //to empty select box var id_shipping_province = jQuery(this).val(); load_shipping_district_ajax(id_shipping_province); }); jQuery('#shipping_district').change(function() { var id_shipping_district = jQuery(this).val(); load_shipping_subdistrict_ajax(id_shipping_district); }); jQuery('#shipping_subdistrict').change(function() { jQuery('.lanjutPembayaran_spinner').show(); jQuery('.buyButton').attr('disabled', true); var id_shipping_province = jQuery('#shipping_province').val(); var id_shipping_district = jQuery('#shipping_district').val(); var id_shipping_subdistrict = jQuery(this).val(); reload_shipping_result(id_shipping_province, id_shipping_district, id_shipping_subdistrict); }); }); function formatIDR(angka, prefix){ var number_string = angka.toString().replace(/[^,\d]/g, '').toString(), split = number_string.split(','), sisa = split[0].length % 3, rupiah = split[0].substr(0, sisa), ribuan = split[0].substr(sisa).match(/\d{3}/gi); // tambahkan titik jika yang di input sudah menjadi angka ribuan if(ribuan){ separator = sisa ? '.' : ''; rupiah += separator + ribuan.join('.'); } rupiah = split[1] != undefined ? rupiah + ',' + split[1] : rupiah; return prefix == undefined ? rupiah : (rupiah ? 'IDR ' + rupiah : ''); } function load_shipping_district_ajax(id_shipping_province) { jQuery.ajax({ 'url' : '<?= base_url(); ?>' + 'ajax' + '/ajax_get_shipping_district', 'type' : 'POST', 'data' : { 'id_shipping_province' : id_shipping_province, '<?= $this->security->get_csrf_token_name(); ?>' : '<?= $this->security->get_csrf_hash(); ?>' }, 'success' : function(data) { jQuery('#shipping_district').html(data).focus(); } }); } function load_shipping_subdistrict_ajax(id_shipping_district) { jQuery.ajax({ 'url' : '<?= base_url(); ?>' + 'ajax' + '/ajax_get_shipping_subdistrict', 'type' : 'POST', 'data' : { 'id_shipping_district' : id_shipping_district, '<?= $this->security->get_csrf_token_name(); ?>' : '<?= $this->security->get_csrf_hash(); ?>' }, 'success' : function(data) { jQuery('#shipping_subdistrict').html(data).focus(); } }); } function reload_shipping_result(id_shipping_province, id_shipping_district, id_shipping_subdistrict) { <?php if ($condition_freeshipping == true) { ?> var condition_freeshipping = true; <?php }else{ ?> var condition_freeshipping = false; <?php } ?> jQuery.ajax({ 'url' : '<?= base_url(); ?>' + 'shipping' + '/ajax_reload_shipping_result', 'type' : 'POST', 'data' : { 'id_shipping_province' : id_shipping_province, 'condition_freeshipping' : condition_freeshipping, 'id_shipping_district' : id_shipping_district, 'id_shipping_subdistrict' : id_shipping_subdistrict, '<?= $this->security->get_csrf_token_name(); ?>' : '<?= $this->security->get_csrf_hash(); ?>' }, 'success' : function(data) { jQuery('#shipping_result').empty(); // console.log(data); jQuery('#shipping_result').html(data); jQuery('#spinner<?= $count; ?>').hide(); } }); } </script> <div class="row" style="padding-top: 20px;"> <div class="col-sm-2"> <p><?= ucwords(lang('address'))?><sup>*</sup></p> </div> <div class="col-sm-8"> <textarea name="address" id="shipping_address" required style="border-radius: 0;" class="form-control" placeholder="<?= ucwords(lang('deliv_address'))?>*"><?= $shipping->shipping_address; ?></textarea> </div> </div> <div class="row" style="padding-top: 20px; display: none;"> <div class="col-sm-2"> <p><?= ucwords(lang('postcode'))?></p> </div> <div class="col-sm-8"> <input type="text" id="shipping_postcode" name="postcode" style="border-radius: 0;" class="form-control" placeholder="<?= ucwords(lang('postcode_enter'))?>..." value="<?= $shipping->shipping_postcode; ?>"> </div> </div> <br><br> <div id="shipping_result" style=""> <div class="table-responsive"> <table class="table" style="border-top:1px solid #999999; border-bottom:1px solid #999999; width: 100%;"> <thead> <tr> <th><?= ucwords(lang('product_name'))?></th> <th class="hidden-xs-down"><?= ucwords(lang('price'))?></th> <th class="hidden-xs-down"><?= ucwords(lang('quantity'))?></th> <th class="hidden-xs-down"><?= ucwords(lang('sent'))?></th> <th class="hidden-xs-down"><?= ucwords(lang('shipping_method'))?></th> <th class="hidden-xs-down">Sub Total</th> <th class="hidden-xs-down"></th> </tr> </thead> <tbody> <?php $count = 0; ?> <?php $grand_total = 0; ?> <?php $total_shipping_fee = 0; ?> <?php foreach ($this->session->userdata('shipping_cart') as $rowid => $item): ?> <?php $count++; ?> <?php $real_rowid = null; foreach ($this->cart->contents() as $real_key) { if ((int)$real_key['id'] == (int)$item['id']) { $real_rowid = $real_key['rowid']; } } ?> <tr> <td class="hidden-xs-down" style="width: 26%;"> <?php $q_product_images = $this->db->order_by('priority','asc')->get_where("product_images",array( "product_details_id"=>$item['id'], "product_id"=>$item['product_id'], ))->row(); $img_thumbnail = base_url()."uploads/image_not_available.jpg"; if ($q_product_images != null) { $img_thumbnail = base_url()."uploads/product/small/".$q_product_images->image; } ?> <div style="display: inline-flex;align-items: center;"> <div style="height: 100px;width: 100px; margin-right: 7px;"> <img src="<?= $img_thumbnail; ?>" class="img-fluid" alt=""> </div> <div> <?= strtoupper($item['name']); ?><br> <?= get_attribute_name($item['attribute_detail_ids']); ?><br><span style="font-size: 12px;"><?= $item['sku']; ?></span> </div> </div> </td> <td class="hidden-xs-down"> IDR <?= number_format($item['price']); ?><br> <?= $item['indent_message']; ?> </td> <td style="width: 14%;" class="hidden-xs-down"> <?php error_reporting(0); $fs_cek_product = $this->db->select('id')->from('flashsale_products')->where('product_id',$item['id'])->where('flashsale_id',$this->session->userdata('flashsale_id_active'))->get()->row()->id; if($fs_cek_product != null): ?> <div class="count-input space-bottom" style="display: inline-block;"> <input style="text-align: center;" readonly="readonly" class="quantity productQuantity<?= $count; ?>" type="text" name="quantity" value="<?= $item['qty']; ?>"/> </div> <?php else: ?> <?php $css_btn_incr="margin-left:-9px;"; if ($this->session->userdata('customer')): $css_btn_incr="margin-left:-17px;"; ?> <?php endif ?> <div class="root_incr-btn count-input space-bottom" style="display: flex; justify-content: space-between;position: relative;"> <div class="div_incr-btn1" style="margin-top: 2px; z-index:1;position: absolute;margin-left: 8px;"> <a style="padding-bottom: 5px; padding-top: 2px;" class="incr-btn btnMin<?= $count; ?>" data-action="decrease" href="#">–</a> </div> <div class="div_incr-btn2" style="width: 100%;"> <input style="width: 104%; text-align: center;" readonly="readonly" class="quantity productQuantity<?= $count; ?>" type="text" name="quantity" value="<?= $item['qty']; ?>"/> </div> <div class="div_incr-btn3" style="margin-top: 2px; <?= $css_btn_incr; ?>"> <a style="padding-bottom: 5px; padding-top: 2px;" class="incr-btn btnAdd<?= $count; ?>" data-action="increase" href="#">+</a> </div> </div> <?php endif; ?> <p class="noStock<?= $count; ?>" style="color:red;"><?= $this->session->flashdata('no_stock' . $rowid); ?></p> </td> <td class="hidden-xs-down"><?= ucwords($item['warehouse_name']); ?><br> <span id="spinner<?= $count; ?>"><img width="40" class="img_nowidth" src="<?= base_url('uploads/spinner.gif'); ?>"></span> </td> <td> <ul id="shippingNameBlock<?= $count; ?>" style="list-style: none; padding-left: 0;"> <?php $count_shipping = 0; ?> <?php foreach ($item['shipping_method_ids'] as $shipping_id) : ?> <?php $count_shipping = $count_shipping + 1; ?> <?php if($shipping_id == 2): ?> <?php //get self delivery fee from configuration table $this->db->select('shopdelivery_fee')->from('configuration')->where('id_configuration', 1); $shopdelivery_fee = $this->db->get()->row()->shopdelivery_fee; $shipping_name = 'Express Courier'; // $shipping_name = '2 Hour Delivery'; $total_shipping_fee = $shopdelivery_fee; ?> <?php else : ?> <?php $shipping_info = calculate_shipping_fee($shipping_id, $item['warehouse_id'], $item['product_id'], $item['id'], $item['qty'], $shipping->shipping_id_subdistrict); $shipping_name = $shipping_info['shipping_name']; $total_shipping_fee = $shipping_info['total_shipping_fee']; if($shipping_id == 3){ $shipping_name = 'Regular'; } ?> <?php endif; ?> <?php if($total_shipping_fee > 0 || isset($shipping_info['free_shipping_applied'])) : ?> <li> <input type="radio" class="shipping_method<?= $rowid; ?>" name="shipping_method<?= $rowid; ?>" value="<?= $shipping_id; ?>" <?php if($item['chosen_shipping_id'] == $shipping_id) : ?> <?php $active_shipping_fee = $total_shipping_fee; ?> checked <?php endif; ?> > <?= ucwords($shipping_name); ?> <?php if($condition_freeshipping == true) : ?> (<?= ucwords(lang('free'));?>) <?php else: ?> <?php if($total_shipping_fee == 0) : ?> (<?= ucwords(lang('free'));?>) <?php else : ?> <?php if($shipping_id == 5) : ?> <!-- (TBC) --> (IDR <span id="shippingFee<?= $count_shipping; ?>"><?= number_format($total_shipping_fee); ?></span>) <?php else : ?> (IDR <span id="shippingFee<?= $count_shipping; ?>"><?= number_format($total_shipping_fee); ?></span>) <?php endif; ?> <?php endif; ?> <?php endif; ?> </li> <?php endif; ?> <?php endforeach; ?> </ul> </td> <td class="hidden-xs-down"> IDR <span id="subTotal<?= $count; ?>"><?php echo number_format(($item['price'] * $item['qty'])); ?></span> </td> <td class="hidden-xs-down" style="padding-left: 0px;"> <a title="Hapus" onclick="remove_cart_shipping('<?= $real_rowid; ?>');" href="#"> <i class="fa fa-trash"></i> </a> </td> </tr> <!-- <?php /*$total_shipping_fee = $total_shipping_fee + $item['shipping_fee'];*/ ?> --> <?php $grand_total = $grand_total + $item['subtotal']; ?> <?php endforeach; ?> </form> </tbody> </table> </div> <div class="row"> <div class="col-sm-6" style="padding-bottom: 15px;"> <?php if ($q_point_rewards->active == 'yes'): ?> <div class="row blok_point_div"> <?php if($this->session->userdata('customer') && $this->session->userdata('customer')['customer_type'] == 'regular') : ?> <div class="col-sm-12"> <p><? ucwords(lang('you_have'))?> <?= $current_point; ?> points. 1 point redeem IDR <?= $point_rewards->conversion;?></p> </div> <?php endif; ?> <div class="col-sm-6 col-6 blok_point"> <input class="form-control" type="number" id="point" placeholder="<?= strtoupper(lang('point_rewards'))?>" <?php if(!$this->session->userdata('customer') || $this->session->userdata('customer')['customer_type'] == 'guest') : ?> readonly disabled <?php endif; ?> > <p id="error_point" style="color: red"></p> </div> <div class="col-sm-6 col-6 blok_point"> <a <?php if(!$this->session->userdata('customer') || $this->session->userdata('customer')['customer_type'] == 'guest') : ?> readonly disabled <?php endif; ?> class="btn btn-primary btn-buy" id="redeemPoint" style="width: 150px;float: none;"><?= strtoupper(lang('redeem'))?></a> <?php if($this->session->userdata('customer') && $this->session->userdata('customer')['customer_type'] == 'regular') : ?> <span id="spinnerPoint" style="position: absolute;"><img width="40" class="img_nowidth" src="<?= base_url('uploads/spinner.gif'); ?>"></span> <?php endif; ?> </div> </div> <?php endif; ?> <div class="row blok_voucher_div"> <div class="col-sm-6 col-6 blok_voucher"> <input class="form-control" type="text" id="voucher" placeholder="VOUCHER" <?php if(!$this->session->userdata('customer') || $this->session->userdata('customer')['customer_type'] == 'guest') : ?> readonly disabled <?php endif; ?> > <p id="error_voucher" style="color: red"></p> </div> <div class="col-sm-6 col-6 blok_voucher"> <a <?php if(!$this->session->userdata('customer') || $this->session->userdata('customer')['customer_type'] == 'guest') : ?> readonly disabled <?php endif; ?> class="btn btn-primary btn-buy" id="redeemVoucher" style="width: 150px;float: none;"><?= strtoupper(lang('redeem'))?></a> <?php if($this->session->userdata('customer') && $this->session->userdata('customer')['customer_type'] == 'regular') : ?> <span id="spinnerVoucher" style="position: absolute;"><img width="40" class="img_nowidth" src="<?= base_url('uploads/spinner.gif'); ?>"></span> <?php endif; ?> </div> <?php if(!$this->session->userdata('customer') || $this->session->userdata('customer')['customer_type'] == 'guest') : ?> <div class="col-sm-12"> <p><a href="<?= base_url('login'); ?>" style="text-decoration: none; font-weight: bold; color:<?= $primary_colortheme;?>"><?= ucwords(lang('signin'))?></a> <?= ucwords(lang('for_point_bottom'));?></p> </div> <?php endif; ?> </div> <input type="hidden" id="voucherprice_input"> <input type="hidden" id="pointrewards_input"> </div> <div class="col-sm-6"> <style type="text/css"> .tk_line{ float: right; width: 70%; border-top: 1px solid black; } @media screen and (max-width: 768px){ .tk_line{ width: 100%; } } </style> <div class="row" style="height: 25px;"> <div class="col-md-8 col-sm-6 col-6" style="text-align: right;"> <p><span><?= ucwords(lang('product_total'))?> :</span></p> </div> <div class="col-md-4 col-sm-6 col-6" style="text-align: right;"> <p><span>IDR </span><span id="totalItemAmount"><?= number_format($grand_total); ?></span></p> </div> </div> <div id="voucherBlock" class="row" style="height: 25px;"> <div class="col-md-8 col-sm-6 col-6" style="text-align: right;"> <p><span>Voucher <span id="voucherdiscount"></span>:</span></p> </div> <div class="col-md-4 col-sm-6 col-6" style="text-align: right;"> <p><span>IDR </span><span id="voucherprice"><?= number_format(0); ?></span></p> </div> </div> <div id="pointrewardBlock" class="row" style="height: 25px;"> <div class="col-md-8 col-sm-6 col-6" style="text-align: right;"> <p><span><?= ucwords(lang('point_rewards'))?> :</span></p> </div> <div class="col-md-4 col-sm-6 col-6" style="text-align: right;"> <p><span>IDR </span><span id="pointrewards"><?= number_format(0); ?></span></p> </div> </div> <div class="row" style="height: 25px;"> <div class="col-md-8 col-sm-6 col-6" style="text-align: right;"> <p><span><?= ucwords(lang('shipping_fee'));?> :</span></p> </div> <div class="col-md-4 col-sm-6 col-6" style="text-align: right;"> <?php if($condition_freeshipping == true) : ?> <?= ucwords(lang('free'));?> <?php else: ?> <?php if($no_of_indent > 0 && $no_of_instock == 0) : ?> <?php if ($total_shipping_fee == 0): ?> <p><?= ucwords(lang('free'));?></p> <?php else: ?> <!-- <p>TBC</p> --> <p><span id="spn_totalshipping">IDR </span><span id="totalShippingFee"><?= number_format($final_total_shipping_fee); ?></span></p> <?php endif ?> <?php else : ?> <p><span id="spn_totalshipping">IDR </span><span id="totalShippingFee"><?= number_format($final_total_shipping_fee - $total_indent_shipping_fee); ?></span></p> <?php endif; ?> <?php endif; ?> </div> </div> <div id="freeshippingBlock" class="row" style="height: 25px;"> <div class="col-md-8 col-sm-6 col-6" style="text-align: right;"> <p><span><?= ucwords(lang('free_ship'))?> :</span></p> </div> <div class="col-md-4 col-sm-6 col-6" style="text-align: right;"> <?php if($free_shipping_fee >= 0): ?> <?php if (isset($min_transaction)): ?> <?php if ($grand_total >= $min_transaction): ?> <?php $free_shipping_fee = $free_shipping_fee; ?> <?php else: ?> <?php $free_shipping_fee = 0; ?> <?php endif; ?> <?php endif ?> <p><span>IDR -</span><span id="totalFreeShippingFee"><?= number_format($free_shipping_fee); ?></span></p> <?php endif; ?> </div> </div> <?php $finalshippingfee = 0; $calculate_finalshippingfee = $final_total_shipping_fee - $free_shipping_fee; if($calculate_finalshippingfee > 0){ $finalshippingfee = $calculate_finalshippingfee; } ?> <!-- <div class="row indentInformation" style="font-weight: bold;text-align: right;padding-top: 5px;height: 45px"> <div class="col-md-8 col-sm-6 col-6"> <p><?= ucwords(lang('downpayment'))?> :</p> </div> <div class="col-md-4 col-sm-6 col-6" style="text-align: right;font-weight: bold;"> <p><span style="font-size:100%;">IDR <span id="indentRemaining"><?= number_format($total_downpayment); ?></span></p> </div> </div> --> <div class="row" style="height: 5px;"> <div class="col-sm-12"> <hr class="tk_line"> </div> </div> <span id="firsttotal" style="display: none;"></span> <span id="finalshippingfee" style="display: none;"></span> <?php $css_padding = '5px'; if ( base_url() == "https://www.demo2.tokodaku.com/" || base_url() == "https://www.demo3.tokodaku.com/" ){ $css_padding = '15px'; } ?> <div class="row div_total_price" style=" font-weight: bold; text-align: right; padding-top: <?= $css_padding; ?>; height: 25px; font-size:1.2rem"> <div class="col-md-8 col-sm-6 col-6"> <br> <p><span><?= ucwords(lang('total_price'))?> :</span></p> </div> <div class="col-md-4 col-sm-6 col-6" style="text-align: right;font-weight: bold;"> <br> <p><span style="font-size:100%;">IDR <span id="grandTotal"> <?php if($condition_freeshipping == true) : ?> <?php $finalshippingfee = 0; $total_indent_shipping_fee = 0; ?> <?php endif; ?> <?= number_format($grand_total + $finalshippingfee); ?> <!-- <?= number_format($grand_total + $finalshippingfee - $total_indent_shipping_fee - $total_indent_amount + $total_downpayment); ?> --> </span></p> </div> </div> <p style="margin-top: 35px; margin-bottom: 50px; font-size: 15px; font-weight: bold;" class="clearfix"> <style> .btn-buy{ width:250px; float: right; margin-right: 0px; margin-top: 0px; } </style> <br> <button id="lanjutPembayaran" name="lanjutPembayaran" type="submit" class="btn btn-primary buyButton btn-buy"><?= strtoupper(lang('payment'))?></button> <img style="display: none;float: right;" class="img_nowidth lanjutPembayaran_spinner" width="40" src="<?= base_url('uploads/spinner.gif'); ?>"> </p> <script> /* jQuery(document).on('click', '.buyButton', function(e){ if (!jQuery('#completeAddress').val(e)) { e.preventDefault(); jQuery('#addressMessage').html('Alamat kirim harus diisi'); jQuery('#completeAddress').focus(); } if (!jQuery('#shipping_district').val(e)) { e.preventDefault(); jQuery('#addressMessage').html('Mohon memilih Kota/Kabupaten'); jQuery('#shipping_district').focus(); } if (!jQuery('#shipping_subdistrict').val(e)) { e.preventDefault(); jQuery('#addressMessage').html('Mohon memilih Kecamatan'); jQuery('#shipping_subdistrict').focus(); } }); */ /* jQuery('#lanjutPembayaran').click(function() { jQuery('#lanjutPembayaran').hide("fast"); jQuery('.lanjutPembayaran_spinner').show("fast"); }); */ </script> </div> </div> </div> <script> jQuery(document).ready(function() { <?php if($contain_indent_product == 'no') : ?> jQuery('.indentInformation').hide(); <?php endif; ?> //initially hide point reward and voucher block... jQuery('#pointrewardBlock').hide(); jQuery('#voucherBlock').hide(); <?php if($free_shipping_fee == 0): ?> jQuery('#freeshippingBlock').hide(); <?php endif; ?> }); </script> <?php $count = 0; ?> <?php foreach ($this->session->userdata('shipping_cart') as $rowid => $item): ?> <?php $count++; ?> <script> jQuery(document).ready(function() { jQuery('#spinner<?= $count; ?>').hide(); //dont use click, use .on to handle dynamic elements loaded by ajax <?php if($fs_cek_product == null): ?> jQuery(document).on('click', '.btnMin<?= $count; ?>', function(e){ e.preventDefault(); jQuery('.buyButton').attr('disabled', true); jQuery('.btnMin<?= $count; ?>').attr('disabled', true); jQuery('.btnAdd<?= $count; ?>').attr('disabled', true); jQuery('#spinner<?= $count; ?>').show(); var qty = jQuery('.productQuantity<?= $count; ?>').val(); qty--; if(qty == 0) { qty = 1; } jQuery('.productQuantity<?= $count; ?>').val(qty); ajax_check_stock<?= $count; ?>(qty); }); jQuery(document).on('click', '.btnAdd<?= $count; ?>', function(e){ e.preventDefault(); jQuery('.buyButton').attr('disabled', true); jQuery('.btnMin<?= $count; ?>').attr('disabled', true); jQuery('.btnAdd<?= $count; ?>').attr('disabled', true); jQuery('.shipping_method<?= $rowid; ?>').attr('disabled', true); jQuery('#spinner<?= $count; ?>').show(); var qty = jQuery('.productQuantity<?= $count; ?>').val(); qty++; jQuery('.productQuantity<?= $count; ?>').val(qty); ajax_check_stock<?= $count; ?>(qty); }); <?php endif; ?> jQuery(document).on('click', '.shipping_method<?= $rowid; ?>', function(){ jQuery('.buyButton').attr('disabled', true); jQuery('.btnMin<?= $count; ?>').attr('disabled', true); jQuery('.btnAdd<?= $count; ?>').attr('disabled', true); jQuery('.shipping_method<?= $rowid; ?>').attr('disabled', true); jQuery('#spinner<?= $count; ?>').show(); var qty = jQuery('.productQuantity<?= $count; ?>').val(); //jQuery('.productQuantity<?= $count; ?>').val(qty); ajax_get_subtotal<?= $count; ?>(qty, function(){ var province = jQuery('#shipping_province').val(); var subdistrict = jQuery('#shipping_subdistrict').val(); ajax_get_grandtotal<?= $count; ?>(qty,subdistrict,province); }); }); }); function ajax_check_stock<?= $count; ?>(qty) { jQuery.ajax({ 'url' : '<?= base_url(); ?>' + 'ajax/ajax_check_stock_shipping', 'type' : 'POST', 'data' : { 'qty' : qty, 'warehouse_id': <?= $item['warehouse_id']; ?>, 'item_id' : <?= $item['id']; ?>, 'product_id' : <?= $item['product_id']; ?>, 'is_backorder': '<?= $item['is_backorder']; ?>', '<?= $this->security->get_csrf_token_name(); ?>' : '<?= $this->security->get_csrf_hash(); ?>' }, 'success' : function(data) { if (data) { /*---if stock not enough----*/ jQuery('.noStock<?= $count; ?>').html(data); if (data != 'Not Enough Stock') { ajax_change_shipping_fee<?= $count; ?>(qty); }else{ Swal.fire({ position: 'center', // position: 'top', icon: 'error', text: data, // showConfirmButton: false, confirmButtonText: 'OK', timer: 3000, customClass: { confirmButton: 'btn-swal-confirm', } }).then((result) => { if (result.value) { // window.location.href = "<?= base_url('wishlist'); ?>"; } }); } }; } }); } function ajax_change_shipping_fee<?= $count; ?>(qty) { //check selected shipping method var selected_shipping_method_id; selected_shipping_method_id = jQuery('input[name=shipping_method<?= $rowid; ?>]:checked').val(); var province = jQuery('#shipping_province').val(); var currentRequest1 = null; currentRequest1 = jQuery.ajax({ 'url' : '<?= base_url(); ?>' + 'ajax/ajax_change_shipping_fee', 'type' : 'POST', 'data' : { // 'no_of_indent' : <?= $no_of_indent; ?>, // 'no_of_instock' : <?= $no_of_instock; ?>, // 'shipping_id' : <?= $shipping_id; ?>, 'province' : province, 'qty' : qty, 'price' : <?= $item['price']; ?>, 'rowid' : '<?= $rowid; ?>', 'shipping_method_ids': '<?= implode(",", $item["shipping_method_ids"]); ?>', 'selected_shipping_method_id' : selected_shipping_method_id, 'warehouse_id': <?= $item['warehouse_id']; ?>, 'shipping_id_subdistrict' : <?= $shipping->shipping_id_subdistrict; ?>, 'sub_total': <?= $item['subtotal']; ?>, 'product_id' : <?= $item['product_id']; ?>, 'item_id' : <?= $item['id']; ?>, '<?= $this->security->get_csrf_token_name(); ?>' : '<?= $this->security->get_csrf_hash(); ?>' }, beforeSend : function() { if(currentRequest1 != null) { currentRequest1.abort(); } }, 'success' : function(data) { if (data) { jQuery('#shippingNameBlock<?= $count; ?>').html(data); ajax_get_subtotal<?= $count; ?>(qty, function(){ var province = jQuery('#shipping_province').val(); var subdistrict = jQuery('#shipping_subdistrict').val(); ajax_get_grandtotal<?= $count; ?>(qty,subdistrict,province); }); }; } }); } function ajax_get_subtotal<?= $count; ?>(qty, grand_total) { //check selected shipping method var selected_shipping_method_id; selected_shipping_method_id = jQuery('input[name=shipping_method<?= $rowid; ?>]:checked').val(); //check selected shipping method var currentRequest2 = null; currentRequest2 = jQuery.ajax({ 'url' : '<?= base_url(); ?>' + 'ajax/ajax_get_subtotal', 'type' : 'POST', 'data' : { 'qty' : qty, 'price' : <?= $item['price']; ?>, 'rowid' : '<?= $rowid; ?>', 'selected_shipping_method_id' : selected_shipping_method_id, 'warehouse_id': <?= $item['warehouse_id']; ?>, 'shipping_id_subdistrict' : <?= $shipping->shipping_id_subdistrict; ?>, 'product_id' : <?= $item['product_id']; ?>, 'item_id' : <?= $item['id']; ?>, '<?= $this->security->get_csrf_token_name(); ?>' : '<?= $this->security->get_csrf_hash(); ?>' }, beforeSend : function() { if(currentRequest2 != null) { currentRequest2.abort(); } }, 'success' : function(data) { if (data) { jQuery('#subTotal<?= $count; ?>').html(data); grand_total(); }; } }); } function ajax_get_grandtotal<?= $count; ?>(qty,subdistrict,province) { //check selected shipping method var currentRequest3 = null; currentRequest3 = jQuery.ajax({ 'url' : '<?= base_url(); ?>' + 'ajax/ajax_get_grandtotal', 'type' : 'POST', 'data' : { 'using_ajax' : true, 'province' : province, 'subdistrict' : subdistrict, '<?= $this->security->get_csrf_token_name(); ?>' : '<?= $this->security->get_csrf_hash(); ?>' }, beforeSend : function() { if(currentRequest3 != null) { currentRequest3.abort(); } }, 'success' : function(data) { if (data) { var total = JSON.parse(data); var indent_remaining = total.indent_remaining.toString().replace('-',''); jQuery('#totalItemAmount').html(total.total_item_amount); jQuery('#firsttotal').html(total.total_item_amount); if (total.condition_freeshipping == true) { jQuery('#spn_totalshipping').html(''); jQuery('#totalShippingFee').html("<?= ucwords(lang('free'));?>"); }else{ jQuery('#totalShippingFee').html(total.total_shipping_fee); } jQuery('#totalFreeShippingFee').html(total.total_free_shipping_fee); jQuery('#finalshippingfee').html(total.finalshippingfee); jQuery('#grandTotal').html(total.grand_total); jQuery('#indentRemaining').html(indent_remaining); jQuery('#indentShippingFee').html(total.indent_shipping_fee); jQuery('.buyButton').attr('disabled', false); jQuery('.btnMin<?= $count; ?>').attr('disabled', false); jQuery('.btnAdd<?= $count; ?>').attr('disabled', false); jQuery('.shipping_method<?= $rowid; ?>').attr('disabled', false); jQuery('#spinner<?= $count; ?>').hide(); jQuery('#voucher').val(''); jQuery('#voucherprice_input').val(0); jQuery('#point').val(''); jQuery('#pointrewards_input').val(0); jQuery('#voucherdiscount').html('') jQuery('#voucherprice').html('0'); jQuery('#pointrewards').html('0'); }; } }); } </script> <?php endforeach; ?> <?php if($this->session->userdata('customer') && $this->session->userdata('customer')['customer_type'] == 'regular') : ?> <script> jQuery(document).ready(function() { jQuery('#spinnerVoucher').hide(); jQuery('#spinnerPoint').hide(); jQuery("#redeemVoucher").click(function(){ jQuery('#spinnerVoucher').show(); var voucher = jQuery("#voucher").val(); if(voucher == ''){ jQuery('#error_voucher').html('Insert Voucher First !!!'); jQuery('#spinnerVoucher').hide(); } else{ var pointprice = jQuery('#pointrewards_input').val(); if(pointprice == ''){ pointprice = 0; } else{ pointprice = pointprice; } var id_customer = <?= $shipping->id_customers; ?>; var province = jQuery('#shipping_province').val(); var subdistrict = jQuery('#shipping_subdistrict').val(); jQuery('.buyButton').attr('disabled', true); ajax_set_voucher(voucher,pointprice,id_customer,province,subdistrict); } }); jQuery("#redeemPoint").click(function(){ jQuery('#spinnerPoint').show(); var point = jQuery("#point").val(); if(point == ''){ jQuery('#error_point').html('Insert Point First !!!'); jQuery('#spinnerPoint').hide(); } else if(point < 0){ jQuery('#error_point').html('Wrong Format Point !!!'); jQuery('#spinnerPoint').hide(); } else{ var voucherprice = jQuery('#voucherprice_input').val(); if(voucherprice == ''){ voucherprice = 0; } else{ voucherprice = voucherprice; } var id_customer = <?= $shipping->id_customers; ?>; var province = jQuery('#shipping_province').val(); var subdistrict = jQuery('#shipping_subdistrict').val(); jQuery('.buyButton').attr('disabled', true); ajax_set_point_rewards(voucherprice,point,id_customer,province,subdistrict); } }); }); function ajax_set_voucher(voucher,pointprice,id_customer,province,subdistrict) { jQuery.ajax({ 'url' : '<?= base_url(); ?>' + 'ajax/ajax_set_voucher', 'type' : 'POST', 'data' : { 'voucher' : voucher, 'pointprice' : pointprice, 'id_customer' : id_customer, 'province' : province, 'subdistrict' : subdistrict, '<?= $this->security->get_csrf_token_name(); ?>' : '<?= $this->security->get_csrf_hash(); ?>' }, 'success' : function(data) { console.log('voucher data: ', data); if (data) { var total = JSON.parse(data); // jQuery('.indentInformation').show(); if(total.voucherprice_input > 0){ jQuery('#voucherBlock').show(); } if(total.voucherprice_input == 0){ jQuery('#error_voucher').html(total.alert) }else{ jQuery('#error_voucher').html('') } // jQuery('#freeshippingBlock').show(); jQuery('#totalItemAmount').html(total.total_item_amount); jQuery('#voucherdiscount').html(total.voucher_discount) jQuery('#voucherprice').html(total.voucherprice); jQuery('#voucherprice_input').val(total.voucherprice_input); // plus var totalItemAmount = parseInt(jQuery("span#totalItemAmount").html().split(",").join('')); console.log('totalItemAmount', totalItemAmount); var totalShippingFee = parseInt(0); if(jQuery("span#totalShippingFee").html() != undefined){ totalShippingFee = parseInt(jQuery("span#totalShippingFee").html().split(",").join('')); } // min var voucherprice = parseInt(jQuery("span#voucherprice").html().split(",").join('').replace("-","")); var pointrewards = parseInt(jQuery("span#pointrewards").html().split(",").join('').replace("-","")); var totalFreeShippingFee = parseInt(jQuery("span#totalFreeShippingFee").html().split(",").join('').replace("-","")); //var indent_remaining = parseInt(jQuery('#indentRemaining').html().split(",").join('').replace("-","")); var grand_total = (totalItemAmount+ totalShippingFee)- (voucherprice+ pointrewards+ totalFreeShippingFee); // var grand_total = // (totalItemAmount+ // totalShippingFee)- // (voucherprice+ // pointrewards+ // totalFreeShippingFee) - indent_remaining; jQuery('#grandTotal').html( formatIDR(grand_total) ); jQuery('#spinnerVoucher').hide(); jQuery('.buyButton').attr('disabled', false); }; } }); } function ajax_set_point_rewards(voucherprice,point,id_customer,province,subdistrict) { jQuery.ajax({ 'url' : '<?= base_url(); ?>' + 'ajax/ajax_set_point_rewards', 'type' : 'POST', 'data' : { 'voucherprice' : voucherprice, 'point' : point, 'id_customer': id_customer, 'province' : province, 'subdistrict' : subdistrict, '<?= $this->security->get_csrf_token_name(); ?>' : '<?= $this->security->get_csrf_hash(); ?>' }, 'success' : function(data) { if (data) { var total = JSON.parse(data); // jQuery('.indentInformation').show(); if(total.pointrewards_input > 0){ jQuery('#pointrewardBlock').show(); } // jQuery('#voucherBlock').show(); // jQuery('#freeshippingBlock').show(); jQuery('#totalItemAmount').html(total.total_item_amount); jQuery('#pointrewards').html(total.pointrewards); jQuery('#pointrewards_input').val(total.pointrewards_input); // plus var totalItemAmount = parseInt(jQuery("span#totalItemAmount").html().split(",").join('')); var totalShippingFee = parseInt(0); if(jQuery("span#totalShippingFee").html() != undefined){ totalShippingFee = parseInt(jQuery("span#totalShippingFee").html().split(",").join('')); } // min var voucherprice = parseInt(jQuery("span#voucherprice").html().split(",").join('').replace("-","")); var pointrewards = parseInt(jQuery("span#pointrewards").html().split(",").join('').replace("-","")); var totalFreeShippingFee = parseInt(jQuery("span#totalFreeShippingFee").html().split(",").join('').replace("-","")); //var indent_remaining = parseInt(jQuery('#indentRemaining').html().split(",").join('').replace("-","")); var grand_total = (totalItemAmount+ totalShippingFee)- (voucherprice+ pointrewards+ totalFreeShippingFee); // var grand_total = // (totalItemAmount+ // totalShippingFee)- // (voucherprice+ // pointrewards+ // totalFreeShippingFee) - indent_remaining; jQuery('#grandTotal').html( formatIDR(grand_total) ); jQuery('#error_point').html(total.alert); jQuery('#spinnerPoint').hide(); jQuery('.buyButton').attr('disabled', false); }; } }); } </script> <?php endif; ?> <?php else : ?> <!--- cart no content--> <p>YOUR CART IS EMPTY.</p> <?php endif; ?> </div><!-- end myCart --> </div> </div> </div> <?= form_close(); ?>