Changeset 2984482
- Timestamp:
- 10/26/2023 02:33:24 PM (2 years ago)
- Location:
- eshipper-commerce
- Files:
-
- 2 deleted
- 5 edited
- 25 copied
-
tags/2.16.3 (copied) (copied from eshipper-commerce/trunk)
-
tags/2.16.3/.editorconfig (deleted)
-
tags/2.16.3/.gitignore (deleted)
-
tags/2.16.3/README.md (copied) (copied from eshipper-commerce/trunk/README.md)
-
tags/2.16.3/assets (copied) (copied from eshipper-commerce/trunk/assets)
-
tags/2.16.3/assets/eShipper.js (copied) (copied from eshipper-commerce/trunk/assets/eShipper.js)
-
tags/2.16.3/composer.json (copied) (copied from eshipper-commerce/trunk/composer.json)
-
tags/2.16.3/composer.lock (copied) (copied from eshipper-commerce/trunk/composer.lock)
-
tags/2.16.3/docs (copied) (copied from eshipper-commerce/trunk/docs)
-
tags/2.16.3/framework (copied) (copied from eshipper-commerce/trunk/framework)
-
tags/2.16.3/framework/lib/admin-settings.js (copied) (copied from eshipper-commerce/trunk/framework/lib/admin-settings.js) (24 diffs)
-
tags/2.16.3/framework/lib/plugin_health.css (copied) (copied from eshipper-commerce/trunk/framework/lib/plugin_health.css)
-
tags/2.16.3/framework/orderdetails.php (copied) (copied from eshipper-commerce/trunk/framework/orderdetails.php)
-
tags/2.16.3/framework/plugin.php (copied) (copied from eshipper-commerce/trunk/framework/plugin.php)
-
tags/2.16.3/framework/shipments.php (copied) (copied from eshipper-commerce/trunk/framework/shipments.php)
-
tags/2.16.3/framework/shippingmethod.php (copied) (copied from eshipper-commerce/trunk/framework/shippingmethod.php) (2 diffs)
-
tags/2.16.3/img (copied) (copied from eshipper-commerce/trunk/img)
-
tags/2.16.3/languages (copied) (copied from eshipper-commerce/trunk/languages)
-
tags/2.16.3/lib (copied) (copied from eshipper-commerce/trunk/lib)
-
tags/2.16.3/license.txt (copied) (copied from eshipper-commerce/trunk/license.txt)
-
tags/2.16.3/models (copied) (copied from eshipper-commerce/trunk/models)
-
tags/2.16.3/plugin (copied) (copied from eshipper-commerce/trunk/plugin)
-
tags/2.16.3/plugin/PluginHealthHelper.php (copied) (copied from eshipper-commerce/trunk/plugin/PluginHealthHelper.php) (1 diff)
-
tags/2.16.3/readme.txt (copied) (copied from eshipper-commerce/trunk/readme.txt) (3 diffs)
-
tags/2.16.3/views (copied) (copied from eshipper-commerce/trunk/views)
-
tags/2.16.3/views/login_modal.php (copied) (copied from eshipper-commerce/trunk/views/login_modal.php)
-
tags/2.16.3/woocommerce-eshipper.php (copied) (copied from eshipper-commerce/trunk/woocommerce-eshipper.php) (4 diffs)
-
trunk/framework/lib/admin-settings.js (modified) (24 diffs)
-
trunk/framework/shippingmethod.php (modified) (2 diffs)
-
trunk/plugin/PluginHealthHelper.php (modified) (1 diff)
-
trunk/readme.txt (modified) (3 diffs)
-
trunk/woocommerce-eshipper.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
eshipper-commerce/tags/2.16.3/framework/lib/admin-settings.js
r2966127 r2984482 565 565 566 566 // Clear country and state fields 567 jQuery('#es-sc-address-country').val('');567 // jQuery('#es-sc-address-country').val(''); 568 568 jQuery('#es-sc-address-state').val('').attr('disabled', true); 569 569 570 // State/country fields handling - show state when country is selected571 registerCountryStateHandler('es-sc-address-country', 'es-sc-address-state' )570 // For SC: State/country fields handling - show state when country is selected 571 registerCountryStateHandler('es-sc-address-country', 'es-sc-address-state', true); 572 572 573 573 // Initialize select2 on first product row … … 605 605 } 606 606 }).on('select2:select select2:unselect', function (e) { 607 console.log('event');608 console.log(e);609 607 let data = e.params.data; 610 608 let qtyElement = jQuery(this).parents('tr').find('.es-sc-quantity'); … … 653 651 // Get the value of quantity 654 652 let qty = jQuery(this).val(); 655 console.log('qty value changed - ' + qty);656 653 657 654 // If quantity was set to empty, remove rate & price values … … 661 658 // Now proceed to update product price if rate is not empty (fail-safe check) 662 659 let rate = rateElement.text() ?? rateElement.data('value'); 663 console.log('Rate ' + rate);664 660 if (rate !== '') { 665 661 es_sc_update_html_and_data(es_sc_format_amount(rate * qty), priceElement) … … 674 670 jQuery('#es-sc-add-product-btn').on('click', function (e) { 675 671 e.preventDefault(); 676 console.log('Adding new product row');677 672 // Create a unique id for the new product row 678 673 let itemId = 'es-sc-product-row-' + Date.now(); … … 761 756 // Now that all fields are filled, proceed with form submission 762 757 address[name] = value; 763 // The above expression will evaluate, for instance, as: address['city'] = 'Ontario' 758 // The above expression will evaluate, for instance as: address['city'] = 'Ontario' 759 } 760 761 // Handle missing value of country in case when country is visible as plain text instead of input, 762 // This happens only when Selling Location is set to one specific country in WooCommerce settings 763 if (!address['es-sc-address-country']) { 764 address['es-sc-address-country'] = jQuery('#es-sc-address-country').val(); 764 765 } 765 766 … … 775 776 }; 776 777 777 console.log(' shipping calculator formdata:');778 console.log('Shipping Calculator request - '); 778 779 console.log(formData); 779 780 … … 896 897 897 898 if (_parent.prop('checked')) { 898 console.log('es_Checkbox-parent checked');899 899 nextli.each(function () { 900 900 jQuery(this).children().prop('checked', true); … … 902 902 903 903 } else { 904 console.log('es_Checkbox-parent un checked');905 904 nextli.each(function () { 906 905 jQuery(this).children().prop('checked', false); … … 911 910 912 911 jQuery('.es_Checkbox-child input').on('click', function (e) { 913 console.log('Child Input');914 console.log(jQuery(this));915 console.log(jQuery(this).attr('id'));916 912 var ths = jQuery(this); 917 913 var parentinput = ths.closest('div').prev().children(); … … 954 950 */ 955 951 956 // State/country fields handling - show state when country is selected952 // For Address Settings: State/country fields handling - show state when country is selected 957 953 registerCountryStateHandler('es-settings-address-country', 'es-settings-address-state') 958 954 … … 968 964 success: function (response) { 969 965 if (response.data != null) { 970 console.log(' Showing Shipping Address');966 console.log('Address: Showing Shipping Address'); 971 967 console.log(response); 972 968 … … 991 987 jQuery("#es-settings-address-country").val(country); 992 988 993 console.log(' Country received - ' + country);989 console.log('Address: Country received - ' + country); 994 990 // Get States of the country received in response and add them to the available options in state dropdown 995 991 jQuery.ajax({ … … 1002 998 }, 1003 999 success: function (response) { 1004 console.log(' Populating state options');1000 console.log('Address: Populating state options'); 1005 1001 console.log(response); 1006 1002 // Add all options received in response … … 1009 1005 }); 1010 1006 1011 console.log(' Setting value of state - ' + state);1007 console.log('Address: Setting value of state - ' + state); 1012 1008 // Set the value of state as received in response & show it selected 1013 1009 jQuery("#es-settings-address-state").val(state); … … 1100 1096 } 1101 1097 1102 console.log('store address form data');1103 console.log(shipping_address_data);1098 // console.log('Request to update address'); 1099 // console.log(shipping_address_data); 1104 1100 1105 1101 jQuery.ajax({ … … 1112 1108 }, 1113 1109 success: function (response) { 1114 console.log('Save Shipping address response');1115 console.log(response);1110 // console.log('Save Shipping address response'); 1111 // console.log(response); 1116 1112 1117 1113 // Show message … … 1126 1122 }, 1127 1123 error: function (response) { 1128 console.log('Shipping address Save ERROR');1129 console.log(response);1124 // console.log('Shipping address Save ERROR'); 1125 // console.log(response); 1130 1126 1131 1127 // Show message … … 1202 1198 } 1203 1199 1204 console.log('Margin Settings form data');1205 console.log(formData);1200 // console.log('Margin Settings form data'); 1201 // console.log(formData); 1206 1202 1207 1203 jQuery.ajax({ … … 1214 1210 }, 1215 1211 success: function (response) { 1216 console.log('Margin save response');1217 console.log(response);1212 // console.log('Margin save response'); 1213 // console.log(response); 1218 1214 1219 1215 messageElement.text(response.msg) … … 1231 1227 }, 1232 1228 error: function (response) { 1233 console.log('Margin save ERROR');1234 console.log(response);1229 // console.log('Margin save ERROR'); 1230 // console.log(response); 1235 1231 1236 1232 // Show message … … 1250 1246 }); 1251 1247 1252 function registerCountryStateHandler(countryElementId, stateElementId) { 1253 1248 function registerCountryStateHandler(countryElementId, stateElementId, sc = false) { 1249 1250 let logPrefix = sc ? 'SC: ' : 'AD: '; 1254 1251 let countryElement = jQuery('#' + countryElementId); 1255 1252 let stateElement = jQuery('#' + stateElementId); 1253 let loader = jQuery('#' + stateElementId + '-loader'); 1254 1255 // NOTE: Specific case for country/state dropdown in Shipping Calculator - 1256 // If the country has a fixed value at this point (on page load), 1257 // it means that there is only one country enabled in 'Selling Locations' under WooCommerce settings (because we're using woocommerce_form_field) 1258 // hence the dropdown automatically selects the only country it gets in response from woocommerce 1259 // and renders the country field as text and not selectable. 1260 // If this is the case, then we need to populate the state field accordingly 1261 // in addition to and before watching for - a change event on the country field 1262 let defaultCountry = countryElement.val(); 1263 1264 if (defaultCountry !== '' && sc === true) { 1265 eShipperConsoleLog(logPrefix, 'Default Country - ' + defaultCountry); 1266 1267 // Show the loader 1268 loader.removeClass('es-d-none'); 1269 1270 populateStateDropdown(defaultCountry, stateElementId, countryElementId, loader, true); 1271 } 1256 1272 1257 1273 countryElement.on('change', function (e) { 1274 let countryValue = jQuery(this).val(); 1275 1276 eShipperConsoleLog(logPrefix, 'Country selected - ' + countryValue) 1258 1277 1259 1278 // Disable both Country & State fields until results are obtained from ajax … … 1262 1281 1263 1282 // Show the loader 1264 let loader = jQuery('#' + stateElementId + '-loader');1265 1283 loader.removeClass('es-d-none') 1266 1284 1267 1285 // Remove all previous options 1268 1286 jQuery('#' + stateElementId + ' > .' + stateElementId + '-option').remove(); 1269 1270 let countryValue = jQuery(this).val();1271 1287 1272 1288 if (countryValue === '') { … … 1277 1293 } 1278 1294 1279 jQuery.ajax({ 1280 type: "post", 1281 dataType: "json", 1282 url: ajaxurl, 1283 data: { 1284 action: "es_select_country_states", 1285 formdata: {'country_code': countryValue} 1286 }, 1287 success: function (response) { 1288 // Add all options received in response 1289 jQuery(response.data).each(function (index, state) { 1290 stateElement.append(`<option value="${state.code}" class="` + stateElementId + `-option">${state.name}</option>`); 1291 }); 1292 1293 // Hide the loader 1294 loader.addClass('es-d-none'); 1295 // Enable Country field 1296 countryElement.attr('disabled', false); 1297 // Enable State field 1298 stateElement.attr('disabled', false); 1299 } 1300 }); 1301 }); 1295 populateStateDropdown(countryValue, stateElementId, countryElementId, loader, sc); 1296 }); 1297 } 1298 1299 function populateStateDropdown(countryCode, stateElementId, countryElementId, loader, sc = false) { 1300 let logPrefix = sc ? 'SC: ' : 'AD: '; 1301 let countryElement = jQuery('#' + countryElementId); 1302 let stateElement = jQuery('#' + stateElementId); 1303 1304 eShipperConsoleLog(logPrefix, 'Fetching states for country - ' + countryCode); 1305 console.log(stateElement); 1306 1307 jQuery.ajax({ 1308 type: "post", 1309 dataType: "json", 1310 url: ajaxurl, 1311 data: { 1312 action: "es_select_country_states", 1313 formdata: {'country_code': countryCode} 1314 }, 1315 success: function (response) { 1316 eShipperConsoleLog(logPrefix, 'States response received - '); 1317 console.log(response); 1318 // Add all options received in response 1319 jQuery(response.data).each(function (index, state) { 1320 stateElement.append(`<option value="${state.code}" class="` + stateElementId + `-option">${state.name}</option>`); 1321 }); 1322 1323 eShipperConsoleLog(logPrefix, 'Cleanup'); 1324 // Hide the loader 1325 loader.addClass('es-d-none'); 1326 // Enable Country field 1327 countryElement.attr('disabled', false); 1328 // Enable State field 1329 stateElement.attr('disabled', false); 1330 } 1331 }); 1332 } 1333 1334 function eShipperConsoleLog(prefix = '', message) { 1335 console.log(prefix + message); 1302 1336 } 1303 1337 -
eshipper-commerce/tags/2.16.3/framework/shippingmethod.php
r2966127 r2984482 788 788 Calculate Shipping and check live rates from eShipper 789 789 </h3> 790 <p>This page helps you (the site-admin) check live shipping rates for a set of products and shipping address without having791 to go through the checkout process.</p>790 <p>This page helps you (the site-admin) check live shipping rates for a set of products and shipping address without 791 having to go through the checkout process.</p> 792 792 <p>If you are able to see shipping rates on this page after clicking 'Calculate Shipping', this implies that your store is 793 793 able to receive live rates from eShipper.</p> … … 984 984 </tr> 985 985 </tbody> 986 <tfoot> 987 <tr> 988 <td colspan="2"> 989 <p class="es-text-small"> 990 Note: Only those countries are available which are allowed in 'Selling Locations' in WooCommerce 991 Settings. 992 </p> 993 </td> 994 </tr> 995 </tfoot> 986 996 </table> 987 997 </div> -
eshipper-commerce/tags/2.16.3/plugin/PluginHealthHelper.php
r2966127 r2984482 63 63 } 64 64 65 $create_plugin_health_table = " CREATE TABLE $table( 66 $columns 65 $create_plugin_health_table = " CREATE TABLE $table($columns 67 66 created_time timestamp DEFAULT CURRENT_TIMESTAMP, 68 67 updated_time timestamp DEFAULT NULL -
eshipper-commerce/tags/2.16.3/readme.txt
r2977583 r2984482 5 5 Tested up to: 6.3.1 6 6 Requires PHP: 7.1 7 Stable tag: 2.16. 27 Stable tag: 2.16.3 8 8 License: GPLv3 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 54 54 55 55 == Changelog == 56 = 2.16.3 = 57 * Bug fix for Shipping Calculator - not able to select states when selling is allowed to one specific country in WooCommerce Settings. 58 56 59 = 2.16.2 = 57 60 * Support for WordPress version 6.3.1 … … 96 99 97 100 == Upgrade Notice == 101 = 2.16.3 = 102 Bug fixes for Shipping Calculator. 103 98 104 = 2.16.2 = 99 105 Support for WordPress version 6.3.1 -
eshipper-commerce/tags/2.16.3/woocommerce-eshipper.php
r2977583 r2984482 4 4 Plugin URI: https://ww2.eshipper.com/ecommerce/ 5 5 Description: Extends WooCommerce with Shipping Rates from eShipper 6 Version: 2.16. 26 Version: 2.16.3 7 7 Author: eShipper 8 8 Author URI: https://ww2.eshipper.com/ … … 28 28 get_site_option('active_sitewide_plugins') 29 29 ))) { 30 define('ESHIPPER_VERSION', '2.16. 2');31 define('ESHIPPER_VERSION_LATEST', '2.16. 2');30 define('ESHIPPER_VERSION', '2.16.3'); 31 define('ESHIPPER_VERSION_LATEST', '2.16.3'); 32 32 define('ESHIPPER_VERSION_DB_UPDATE', '2.15.3'); 33 33 //Plugin Path … … 519 519 function es_select_country_states() 520 520 { 521 wc_get_logger()->debug('SC: Request received for States', ['source' => 'eshipper']); 522 521 523 $data = []; 522 524 523 525 // If no data in post request, return error 524 526 if (isset($_POST['formdata']) && isset($_POST['formdata']['country_code'])) { 525 $states = (new WC_Countries())->get_states($_POST['formdata']['country_code']); 527 $country = $_POST['formdata']['country_code']; 528 wc_get_logger()->debug('SC: Fetching states for country - ' . $country, ['source' => 'eshipper']); 529 530 $states = (new WC_Countries())->get_states($country); 526 531 527 532 if (!empty($states)) { … … 535 540 } 536 541 537 $response = [542 $response = json_encode([ 538 543 'data' => $data, 539 ]; 540 541 echo json_encode($response); 544 ]); 545 546 wc_get_logger()->debug('SC: Response sent for States - ' . $response, ['source' => 'eshipper']); 547 548 echo $response; 542 549 die(); 543 550 } -
eshipper-commerce/trunk/framework/lib/admin-settings.js
r2966127 r2984482 565 565 566 566 // Clear country and state fields 567 jQuery('#es-sc-address-country').val('');567 // jQuery('#es-sc-address-country').val(''); 568 568 jQuery('#es-sc-address-state').val('').attr('disabled', true); 569 569 570 // State/country fields handling - show state when country is selected571 registerCountryStateHandler('es-sc-address-country', 'es-sc-address-state' )570 // For SC: State/country fields handling - show state when country is selected 571 registerCountryStateHandler('es-sc-address-country', 'es-sc-address-state', true); 572 572 573 573 // Initialize select2 on first product row … … 605 605 } 606 606 }).on('select2:select select2:unselect', function (e) { 607 console.log('event');608 console.log(e);609 607 let data = e.params.data; 610 608 let qtyElement = jQuery(this).parents('tr').find('.es-sc-quantity'); … … 653 651 // Get the value of quantity 654 652 let qty = jQuery(this).val(); 655 console.log('qty value changed - ' + qty);656 653 657 654 // If quantity was set to empty, remove rate & price values … … 661 658 // Now proceed to update product price if rate is not empty (fail-safe check) 662 659 let rate = rateElement.text() ?? rateElement.data('value'); 663 console.log('Rate ' + rate);664 660 if (rate !== '') { 665 661 es_sc_update_html_and_data(es_sc_format_amount(rate * qty), priceElement) … … 674 670 jQuery('#es-sc-add-product-btn').on('click', function (e) { 675 671 e.preventDefault(); 676 console.log('Adding new product row');677 672 // Create a unique id for the new product row 678 673 let itemId = 'es-sc-product-row-' + Date.now(); … … 761 756 // Now that all fields are filled, proceed with form submission 762 757 address[name] = value; 763 // The above expression will evaluate, for instance, as: address['city'] = 'Ontario' 758 // The above expression will evaluate, for instance as: address['city'] = 'Ontario' 759 } 760 761 // Handle missing value of country in case when country is visible as plain text instead of input, 762 // This happens only when Selling Location is set to one specific country in WooCommerce settings 763 if (!address['es-sc-address-country']) { 764 address['es-sc-address-country'] = jQuery('#es-sc-address-country').val(); 764 765 } 765 766 … … 775 776 }; 776 777 777 console.log(' shipping calculator formdata:');778 console.log('Shipping Calculator request - '); 778 779 console.log(formData); 779 780 … … 896 897 897 898 if (_parent.prop('checked')) { 898 console.log('es_Checkbox-parent checked');899 899 nextli.each(function () { 900 900 jQuery(this).children().prop('checked', true); … … 902 902 903 903 } else { 904 console.log('es_Checkbox-parent un checked');905 904 nextli.each(function () { 906 905 jQuery(this).children().prop('checked', false); … … 911 910 912 911 jQuery('.es_Checkbox-child input').on('click', function (e) { 913 console.log('Child Input');914 console.log(jQuery(this));915 console.log(jQuery(this).attr('id'));916 912 var ths = jQuery(this); 917 913 var parentinput = ths.closest('div').prev().children(); … … 954 950 */ 955 951 956 // State/country fields handling - show state when country is selected952 // For Address Settings: State/country fields handling - show state when country is selected 957 953 registerCountryStateHandler('es-settings-address-country', 'es-settings-address-state') 958 954 … … 968 964 success: function (response) { 969 965 if (response.data != null) { 970 console.log(' Showing Shipping Address');966 console.log('Address: Showing Shipping Address'); 971 967 console.log(response); 972 968 … … 991 987 jQuery("#es-settings-address-country").val(country); 992 988 993 console.log(' Country received - ' + country);989 console.log('Address: Country received - ' + country); 994 990 // Get States of the country received in response and add them to the available options in state dropdown 995 991 jQuery.ajax({ … … 1002 998 }, 1003 999 success: function (response) { 1004 console.log(' Populating state options');1000 console.log('Address: Populating state options'); 1005 1001 console.log(response); 1006 1002 // Add all options received in response … … 1009 1005 }); 1010 1006 1011 console.log(' Setting value of state - ' + state);1007 console.log('Address: Setting value of state - ' + state); 1012 1008 // Set the value of state as received in response & show it selected 1013 1009 jQuery("#es-settings-address-state").val(state); … … 1100 1096 } 1101 1097 1102 console.log('store address form data');1103 console.log(shipping_address_data);1098 // console.log('Request to update address'); 1099 // console.log(shipping_address_data); 1104 1100 1105 1101 jQuery.ajax({ … … 1112 1108 }, 1113 1109 success: function (response) { 1114 console.log('Save Shipping address response');1115 console.log(response);1110 // console.log('Save Shipping address response'); 1111 // console.log(response); 1116 1112 1117 1113 // Show message … … 1126 1122 }, 1127 1123 error: function (response) { 1128 console.log('Shipping address Save ERROR');1129 console.log(response);1124 // console.log('Shipping address Save ERROR'); 1125 // console.log(response); 1130 1126 1131 1127 // Show message … … 1202 1198 } 1203 1199 1204 console.log('Margin Settings form data');1205 console.log(formData);1200 // console.log('Margin Settings form data'); 1201 // console.log(formData); 1206 1202 1207 1203 jQuery.ajax({ … … 1214 1210 }, 1215 1211 success: function (response) { 1216 console.log('Margin save response');1217 console.log(response);1212 // console.log('Margin save response'); 1213 // console.log(response); 1218 1214 1219 1215 messageElement.text(response.msg) … … 1231 1227 }, 1232 1228 error: function (response) { 1233 console.log('Margin save ERROR');1234 console.log(response);1229 // console.log('Margin save ERROR'); 1230 // console.log(response); 1235 1231 1236 1232 // Show message … … 1250 1246 }); 1251 1247 1252 function registerCountryStateHandler(countryElementId, stateElementId) { 1253 1248 function registerCountryStateHandler(countryElementId, stateElementId, sc = false) { 1249 1250 let logPrefix = sc ? 'SC: ' : 'AD: '; 1254 1251 let countryElement = jQuery('#' + countryElementId); 1255 1252 let stateElement = jQuery('#' + stateElementId); 1253 let loader = jQuery('#' + stateElementId + '-loader'); 1254 1255 // NOTE: Specific case for country/state dropdown in Shipping Calculator - 1256 // If the country has a fixed value at this point (on page load), 1257 // it means that there is only one country enabled in 'Selling Locations' under WooCommerce settings (because we're using woocommerce_form_field) 1258 // hence the dropdown automatically selects the only country it gets in response from woocommerce 1259 // and renders the country field as text and not selectable. 1260 // If this is the case, then we need to populate the state field accordingly 1261 // in addition to and before watching for - a change event on the country field 1262 let defaultCountry = countryElement.val(); 1263 1264 if (defaultCountry !== '' && sc === true) { 1265 eShipperConsoleLog(logPrefix, 'Default Country - ' + defaultCountry); 1266 1267 // Show the loader 1268 loader.removeClass('es-d-none'); 1269 1270 populateStateDropdown(defaultCountry, stateElementId, countryElementId, loader, true); 1271 } 1256 1272 1257 1273 countryElement.on('change', function (e) { 1274 let countryValue = jQuery(this).val(); 1275 1276 eShipperConsoleLog(logPrefix, 'Country selected - ' + countryValue) 1258 1277 1259 1278 // Disable both Country & State fields until results are obtained from ajax … … 1262 1281 1263 1282 // Show the loader 1264 let loader = jQuery('#' + stateElementId + '-loader');1265 1283 loader.removeClass('es-d-none') 1266 1284 1267 1285 // Remove all previous options 1268 1286 jQuery('#' + stateElementId + ' > .' + stateElementId + '-option').remove(); 1269 1270 let countryValue = jQuery(this).val();1271 1287 1272 1288 if (countryValue === '') { … … 1277 1293 } 1278 1294 1279 jQuery.ajax({ 1280 type: "post", 1281 dataType: "json", 1282 url: ajaxurl, 1283 data: { 1284 action: "es_select_country_states", 1285 formdata: {'country_code': countryValue} 1286 }, 1287 success: function (response) { 1288 // Add all options received in response 1289 jQuery(response.data).each(function (index, state) { 1290 stateElement.append(`<option value="${state.code}" class="` + stateElementId + `-option">${state.name}</option>`); 1291 }); 1292 1293 // Hide the loader 1294 loader.addClass('es-d-none'); 1295 // Enable Country field 1296 countryElement.attr('disabled', false); 1297 // Enable State field 1298 stateElement.attr('disabled', false); 1299 } 1300 }); 1301 }); 1295 populateStateDropdown(countryValue, stateElementId, countryElementId, loader, sc); 1296 }); 1297 } 1298 1299 function populateStateDropdown(countryCode, stateElementId, countryElementId, loader, sc = false) { 1300 let logPrefix = sc ? 'SC: ' : 'AD: '; 1301 let countryElement = jQuery('#' + countryElementId); 1302 let stateElement = jQuery('#' + stateElementId); 1303 1304 eShipperConsoleLog(logPrefix, 'Fetching states for country - ' + countryCode); 1305 console.log(stateElement); 1306 1307 jQuery.ajax({ 1308 type: "post", 1309 dataType: "json", 1310 url: ajaxurl, 1311 data: { 1312 action: "es_select_country_states", 1313 formdata: {'country_code': countryCode} 1314 }, 1315 success: function (response) { 1316 eShipperConsoleLog(logPrefix, 'States response received - '); 1317 console.log(response); 1318 // Add all options received in response 1319 jQuery(response.data).each(function (index, state) { 1320 stateElement.append(`<option value="${state.code}" class="` + stateElementId + `-option">${state.name}</option>`); 1321 }); 1322 1323 eShipperConsoleLog(logPrefix, 'Cleanup'); 1324 // Hide the loader 1325 loader.addClass('es-d-none'); 1326 // Enable Country field 1327 countryElement.attr('disabled', false); 1328 // Enable State field 1329 stateElement.attr('disabled', false); 1330 } 1331 }); 1332 } 1333 1334 function eShipperConsoleLog(prefix = '', message) { 1335 console.log(prefix + message); 1302 1336 } 1303 1337 -
eshipper-commerce/trunk/framework/shippingmethod.php
r2966127 r2984482 788 788 Calculate Shipping and check live rates from eShipper 789 789 </h3> 790 <p>This page helps you (the site-admin) check live shipping rates for a set of products and shipping address without having791 to go through the checkout process.</p>790 <p>This page helps you (the site-admin) check live shipping rates for a set of products and shipping address without 791 having to go through the checkout process.</p> 792 792 <p>If you are able to see shipping rates on this page after clicking 'Calculate Shipping', this implies that your store is 793 793 able to receive live rates from eShipper.</p> … … 984 984 </tr> 985 985 </tbody> 986 <tfoot> 987 <tr> 988 <td colspan="2"> 989 <p class="es-text-small"> 990 Note: Only those countries are available which are allowed in 'Selling Locations' in WooCommerce 991 Settings. 992 </p> 993 </td> 994 </tr> 995 </tfoot> 986 996 </table> 987 997 </div> -
eshipper-commerce/trunk/plugin/PluginHealthHelper.php
r2966127 r2984482 63 63 } 64 64 65 $create_plugin_health_table = " CREATE TABLE $table( 66 $columns 65 $create_plugin_health_table = " CREATE TABLE $table($columns 67 66 created_time timestamp DEFAULT CURRENT_TIMESTAMP, 68 67 updated_time timestamp DEFAULT NULL -
eshipper-commerce/trunk/readme.txt
r2977583 r2984482 5 5 Tested up to: 6.3.1 6 6 Requires PHP: 7.1 7 Stable tag: 2.16. 27 Stable tag: 2.16.3 8 8 License: GPLv3 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 54 54 55 55 == Changelog == 56 = 2.16.3 = 57 * Bug fix for Shipping Calculator - not able to select states when selling is allowed to one specific country in WooCommerce Settings. 58 56 59 = 2.16.2 = 57 60 * Support for WordPress version 6.3.1 … … 96 99 97 100 == Upgrade Notice == 101 = 2.16.3 = 102 Bug fixes for Shipping Calculator. 103 98 104 = 2.16.2 = 99 105 Support for WordPress version 6.3.1 -
eshipper-commerce/trunk/woocommerce-eshipper.php
r2977583 r2984482 4 4 Plugin URI: https://ww2.eshipper.com/ecommerce/ 5 5 Description: Extends WooCommerce with Shipping Rates from eShipper 6 Version: 2.16. 26 Version: 2.16.3 7 7 Author: eShipper 8 8 Author URI: https://ww2.eshipper.com/ … … 28 28 get_site_option('active_sitewide_plugins') 29 29 ))) { 30 define('ESHIPPER_VERSION', '2.16. 2');31 define('ESHIPPER_VERSION_LATEST', '2.16. 2');30 define('ESHIPPER_VERSION', '2.16.3'); 31 define('ESHIPPER_VERSION_LATEST', '2.16.3'); 32 32 define('ESHIPPER_VERSION_DB_UPDATE', '2.15.3'); 33 33 //Plugin Path … … 519 519 function es_select_country_states() 520 520 { 521 wc_get_logger()->debug('SC: Request received for States', ['source' => 'eshipper']); 522 521 523 $data = []; 522 524 523 525 // If no data in post request, return error 524 526 if (isset($_POST['formdata']) && isset($_POST['formdata']['country_code'])) { 525 $states = (new WC_Countries())->get_states($_POST['formdata']['country_code']); 527 $country = $_POST['formdata']['country_code']; 528 wc_get_logger()->debug('SC: Fetching states for country - ' . $country, ['source' => 'eshipper']); 529 530 $states = (new WC_Countries())->get_states($country); 526 531 527 532 if (!empty($states)) { … … 535 540 } 536 541 537 $response = [542 $response = json_encode([ 538 543 'data' => $data, 539 ]; 540 541 echo json_encode($response); 544 ]); 545 546 wc_get_logger()->debug('SC: Response sent for States - ' . $response, ['source' => 'eshipper']); 547 548 echo $response; 542 549 die(); 543 550 }
Note: See TracChangeset
for help on using the changeset viewer.