Backups Created:
/home/japatmex/public_html/wp-content/edit-wolf.php
Savvy
W
olf -
MANAGER
Edit File: checkout.php
<?php $ci =& get_instance(); ?> <style> /* 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; } .site-color{ background-color: var(--site-main-color) !important; border-color: var(--site-main-color) !important; } </style> <!-- <form method="POST" name"place_order" action="<?=base_url('Ecomm/place_order')?>" type="multipart/form-data"> --> <div class="checkout-area mt-20"> <?php $addresses = $addresses ?: array(); //d($addresses); $errors = $this->session->flashdata('response_msg') ? $this->session->flashdata('response_msg') : []; // if(count($errors)) { // d($errors); // }; ?> <div class="container"> <div class="row"> <?php if($this->session->flashdata('response_msg')) {?> <!-- <div class="col-md-6 alert alert-danger"> <?php //echo $this->session->flashdata('response_msg');?> </div> --> <?php } ?> <div class="col-md-7 mt-4"> <div class="checkout-form-area mt-25"> <div class="checkout-title"> <h4>Billing Details</h4> </div> <div class="address_details_block"> <?php /*if($this->session->userdata(');user_type') != 'guest' || $this->session->userdata('GSM_FUS_UserId')) : */?><!-- <span class="address_details_item "> <a href="" class="btn_new_address" style="font-size: 16px"> <span class="address_list" style="padding: 15px 5px"> <i class="fa fa-plus"></i> Add New Address </span> </a> </span> --><?php /*endif; */?> <?php //if($this->session->userdata('user_type') == 'guest') : ?> <div class="ceckout-form add_addresss_block mt-3 mb-5" style="background: #eee;padding: 20px;<?php /*if(empty($addresses)){ echo 'display: block';}else{ echo 'display: none'; }*/ ?>" > <div class="billing-fields"> <div class="row"> <div class="col-md-6 form-group"> <p class="mb-0 mt-3" style="font-size: 13px;"> <label>Name<span class="required">*</span></label> </p> <input class="form-control" type="text" placeholder="Enter name" name="billing_name" required value="<?php if ($this->session->userdata('cart_id') == $addresses[0]->user_id ){ echo $addresses[0]->name; }else{ echo '';}?>" onkeyup="edValueKeyPress()" id="billing_name" autocomplete="off"> <span><?php echo isset($errors['billing_name']) ? $errors['billing_name'] : ''; ?></span> </div> <div class="col-md-6"> <p class="mb-0 mt-3" style="font-size: 13px;"> <label>Mobile no.<span class="required">*</span></label> </p> <input class="form-control" type="number" placeholder="Mobile Number" name="billing_mobile_no" id="billing_mobile_no" autocomplete="off" value="<?php if ($this->session->userdata('cart_id') == $addresses[0]->user_id ){ echo $addresses[0]->mobile_no; }else{ echo '';}?>" oninput="javascript: if (this.value.length > this.maxLength) this.value = this.value.slice(0, this.maxLength);" onkeyup="edValueKeyPress(); if(/\D/g.test(this.value)) this.value = this.value.replace(/\D/g,'')" maxlength="11" required> <span><?php echo isset($errors['billing_mobile_no']) ? $errors['billing_mobile_no'] : ''; ?></span> <!-- onkeyup="if(/\D/g.test(this.value)) this.value = this.value.replace(/\D/g,'')" --> </div> <div class="col-md-12"> <p class="mb-0 mt-3" style="font-size: 13px;"> <label>Email<span class="required">*</span></label> </p> <input class="form-control" type="email" placeholder="Enter Email" name="billing_email" required="" value="<?php if ($this->session->userdata('cart_id') == $addresses[0]->user_id ){ echo $addresses[0]->email; }else{ echo '';}?>" onkeyup="edValueKeyPress()" id="billing_email" autocomplete="off"> <span><?php echo isset($errors['billing_email']) ? $errors['billing_email'] : ''; ?></span> </div> <div class="col-md-12"> <p class="mb-0 mt-3" style="font-size: 13px;"> <label>Address (House no., Building Name)<span class="required">*</span></label> </p> <textarea class="form-control" placeholder="House no., Building Name" name="building_name" style="background: #fff" onkeyup="edValueKeyPress()" id="building_name"><?php if ($this->session->userdata('cart_id') == $addresses[0]->user_id ){ echo $addresses[0]->building_name; }else{ echo '';}?></textarea> <span><?php echo isset($errors['building_name']) ? $errors['building_name'] : ''; ?></span> </div> <!-- <div class="col-md-12"> <p class="mb-0 mt-3" style="font-size: 13px;"> <label>Road, Area, Colony<span class="required">*</span></label> </p> <input class="form-control" type="hidden" placeholder="Enter road, area, colony" name="road_area_colony" value=" " required="" onkeyup="edValueKeyPress()" id="road_area_colony" autocomplete="off"> <span><?php //echo isset($errors['road_area_colony']) ? $errors['road_area_colony'] : ''; ?></span> </div> <div class="col-md-12"> <p class="mb-0 mt-3" style="font-size: 13px;"> <label>Landmark (Optional)</label> </p> <input class="form-control" type="hidden" placeholder="Enter landmark (optional)" name="landmark" value=" " onkeyup="edValueKeyPress()" id="landmark" autocomplete="off"> <span><?php //echo isset($errors['landmark']) ? $errors['landmark'] : ''; ?></span> </div> --> <div class="col-md-6"> <p class="mb-0 mt-3" style="font-size: 13px;"> <label>City<span class="required">*</span></label> </p> <input class="form-control" type="text" placeholder="Enter city" name="city" value="<?php if ($this->session->userdata('cart_id') == $addresses[0]->user_id ){ echo $addresses[0]->city; }else{ echo '';}?>" required="" onkeyup="edValueKeyPress()" id="city" autocomplete="off"> <span><?php echo isset($errors['city']) ? $errors['city'] : ''; ?></span> </div> <div class="col-md-6"> <p class="mb-0 mt-3" style="font-size: 13px;"> <label>State<span class="required">*</span></label> </p> <input class="form-control" type="text" placeholder="Enter State" name="state" value="<?php if ($this->session->userdata('cart_id') == $addresses[0]->user_id ){ echo $addresses[0]->state; }else{ echo '';}?>" required="" onkeyup="edValueKeyPress()" id="state" autocomplete="off"> <span><?php echo isset($errors['state']) ? $errors['state'] : ''; ?></span> </div> <div class="col-md-6"> <p class="mb-0 mt-3" style="font-size: 13px;"> <label>Country<span class="required">*</span></label> </p> <?php //d(set_value($addresses[0]->country)); $arr_addr = explode('|', $addresses[0]->country); //d($arr_addr); ?> <?php $countries = fetchCountries(); ?> <select name="countryId" class="form-control" onchange="edValueKeyPress()" id="countryId" autocomplete="off"> <option disabled="" selected="" value="">Country*</option> <?php if ($this->session->userdata('cart_id') == $addresses[0]->user_id ){?> <option value="<?php echo $addresses[0]->country; ?>" <?php echo $arr_addr[0] ? 'selected' : ''; ?> ><?php echo stripslashes($arr_addr[1]); ?></option> <? } ?> <?php foreach($countries as $country) { ?> <option value="<?php echo $country->CountryId; ?>|<?php echo stripslashes($country->Country);?>" ><?php echo stripslashes($country->Country); ?></option> <?php } ?> </select> <span><?php echo isset($errors['countryId']) ? $errors['countryId'] : ''; ?></span> </div> <div class="col-md-12"><br> <p> <label>Address Type<span class="required">*</span></label> </p> <div class="clearfix"></div> <!-- <label class="radio-inline"> <input type="radio" name="address_type" class = 'address_type' value="Home Address" style="width: 20px;height: 15px" checked id="address_type_home" autocomplete="off">Home (All day delivery) </label> <label class="radio-inline"> <input type="radio" name="address_type" class = 'address_type' value="Office Address" style="width: 20px;height: 15px" id="address_type_office" autocomplete="off">Office (Delivery between 10 AM - 5 PM) </label> --> <?php foreach ($shippings as $value) { ?> <label class="radio-inline"> <input type="radio" name="address_type" class = "address_type" value="<?=$value->id?>" data-id="<?=$value->shipping_fee?>" style="width: 20px;height: 15px" id="<?=$value->shipping_name == 'Yalidine Home Delivery' ? 'address_type_home' : 'address_type_office'; ?>" autocomplete="off"> <?=$value->shipping_name?> </label> <?php } ?> </div> </div> <br/> </div> </div> <?php //endif; ?> </div> </div> </div> <div class="col-md-5 mt-5 pt-5"> <div class="your-order-fields mt-25"> <h4>Your Order</h4> <?php $total_cart_amt=$delivery_charge=0; $cart_ids=''; if(count($checkout) > 0){ foreach ($checkout as $key => $value) { // overwriting product price with variation price if(isset($value->variation_sale_price)) { $value->selling_price = $value->variation_sale_price; }else if(isset($value->variation_price) and !is_null($value->variation_price)){ $value->selling_price = $value->variation_price; } $cart_ids.=$value->id.','; ?> <!-- <div class="your-order-title"> <a href="<?php echo site_url('remove-to-cart/'.$value->id); ?>" class="btn_remove_cart text-secondary float-right"> <strong style="font-size: 17px; color: red; margin-right: 5px" title="Remove product !"><i class="fa fa-trash"></i></strong></a> </div> --> <div class="your-order-table table-responsive"> <ul class="list-group list-group-flush"> <li class="list-group-item d-flex justify-content-between align-items-center border-0 px-0 pb-0 font-weight-light text-secondary"> <span><?php if(strlen($value->product_title) > 25){ echo substr(stripslashes($value->product_title), 0, 25).'...'; }else{ echo $value->product_title; } ?> <strong class="product-quantity"> × <?=$value->product_qty?></strong> </span> <?php if(isset($value->variation_one)) { echo '<br/Payment>'.$value->variation_one . ': ' . $value->variation_one_value .' '; } ?> <?php if(isset($value->variation_two)) { echo $value->variation_two . ': ' . $value->variation_two_value .' '; } ?> <?php if(isset($value->variation_three)) { echo $value->variation_three . ': ' . $value->variation_three_value .' '; } ?> <span class="amount"> <?php echo getusercurrency().' '.Currency_Formator(getuserprice($value->selling_price*$value->product_qty)); ?> </span> </li> <?php $total_cart_amt+=$value->selling_price*$value->product_qty; $delivery_charge+=$value->delivery_charge; ?> <?php } } else { return redirect('home'); } $cart_ids=rtrim($cart_ids,','); ?> <li class="list-group-item d-flex justify-content-between align-items-center border-0 px-0 pb-0 font-weight-light text-secondary "> Subtotal:<?php $for_coupon_amount = $total_cart_amt; ?><span class="amount total_after_coupon" data-id="<?=$total_cart_amt?>"><?=getusercurrency().' '.Currency_Formator(getuserprice($total_cart_amt));?></span> </li> <li class="list-group-item d-flex justify-content-between align-items-center border-0 px-0 pb-0 font-weight-light text-secondary">Delivery Charge: <span class="total_dc_amount"> <!-- <li class="list-group-item d-flex justify-content-between align-items-center border-0 px-0 pb-0 font-weight-light text-secondary">Delivery Charge: --> <?php if($settings_row->delivery_field == 1){ ?> <span><?=($delivery_charge!=0)?getusercurrency().' '.Currency_Formator(getuserprice($delivery_charge)):'Free';?></span> <?php } else if($settings_row->delivery_field == 0){ if(($settings_row->cart_amount_for_free_delivery != 0 && $total_cart_amt-$delivery_charge) <= $settings_row->cart_amount_for_free_delivery){ $delivery_charges_coupon = $settings_row->default_delivery_charges;?> <span><?=($settings_row->default_delivery_charges!=0)?getusercurrency().' '.Currency_Formator(getuserprice($settings_row->default_delivery_charges)):'Free';?></span> <?php }else{ $delivery_charges_coupon = $delivery_charge;?> <span><?=($delivery_charge=0)?'+'.getusercurrency().' '.Currency_Formator(getuserprice($delivery_charge)):'Free';?></span> <?php } } ?> </span></li> <li class="list-group-item d-flex justify-content-between align-items-center border-0 px-0 pb-0 font-weight-light text-secondary ">Coupon Discount: <span class="discount_coupen_amt"><?php echo getusercurrency();?> 0.</span></li> <div class="dropdown-divider mb-0 pb-0 mt-4"></div> <li class="list-group-item d-flex justify-content-between align-items-center border-0 px-0 pb-0 font-weight-light text-secondary"> Total: <?php if($settings_row->delivery_field == 1){ ?> <strong><span class="total-amount total_payable_amt"><?=getusercurrency().' '.Currency_Formator(getuserprice($total_cart_amt + $delivery_charge));?></span></strong> <?php } else if($settings_row->delivery_field == 0 && $settings_row->default_delivery_charges != 0 && ($total_cart_amt-$delivery_charge) <= $settings_row->cart_amount_for_free_delivery){ $total_cart_amt = $total_cart_amt-$delivery_charge; $total_cart_amt += $settings_row->default_delivery_charges; ?><strong><span class="total-amount total_payable_amt"><?=getusercurrency().' '.Currency_Formator(getuserprice($total_cart_amt));?></span></strong> <?php }else { ?> <strong><span class="total-amount total_payable_amt"><?=getusercurrency().' '.Currency_Formator(getuserprice($total_cart_amt-$delivery_charge));?></span></strong> <?php } ?> </li> </ul> <div class="customfeild apply_button mt-4 d-flex"> <input type="text" name="coupon_code" id="coupon_code" placeholder="Enter coupon number here...." class="form-control"> <a href="javascript:void(0)" data-amount="<?php echo (isset($for_coupon_amount)) ? : ''; ?>" data-delivery="<?php echo (isset($delivery_charges_coupon)) ? : ''; ?>" class="ml-1 btn btn-success btn-md btn_apply_coupon site-color" style="border-radius: 3px">Apply</a> </div> <span class="save_msg"></span> <div class="remove_coupon" style="display: none;"> <a href="" style="color: red"> × Remove Coupon Code! </a> </div> <div> <div class="your-order-title mt-4"> <h4>Order Notes</h4> <textarea class="form-control" placeholder="Please write order instructions here...." rows="3" name="order_notes" id="order_notes" style="background: #fff" ></textarea> </div> <hr/> </div> </div> </div> <!-- --> <div class="checkout-payment mb-50"> <div class="your-order-title"> <h4>Payment</h4> </div> <form method="POST" action="<?=base_url('Ecomm/place_order')?>"> <!-- F1 --> <input type="hidden" name="billing_name" value="<?php if ($this->session->userdata('cart_id') == $addresses[0]->user_id ){ echo $addresses[0]->name; }else{ echo '';}?>" id="billing_name_c" required> <input type="hidden" name="billing_mobile_no" value="<?php if ($this->session->userdata('cart_id') == $addresses[0]->user_id ){ echo $addresses[0]->mobile_no; }else{ echo '';}?>" id="billing_mobile_no_c" onfocus="if(/\D/g.test(this.value)) this.value = this.value.replace(/\D/g,'')" required> <input type="hidden" name="billing_email" value="<?php if ($this->session->userdata('cart_id') == $addresses[0]->user_id ){ echo $addresses[0]->email; }else{ echo '';}?>" id="billing_email_c" required> <input type="hidden" name="building_name" value="<?php if ($this->session->userdata('cart_id') == $addresses[0]->user_id ){ echo $addresses[0]->building_name; }else{ echo '';}?>" id="building_name_c" style="display: none;" required> <input type="hidden" name="road_area_colony" value="<?php if ($this->session->userdata('cart_id') == $addresses[0]->user_id ){ echo $addresses[0]->road_area_colony; }else{ echo ' ';}?>" id="road_area_colony_c" required> <input type="hidden" name="landmark" value="<?php if ($this->session->userdata('cart_id') == $addresses[0]->user_id ){ echo $addresses[0]->landmark; }else{ echo ' ';}?>" id="landmark_c" required> <input type="hidden" name="countryId" value="<?php if ($this->session->userdata('cart_id') == $addresses[0]->user_id ){ echo $addresses[0]->country; }else{ echo '';}?>" id="countryId_c" required> <input type="hidden" name="city" value="<?php if ($this->session->userdata('cart_id') == $addresses[0]->user_id ){ echo $addresses[0]->city; }else{ echo '';}?>" id="city_c" required> <input type="hidden" name="state" value="<?php if ($this->session->userdata('cart_id') == $addresses[0]->user_id ){ echo $addresses[0]->state; }else{ echo '';}?>" id="state_c" required> <input type="hidden" name="address_type" value="<?php if ($this->session->userdata('cart_id') == $addresses[0]->user_id ){ echo $addresses[0]->address_type; }else{ echo '';}?>" id="address_type_c" required> <!-- --> <!-- F2 --> <input type="hidden" name="coupon_id" class="coupon_id_input" value="0"> <input type="hidden" name="order_address" value="<?php echo $order_address_id; ?>"> <input type="hidden" name="total_amt" class="total_after_coupon_input" value="<?php echo getuserprice($total_cart_amt-$delivery_charge); ?>"> <input type="hidden" name="discount" class="total_after_coupon_input" value="0"> <input type="hidden" name="discount_amt" class="discount_coupen_amt_input" value="0"> <input type="hidden" name="payable_amt" class="total_payable_amt_input" value="<?php echo getuserprice($total_cart_amt); ?>"> <input type="hidden" name="cart_ids" value="<?php echo $cart_ids; ?>"> <input type="hidden" name="delivery_charge" class="delivery_charges_input" value="<?php echo getuserprice($delivery_charge); ?>"> <!-- --> <ul> <li class="payment_method"> <input id="payment_method_cod" class="input-radio" name="payment_method" checked="checked" value="cod" type="radio"> <label for="payment_method_cod">Cash on Delivery</label> </li> <?php $checkCredits = str_replace(',', '', $checkCredits); ?> <?php if($pMethods != '') { foreach($pMethods as $row): ?> <?php if($row->PayMethodTypeId == '58'){ ?> <?php if($checkCredits >= getuserprice($total_cart_amt+$delivery_charge)){ ?> <li class="payment_method"> <input id="payment_method_paypal" class="input-rado" name="payment_method" value="<?php echo $row->PayMethodTypeId; ?>" data-order_button_text="Proceed to PayPal" type="radio"> <label for="payment_method_paypal"> <?php echo $row->PaymentMethod; ?> <a href="#"><img src="<?/*=base_url('assets/site_assets/img/payment/payment2.png')*/?>" alt="" style="max-width: 50%"/></a></label> <div class="pay-box payment_method_paypal"> <p>Pay via <?php echo $row->PaymentMethod; ?><br/>Balance : <?=getusercurrency().' '.$checkCredits?></p> </div> </li> <?php } else { ?> <li class="payment_method"> <input id="" class="input-rado" name="" value="" data-order_button_text="" type="radio" disabled=""> <label for="payment_method_paypal"><?php echo $row->PaymentMethod; ?></label> <div class="pay-box payment_method_paypal"> <p><?=$this->lang->line('CUST_CODE_MSG2')?></p> </div> </li> <?php }?> <?php } else { ?> <li class="payment_method"> <input id="payment_method_paypal" class="input-rado" name="payment_method" value="<?php echo $row->PayMethodTypeId; ?>" data-order_button_text="Proceed to PayPal" type="radio"> <label for="payment_method_paypal"> <?php echo $row->PaymentMethod; ?></label> <div class="pay-box payment_method_paypal"> <p><?php echo $this->lang->line('CUST_CODE_MSG2'); ?></p> </div> </li> <?php } endforeach; } ?> <li class="payment_method"> <div class="pay-box payment_method_cod"> <div class="col-md-12 d-flex"> <div class="col-md-3 col-sm-2" style="padding:0 8px"> <label style="margin-top: 10px;letter-spacing: 2px"><span class="_lblnum1"><?=rand(0,10)?></span> + <span class="_lblnum2"><?=rand(5,10)?></span> = </label> </div> <div class="col-md-4 col-sm-4 col-xs-12" style="padding:0 8px 0 0"> <input type="text" name="" class="form-control input_txt"> </div> <div class="col-md-4 col-sm-6 align-items-center"></div> </div> </div> </li> <?php //} ?> <div class="text-right"> <input class="btn btn-success site-color" type="submit" value="Place Order"> <!-- <button class="order-btn btn_place_order btn btn-success mt-3 site-color" type="submit">Place Order</button> --> </div> </ul> <input type="hidden" name="order_notes_val" id="order_notes_val" value=""> </form> </div> <!-- --> </div> </div> </div> </div> <div id="stripeModal" class="modal" style="z-index: 9999999;background: rgba(0,0,0,0.8);"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <h2 class="modal-title" style="margin:15px 0px 0px 20px;font-weight:600;font-size:20px">Payment Details</h2> <button type="button" class="close" data-dismiss="modal">×</button> </div> <div class="modal-body"> <?php $get_strip_Setting = $this->db->get_where('tbl_gf_ecomm_settings', array('id' => '1'))->row()->stripe_key; if($get_strip_Setting != '') { $strip_Setting = $this->db->get_where('tbl_gf_ecomm_settings', array('id' => '1'))->row()->stripe_key; } ?> <!-- <form role="form" action="<?php /*echo base_url()*/?>stripe/stripePost; ?>" method="post" class="require-validation" data-cc-on-file="false" data-stripe-publishable-key="<?php /*echo $strip_Setting; */?>" id="stripe-form">--> <!-- F1 --> <input type="hidden" name="billing_name" value="" id="billing_name_c" required> <input type="hidden" name="billing_mobile_no" value="" id="billing_mobile_no_c" required> <input type="hidden" name="billing_email" value="" id="billing_email_c" required> <input type="hidden" name="building_address" value="" id="building_address_c" required> <input type="hidden" name="road_area_colony" value=" " id="road_area_colony_c" required> <input type="hidden" name="landmark" value=" " id="landmark_c" required> <input type="hidden" name="city" value="" id="city_c" required> <input type="hidden" name="state" value="" id="state_c" required> <input type="hidden" name="address_type" value="" id="address_type_c" required> <!-- --> <!-- F2 --> <input type="hidden" name="coupon_id" class="coupon_id_input" value="0"> <input type="hidden" name="order_address" value="<?=$order_address_id?>"> <input type="hidden" name="total_amt" class="total_after_coupon_input" value="<?php echo getuserprice($total_cart_amt-$delivery_charge);?>"> <input type="hidden" name="discount" class="total_after_coupon_input" value="0"> <input type="hidden" name="discount_amt" class="discount_coupen_amt_input" value="0"> <input type="hidden" name="payable_amt" class="total_payable_amt_input" value="<?php echo getuserprice($total_cart_amt);?>"> <input type="hidden" name="cart_ids" value="<?=$cart_ids?>"> <input type="hidden" name="delivery_charge" class="delivery_charges_input" value="<?php echo getuserprice($delivery_charge);?>"> <!-- --> <input type="hidden" name="cart_ids" value="<?=$cart_ids?>"> <input type="hidden" name="delivery_charge" value="<?php echo getuserprice($delivery_charge);?>"> <!-- <input type="hidden" name="payment_method" value="stripe"> --> <div class='form-row row'> <div class='col-xs-12 form-group required'> <label class='control-label'>Name on Card</label> <input class='form-control' name="card_name" size='4' type='text' value="<?=$this->session->userdata('user_name')?>"> </div> </div> <div class='form-row row'> <div class='col-xs-12 form-group card required'> <label class='control-label'>Card Number</label> <input autocomplete='off' name="card_no" class='form-control card-number' size='20' type='text' value="4242424242424242"> </div> </div> <div class='form-row row'> <div class='col-xs-12 col-md-4 form-group cvc required'> <label class='control-label'>CVC</label> <input autocomplete='off' name="cvvNumber" class='form-control card-cvc' placeholder='ex. 311' size='4' value="" type='text'> </div> <div class='col-xs-12 col-md-4 form-group expiration required'> <label class='control-label'>Expiration Month</label> <input class='form-control card-expiry-month' name="ccExpiryMonth" placeholder='MM' size='2' type='text' value="12"> </div> <div class='col-xs-12 col-md-4 form-group expiration required'> <label class='control-label'>Expiration Year</label> <input class='form-control card-expiry-year' name="ccExpiryYear" placeholder='YYYY' size='4' type='text' value="2020"> </div> </div> <div class='form-row row'> <div class='col-md-12 error form-group hide'> <div class='alert-danger alert'>Please correct the errors and try again.</div> </div> </div> <div class="row"> <div class="col-xs-12"> <button class="order-btn btn btn-success site-color" type="submit">Place Order</button> </div> </div> </form> </div> </div> </div> </div> <!-- </form> --> <div id="orderConfirm" class="modal" style="z-index: 9999999;background: rgba(0,0,0,0.8);text-align:center;"> <div class="modal-dialog modal-confirm" style="width: fit-content"> <div class="modal-content"> <div class="modal-header"> <img src="<?=base_url('assets/images/success-icon.png')?>" style="width: 70px"> <h4 class="modal-title">Order is placed!</h4> </div> <div class="modal-body" style="padding-top: 0px"> <p class="text-center" style="font-size: 18px;color: green;font-weight: 600;margin-bottom: 5px">Thank you for order...</p> <p style="margin-bottom: 5px;text-align: center;">Your order has been confirmed. Check your email for detials.</p> <p style="color: #000;margin-bottom: 5px;font-size: 16px;text-align: center;"><strong>Order No:</strong> <span class="ord_no_lbl"></span></p> </div> <div class="modal-footer" style="text-align: center;"> <a href="<?=base_url('site/track_order')?>"><button class="btn btn-danger btn_track">Track Order</button></a> <button class="btn btn-success btn_orders site-color" onclick="location.href='<?=base_url('my-orders')?>'">My Orders</button> <button class="btn btn-danger btn_close closeModel"><i class="fa fa-close"></i> Close</button> </div> </div> </div> </div> <!-- coupon --> <!-- end coupon --> <!-- Sweetalert popup --> <link rel="stylesheet" type="text/css" href="<?=base_url('assets/sweetalert/sweetalert.css')?>"> <script type="text/javascript" src="<?=base_url('assets/sweetalert/sweetalert.min.js')?>"></script> <script type="text/javascript"> $('.address_type').change(function() { var deliver_at = $(this).val(); var address_type_c = document.getElementById("address_type_c"); address_type_c.value = deliver_at; edValueKeyPress(); }); function edValueKeyPress() { var billing_name = document.getElementById("billing_name"); var name = billing_name.value; var billing_name_c = document.getElementById("billing_name_c"); billing_name_c.value = name; var billing_mobile_no = document.getElementById("billing_mobile_no"); var mobile_no = billing_mobile_no.value; var billing_mobile_no_c = document.getElementById("billing_mobile_no_c"); billing_mobile_no_c.value = mobile_no; var billing_email = document.getElementById("billing_email"); var email = billing_email.value; var billing_email_c = document.getElementById("billing_email_c"); billing_email_c.value = email; var building_name = document.getElementById("building_name"); var building = building_name.value; var building_name_c = document.getElementById("building_name_c"); building_name_c.value = building; /*var road_area_colony = document.getElementById("road_area_colony"); var colony = road_area_colony.value; var road_area_colony_c = document.getElementById("road_area_colony_c"); road_area_colony_c.value = colony; var landmark = document.getElementById("landmark"); var land = landmark.value; var landmark_c = document.getElementById("landmark_c"); landmark_c.value = land;*/ var city = document.getElementById("city"); var c = city.value; var city_c = document.getElementById("city_c"); city_c.value = c; var state = document.getElementById("state"); var s = state.value; var state_c = document.getElementById("state_c"); state_c.value = s; var countryId = document.getElementById("countryId"); var country = countryId.value; var countryId_c = document.getElementById("countryId_c"); countryId_c.value = country; }; // function apply_coupon(_coupon_code, _cart_amt, _delivery, href) { $("#loader").show(); $.ajax({ url: href, data: { "coupon_code": _coupon_code, "cart_amt": _cart_amt, "delivery": _delivery }, type: 'post', success: function(res) { // $(".code_err").hide(); var obj = $.parseJSON(res); if (obj.success == '1') { $("#coupons_detail").modal("hide"); $('.notifyjs-corner').empty(); $.notify( obj.msg, { position: "top right", className: 'success' } ); $("#loader").hide(); $(".save_msg").html(obj.you_save_msg); $(".discount_coupen_amt").html("PKR "+obj.discount_amt); $(".discount_coupen_amt_input").val(obj.discount_amt); $(".total_payable_amt").html("PKR "+obj.payable_amt); $(".total_after_coupon").html("PKR "+obj.discount); $(".total_after_coupon_input").val(obj.discount); $(".coupon_id_input").val(obj.coupon_id); $(".total_payable_amt_input").val(obj.payable_amt); $(".delivery_charges_input").val(obj.delivery_charges); $(".discount").find("span").html(obj.discount_amt); $(".discount").show(); $(".apply_msg").show(); $(".payable_amt").show(); $(".msg_2").html(obj.you_save_msg); $(".payable_amt_display").html(currency_code + ' ' + obj.new_amt); //$(".payable_amt").find("span").html(currency_code + ' ' + obj.old_amt); $("input[name='coupon_id']").val(obj.coupon_id); $("input[name='discount']").val(obj.discount); $("input[name='discount_amt']").val(obj.discount_amt); $("input[name='payable_amt']").val(obj.new_amt); $(".apply_button").hide(); $(".remove_coupon").show(); } else { $.notify( obj.msg, { position: "top right", className: 'danger' } ); } }, error: function(res) { alert("error"); } }); } $(".btn_apply_coupon").click(function(e) { e.preventDefault(); href = '<?=base_url()?>Ecomm/apply_coupon'; var _coupon_code = $('[name="coupon_code"]').val(); var _cart_amt = $(this).data("amount"); var _delivery = $(this).data("delivery"); apply_coupon(_coupon_code, _cart_amt, _delivery, href); }); // $(".remove_coupon a").click(function(e) { e.preventDefault(); if (confirm("Are you sure to remove?")) { $('.notifyjs-corner').empty(); $.notify( 'Coupon code is removed...', { position: "top right", className: 'success' } ); $(".apply_button").show(); $(".remove_coupon").hide(); $(".apply_msg").hide(); $("input[name='coupon_id']").val('0'); $("input[name='discount']").val('0'); $("input[name='discount_amt']").val('0'); $("input[name='payable_amt']").val((parseFloat($("input[name='total_amt']").val()) + parseFloat($("input[name='delivery_charge']").val()))); $(".order-total").find("span").html(currency_code + ' ' + (parseFloat($("input[name='total_amt']").val()) + parseFloat($("input[name='delivery_charge']").val()))); } }); // place order $(".btn_place_order").on("click", function(e) { e.preventDefault(); var _count = 0; var _formData = $("form[name='place_order']").serializeArray(); console.log(_formData); var btn = $(this) btn.attr("disabled", true); if ($(".input_txt").val() != '') { btn.attr("disabled", false); _count = 0; $(".input_txt").css("border-color", "#ccc"); var _sum = parseInt($("._lblnum1").text()) + parseInt($("._lblnum2").text()); if (parseInt($(".input_txt").val()) != _sum) { swal("Enter correct value !!!"); var x = Math.floor((Math.random() * 10) + 1); var y = Math.floor((Math.random() * 10) + 1); $("._lblnum1").text(x); $("._lblnum2").text(y); $(".input_txt").val(''); _count++; } } else { _count++; $(".input_txt").css("border-color", "red"); btn.attr("disabled", false); } if (_count == 0) { $(".process_loader").show(); href = '<?php echo base_url('Ecomm/place_order')?>'; $.ajax({ type: 'POST', dataType: 'json', url: href, data: $("form[name='place_order']").serialize(), success: function(res) { btn.attr("disabled", false); var obj = $.parseJSON(res); $(".process_loader").hide(); if (obj.success == '1') { $("#orderConfirm .ord_no_lbl").text(obj.order_unique_id); $("#orderConfirm .btn_track").click(function(e) { //window.location.href = base_url + 'my-orders/' + obj.order_unique_id; }); $("#orderConfirm").fadeIn(); // if(res['url'] != ''){ // window.location.href = res['url']; // } } else if (obj.success == '-1') { swal({ title: "Opps!", text: obj.msg, type: "error" }); } else { $(".process_loader").hide(); swal("Something gone wrong!", res); } } }); } }); // $(document).on('click', '.btn_delete_address', function(e) { e.preventDefault(); var _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) { href = "<?php echo base_url('Ecomm/delete_address/'); ?>" + _id; window.location.href = href; } else { swal.close(); } }); }); // $('.closeModel').click(function () { $('#orderConfirm').modal('toggle'); window.location.replace("<?php echo base_url(); ?>"); }) // for stripe payment var $form = $(".require-validation"); $('form.require-validation').bind('submit', function(e) { $(".process_loader").show(); e.preventDefault(); var $form = $(".require-validation"), inputSelector = ['input[type=email]', 'input[type=password]', 'input[type=text]', 'input[type=file]','textarea'].join(', '), $inputs = $form.find('.required').find(inputSelector), $errorMessage = $form.find('div.error'), valid = true; $errorMessage.addClass('hide'); $('.has-error').removeClass('has-error'); $inputs.each(function(i, el) { var $input = $(el); if ($input.val() === '') { $input.parent().addClass('has-error'); $errorMessage.removeClass('hide'); e.preventDefault(); } }); if (!$form.data('cc-on-file')) { e.preventDefault(); Stripe.setPublishableKey($form.data('stripe-publishable-key')); Stripe.createToken({ number: $('.card-number').val(), cvc: $('.card-cvc').val(), exp_month: $('.card-expiry-month').val(), exp_year: $('.card-expiry-year').val() }, stripeResponseHandler); } }); // // $(".btn_remove_cart").click(function(e) { e.preventDefault(); var href = $(this).attr("href"); 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: href }) .done(function(response) { var res = $.parseJSON(response); $(".process_loader").hide(); if (res.success == '1') { swal({ title: "Done!", text: res.msg, type: "success" }, function() { location.reload(); }); } else { $(".process_loader").hide(); swal("Something gone wrong!", res); } }) .fail(function(response) { $(".process_loader").hide(); swal("Something gone wrong!", res); }); } else { swal.close(); } }); }); // to close address form $(".close_form").click(function(e) { e.preventDefault(); $('form[name="address_form"]')[0].reset(); $(".add_addresss_block").hide(); }); // $(".btn_new_address").click(function(e) { e.preventDefault(); $(".ceckout-form").toggle(); $(".bank_form").toggle(); }); $(".address_type").click(function(){ var dc = parseFloat($(this).attr('data-id')); var total = parseFloat($(this).attr('data-id')) + parseFloat($('.total_after_coupon').attr('data-id')); $('.total_dc_amount').empty().text('<?php echo getusercurrency();?> '+dc); $('.total_payable_amt').empty().text('<?php echo getusercurrency();?> '+total); }); </script> <?php if($this->session->flashdata('response_msg')) { $message = $this->session->flashdata('response_msg'); ?> <script type="text/javascript"> var _msg="<?=$message['message']?>"; var _class='<?=$message['class']?>'; $('.notifyjs-corner').empty(); $.notify( _msg, { position:"top right",className: _class } ); </script> <?php } ?>