1jQuery(document).ready(function($){ 2 $(".test-button").click(function(e){ 3 e.preventDefault(); // Prevent the click from going to the link 4 if( 1 == SO_TEST_AJAX.refund_policy_enabled ) 5 jQuery('#policyerror').html(''); 6 if (jQuery("#accept_policy").prop('checked') == false) { 7 jQuery('#policyerror').html('Please accept the terms.'); 8 return false; 9 } 10 var data_format = $(this).attr('data-format'); 11 12 if( 1 == SO_TEST_AJAX.bulk_purchase_enabled ){ 13 var id = $(this).attr('data-id'), 14 quantity = $(".half.quantity input[name='quantity']").val(), 15 licensetype = $("#licensetype option:checked").val(); 16 var data = { 17 'action': 'woo_add_to_cart', 18 'data-id': id, 19 'quantity': quantity, 20 'licensetype' : licensetype 21 }; 22 }else{ 23 var id = $(this).attr('data-id'); 24 25 var data = { 26 'action': 'woo_add_to_cart', 27 'data-id': id 28 }; 29 30 } 31 $.ajax({ 32 url: SO_TEST_AJAX.ajax_url, 33 method: 'post', 34 data: data, 35 }).done( function (response) { 36 if( response.error != 'undefined' && response.error ){ 37 /*jQuery('.no_border_bg a').after('<p class="error-custom">You can not add same product in cart</p>'); */ 38 39 jQuery('.multiple-product-error').text('You can not add same product in cart'); 40 //some kind of error processing or just redirect to link 41 // might be a good idea to link to the single product page in case JS is disabled 42 return true; 43 } else { 44 if(data_format=="reload"){ 45 window.location.reload(true) 46 } 47 else{ 48 window.location.href = SO_TEST_AJAX.checkout_url; 49 } 50 51 52 } 53 }); 54 55 }); 56 57 if( "bulk" == $("select#licensetype").val() ){ 58 $(".half.quantity").show(); 59 }else{ 60 $(".half.quantity").hide(); 61 } 62 63 $(document).on("change", "select#licensetype", function(e){ 64 console.log($(this).val()); 65 if( "bulk" == $(this).val() ){ 66 $(".half.quantity").show(); 67 }else{ 68 $(".half.quantity").hide(); 69 } 70 }); 71 72});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.