1function loadAddresses(method_id, method_type) { 2 if ($('#'+method_type+'_address_'+method_id).length < 1) return false; 3 4 if (!$('.js-address-select[data-id="' + method_id + '"]').hasClass('is-loaded')) { 5 $.ajax({ 6 type: "GET", 7 dataType: "JSON", 8 url: UNAS.shop.base_url + "/shop_order_mods.php", 9 data: { 10 action: "check_method_addresses", 11 method_id: method_id, 12 method_type: method_type 13 }, 14 success: function (response) { 15 let options = ''; 16 let target_method_type = $('#target_method_type').val(); 17 let target_method_id = $('#target_method_id').val(); 18 let new_address_id = $('#new_address_id').val(); 19 let new_address_found = false; 20 21 $.each(response, function (key, option) { 22 let selected = option.selected; 23 if (method_type === target_method_type && method_id === target_method_id) { 24 selected = new_address_id === option.value; 25 if (new_address_id === option.value) new_address_found = true; 26 } 27 28 options += `<option value="${option.value}"` + (selected ? ' selected="selected"' : '') +`>${option.text}</option>`; 29 }); 30 31 $('.js-address-select[data-id="' + method_id + '"]').html(options).addClass('is-loaded'); 32 33 if (method_type === target_method_type && target_method_id === method_id && !new_address_found) { 34 overlay_load('warning',(method_type === 'billing' ? UNAS.text.change_address_error_on_billing_method : UNAS.text.change_address_error_on_shipping_method)); 35 } 36 } 37 }); 38 } 39} 40 41function actualizeAddresses() { 42 let selected_shipping_address_id = $('.js-address-select[data-type="shipping"]:visible').val(); 43 let selected_billing_address_id = $('.js-address-select[data-type="'+(unas_design_ver > 3 ? "billing" : "payment")+'"]:visible').val(); 44 45 if (selected_shipping_address_id !== undefined && selected_shipping_address_id !== '') { 46 $('#default_shipping_address_id').attr('value', selected_shipping_address_id); 47 } 48 49 if (selected_billing_address_id !== undefined && selected_billing_address_id !== '') { 50 $('#default_billing_address_id').attr('value', selected_billing_address_id); 51 } 52} 53 54function redirectToAddNewAddress (target_method_id, method_type) { 55 location.href = UNAS.shop.base_url + '/shop_customer_addresses_det.php?action=add_start&target_method_id=' + target_method_id + '&fiz_id=' + $("#fiz_id").val() + '&szall_id=' + $("#szall_id").val() + '&target_method_type=' + method_type; 56} 57 58$(document).on('changeShippingMethod', function (e, data) { 59 loadAddresses(data.id, 'shipping'); 60}); 61 62$(document).on('changePaymentMethod', function (e, data) { 63 loadAddresses(data.id, 'billing'); 64});
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.