芝麻web文件管理V1.00
编辑当前文件:/home/krishnamexports/public_html/js/function - Copy.js
var baseUrl = "http://"+location.hostname+"/krishnam-exports/"; jQuery.fn.ForceNumericOnly = function() { return this.each(function() { $(this).keydown(function(e) { var key = e.charCode || e.keyCode || 0; // allow backspace, tab, delete, enter, arrows, numbers and keypad numbers ONLY // home, end, period, and numpad decimal return ( key == 8 || key == 9 || key == 13 || key == 46 || key == 110 || //key == 190 || (key >= 35 && key <= 40) || (key >= 48 && key <= 57) || (key >= 96 && key <= 105)); }); }); }; $(".regMobile").ForceNumericOnly(); $(".numberOnly").ForceNumericOnly(); $('.setCurrency').click(function(){ $.blockUI({ message: '
Please Wait...
' }); var currencyType = $(this).data('currency'); $.ajax({ url: baseUrl+"ajax/setCurrency.php?currencyType="+currencyType, type: 'GET', dataType: 'html', success: function (data) { var data = $.parseJSON(data); if(data.status==1) { setTimeout(function(){location.reload();}, 1000); } } }); }); $('#LoginCustomer').submit(function(e){ e.preventDefault(); var mobile = $("#logMobile").val(); if(mobile.length>9) { $.ajax({ url: baseUrl+"ajax/LoginCustomer.php", type: 'POST', data:$("#LoginCustomer").serialize(), dataType: 'html', success: function (data) { var data = $.parseJSON(data); if(data.status==1) { $("#ErrorReg2").html(data.SuccessMsg); setTimeout(function(){ location.reload(); }, 2000); } else if(data.status==2) { $("#ErrorReg2").html(data.ErrorMsg); $("#logMobile").attr("readonly","readonly"); $(".otpBox2").show(); $("#loginotp").val(data.otp); $("#loginotp").attr("required","required"); } else if(data.status==3) { $("#ErrorReg2").html(data.ErrorMsg); } } }); } else { alert("Enter Minimum 10 Digit."); } }); $('#RegisterCustomer').submit(function(e){ e.preventDefault(); var mobile = $("#regMobile").val(); if(mobile.length>9) { $.ajax({ url: baseUrl+"ajax/RegisterCustomer.php", type: 'POST', data:$("#RegisterCustomer").serialize(), dataType: 'html', success: function (data) { var data = $.parseJSON(data); if(data.status==1) { $("#ErrorReg").html(data.ErrorMsg); } else if(data.status==2) { $("#ErrorReg").html(''); $("#regMobile").attr("readonly","readonly"); $(".otpBox").show(); $("#signupotp").val(data.otp); $("#signupotp").attr("required","required"); } else if(data.status==3) { $("#ErrorReg").html(data.ErrorMsg); } else if(data.status==4) { $("#ErrorReg").html(data.SuccessMsg); setTimeout(function(){ window.location.href = baseUrl+"index.php"; }, 2000); } else if(data.status==5) { $("#ErrorReg").html(data.ErrorMsg); } } }); } else { alert("Enter Minimum 10 Digit."); } }); $('.setPolish').click(function(){ var polishId = $(this).val(); $("#polish_id").val(polishId); }); $('.setSize').change(function(){ var sizeId = $(this).val(); $("#size_id").val(sizeId); }); /*$('.setStone').change(function(){ var stoneId = $(this).val(); $("#stone_id").val(stoneId); });*/ $('.addtoCart').click(function(){ var productId = $(this).data('id'); var qty = $("#qty").val(); var polishId = $("#polish_id").val(); var sizeId = $("#size_id").val(); $(".addtoCart").html('
LOADING'); $(".addtoCart").attr('Disabled','Disabled'); $.blockUI({ message: '
Please Wait...
' }); $.ajax({ url: baseUrl+"ajax/addtoCart.php?productId="+productId+"&qty="+qty+"&polishId="+polishId+"&sizeId="+sizeId, type: 'GET', dataType: 'html', success: function (data) { var data = $.parseJSON(data); if(data.status==1 || data.status==2 || data.status==3 || data.status==4) { $(".addtoCart").html('ADD TO WISHLIST'); $(".addtoCart").removeAttr('Disabled'); $("#warning").html(data.msg); $.unblockUI(); warningNotification(); } else if(data.status==0) { $(".addtoCart").html('ADDED TO WISHLIST'); $(".addtoCart").removeAttr('Disabled'); $("#success").html(data.msg); $(".miniCart").html(''); $.each(data.productList, function(idx, obj) { $(".miniCart").append('
'+obj.productName+'
Qty - '+obj.qty+'
'); }); $(".productCount").html(data.productCount); $(".miniCartTotal").html(''); //$(".miniCartTotal").html('
Sub Total
'+data.subTotal+'
Delivery Charges
'+data.deliveryCharges+'
Total
'+data.orderTotal+'
'); $(".minicart-button").html('
View WishList
Checkout
'); $.unblockUI(); successNotification(); $.getScript( baseUrl+"js/function.js" ).done(function( script, textStatus ) { console.log( textStatus ); }); } } }); }); $('.addtoCartBulk').click(function(){ $(".addtoCartBulk").html('
LOADING'); $(".addtoCartBulk").attr('Disabled','Disabled'); $.blockUI({ message: '
Please Wait...
' }); $.ajax({ url: baseUrl+"ajax/addtoCartBulk.php", type: 'POST', data:$("#addBulkOrder").serialize(), dataType: 'html', cache: true, success: function (data) { var data = $.parseJSON(data); if(data.status==1 || data.status==2 || data.status==3 || data.status==5) { $(".addtoCartBulk").html('ADD TO WISHLIST'); $(".addtoCartBulk").removeAttr('Disabled'); $("#warning").html(data.msg); $.unblockUI(); warningNotification(); } else if(data.status==4) { $(".addtoCartBulk").html('ADDED TO WISHLIST'); $(".addtoCartBulk").removeAttr('Disabled'); $("#success").html(data.msg); $(".miniCart").html(''); $.each(data.productList, function(idx, obj) { $(".miniCart").append('
'+obj.productName+'
Qty - '+obj.qty+'
'); }); $(".productCount").html(data.productCount); $(".miniCartTotal").html(''); //$(".miniCartTotal").html('
Sub Total
'+data.subTotal+'
Delivery Charges
'+data.deliveryCharges+'
Total
'+data.orderTotal+'
'); $(".minicart-button").html('
View WishList
Checkout
'); $.unblockUI(); successNotification(); $.getScript( baseUrl+"js/function.js" ).done(function( script, textStatus ) { console.log( textStatus ); }); } else if(data.status==0) { $(".addtoCartBulk").html('ADDED TO CART'); $(".addtoCartBulk").removeAttr('Disabled'); $("#success").html(data.msg); $(".miniCart").html(''); $.each(data.productList, function(idx, obj) { $(".miniCart").append('
'+obj.productName+'
Qty - '+obj.qty+'
'); }); $(".productCount").html(data.productCount); $(".miniCartTotal").html(''); //$(".miniCartTotal").html('
Sub Total
'+data.subTotal+'
Delivery Charges
'+data.deliveryCharges+'
Total
'+data.orderTotal+'
'); $(".minicart-button").html('
View WishList
Checkout
'); $.unblockUI(); successNotification(); $.getScript( baseUrl+"js/function.js" ).done(function( script, textStatus ) { console.log( textStatus ); }); } } }); }); $('.removeToCart').click(function(){ var productId = $(this).attr("data-productId");//$(this).data('productId'); var polishId = $(this).attr("data-polishId");//$(this).data('polishId'); var sizeId = $(this).attr("data-sizeId");//$(this).data('sizeId'); $.blockUI({ message: '
Please Wait...
' }); $.ajax({ url: baseUrl+"ajax/removeToCart.php?productId="+productId+"&polishId="+polishId+"&sizeId="+sizeId, type: 'GET', dataType: 'html', success: function (data) { var data = $.parseJSON(data); if(data.status==1 || data.status==2 || data.status==3 || data.status==4) { $(".addtoCart").html('ADD TO WISHLIST'); $(".addtoCart").removeAttr('Disabled'); $("#warning").html(data.msg); $.unblockUI(); warningNotification(); } else if(data.status==0) { $("#success").html(data.msg); $(".miniCart").html(''); $.each(data.productList, function(idx, obj) { $(".miniCart").append('
'+obj.productName+'
Qty - '+obj.qty+'
'); }); $(".productCount").html(data.productCount); if(data.productList.length>0) { //$(".miniCartTotal").html('
Sub Total
'+data.subTotal+'
Delivery Charges
'+data.deliveryCharges+'
Total
'+data.orderTotal+'
'); $(".miniCartTotal").html(''); $(".minicart-button").html('
View Wishlist
Checkout
'); } else { $(".miniCart").append('
There is no Product in your cart
'); $(".miniCartTotal").html(''); $(".minicart-button").html('
Continue Shopping
'); } $.unblockUI(); successNotification(); $.getScript( baseUrl+"js/function.js" ).done(function( script, textStatus ) { console.log( textStatus ); }); } } }); }); $('.processCheckout').click(function(){ //e.preventDefault(); var adRemark = []; $("input[name='additionInfo[]']").each(function () { //alert($(this).val()); adRemark.push($(this).val()); }) var additionalInfo = adRemark.join("/"); $.blockUI({ message: '
Please Wait...
' }); $.ajax({ url: baseUrl+"ajax/checkLogin.php?additionalInfo="+additionalInfo, type: 'GET', dataType: 'html', success: function (data) { var data = $.parseJSON(data); if(data.status==1) { setTimeout(function(){ window.location.href = baseUrl+"checkout";}, 1000); } else if(data.status==2) { $.unblockUI(); $('#modalRegisterForm').modal('show'); } } }); }); $('#placeOrder').submit(function(e){ e.preventDefault(); $.blockUI({ message: '
Please Wait...
' }); $.ajax({ url: baseUrl+"ajax/placeOrder.php", type: 'POST', data:$("#placeOrder").serialize(), dataType: 'html', success: function (data){ var data = $.parseJSON(data); //alert(data.status); if(data.status==true) { setTimeout(function(){ window.location.href = baseUrl+"thank-you.php?orderId="+data.orderId;}, 2000); } else { setTimeout(function(){ window.location.href = baseUrl+"checkout";}, 2000); } } }); }); function warningNotification() { var x = document.getElementById("warning"); x.className = "show"; setTimeout(function(){ x.className = x.className.replace("show", ""); }, 4000); } function successNotification() { var x = document.getElementById("success"); x.className = "show"; setTimeout(function(){ x.className = x.className.replace("show", ""); }, 4000); }