Plugin Directory

Changeset 2984482


Ignore:
Timestamp:
10/26/2023 02:33:24 PM (2 years ago)
Author:
eshipper
Message:

v2.16.3

Location:
eshipper-commerce
Files:
2 deleted
5 edited
25 copied

Legend:

Unmodified
Added
Removed
  • eshipper-commerce/tags/2.16.3/framework/lib/admin-settings.js

    r2966127 r2984482  
    565565
    566566    // Clear country and state fields
    567     jQuery('#es-sc-address-country').val('');
     567    // jQuery('#es-sc-address-country').val('');
    568568    jQuery('#es-sc-address-state').val('').attr('disabled', true);
    569569
    570     // State/country fields handling - show state when country is selected
    571     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);
    572572
    573573    // Initialize select2 on first product row
     
    605605            }
    606606        }).on('select2:select select2:unselect', function (e) {
    607             console.log('event');
    608             console.log(e);
    609607            let data = e.params.data;
    610608            let qtyElement = jQuery(this).parents('tr').find('.es-sc-quantity');
     
    653651            // Get the value of quantity
    654652            let qty = jQuery(this).val();
    655             console.log('qty value changed - ' + qty);
    656653
    657654            // If quantity was set to empty, remove rate & price values
     
    661658                // Now proceed to update product price if rate is not empty (fail-safe check)
    662659                let rate = rateElement.text() ?? rateElement.data('value');
    663                 console.log('Rate ' + rate);
    664660                if (rate !== '') {
    665661                    es_sc_update_html_and_data(es_sc_format_amount(rate * qty), priceElement)
     
    674670    jQuery('#es-sc-add-product-btn').on('click', function (e) {
    675671        e.preventDefault();
    676         console.log('Adding new product row');
    677672        // Create a unique id for the new product row
    678673        let itemId = 'es-sc-product-row-' + Date.now();
     
    761756            // Now that all fields are filled, proceed with form submission
    762757            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();
    764765        }
    765766
     
    775776        };
    776777
    777         console.log('shipping calculator formdata: ');
     778        console.log('Shipping Calculator request - ');
    778779        console.log(formData);
    779780
     
    896897
    897898        if (_parent.prop('checked')) {
    898             console.log('es_Checkbox-parent checked');
    899899            nextli.each(function () {
    900900                jQuery(this).children().prop('checked', true);
     
    902902
    903903        } else {
    904             console.log('es_Checkbox-parent un checked');
    905904            nextli.each(function () {
    906905                jQuery(this).children().prop('checked', false);
     
    911910
    912911    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'));
    916912        var ths = jQuery(this);
    917913        var parentinput = ths.closest('div').prev().children();
     
    954950     */
    955951
    956     // State/country fields handling - show state when country is selected
     952    // For Address Settings: State/country fields handling - show state when country is selected
    957953    registerCountryStateHandler('es-settings-address-country', 'es-settings-address-state')
    958954
     
    968964        success: function (response) {
    969965            if (response.data != null) {
    970                 console.log('Showing Shipping Address');
     966                console.log('Address: Showing Shipping Address');
    971967                console.log(response);
    972968
     
    991987                jQuery("#es-settings-address-country").val(country);
    992988
    993                 console.log('Country received - ' + country);
     989                console.log('Address: Country received - ' + country);
    994990                // Get States of the country received in response and add them to the available options in state dropdown
    995991                jQuery.ajax({
     
    1002998                    },
    1003999                    success: function (response) {
    1004                         console.log('Populating state options');
     1000                        console.log('Address: Populating state options');
    10051001                        console.log(response);
    10061002                        // Add all options received in response
     
    10091005                        });
    10101006
    1011                         console.log('Setting value of state - ' + state);
     1007                        console.log('Address: Setting value of state - ' + state);
    10121008                        // Set the value of state as received in response & show it selected
    10131009                        jQuery("#es-settings-address-state").val(state);
     
    11001096        }
    11011097
    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);
    11041100
    11051101        jQuery.ajax({
     
    11121108            },
    11131109            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);
    11161112
    11171113                // Show message
     
    11261122            },
    11271123            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);
    11301126
    11311127                // Show message
     
    12021198        }
    12031199
    1204         console.log('Margin Settings form data');
    1205         console.log(formData);
     1200        // console.log('Margin Settings form data');
     1201        // console.log(formData);
    12061202
    12071203        jQuery.ajax({
     
    12141210            },
    12151211            success: function (response) {
    1216                 console.log('Margin save response');
    1217                 console.log(response);
     1212                // console.log('Margin save response');
     1213                // console.log(response);
    12181214
    12191215                messageElement.text(response.msg)
     
    12311227            },
    12321228            error: function (response) {
    1233                 console.log('Margin save ERROR');
    1234                 console.log(response);
     1229                // console.log('Margin save ERROR');
     1230                // console.log(response);
    12351231
    12361232                // Show message
     
    12501246});
    12511247
    1252 function registerCountryStateHandler(countryElementId, stateElementId) {
    1253 
     1248function registerCountryStateHandler(countryElementId, stateElementId, sc = false) {
     1249
     1250    let logPrefix = sc ? 'SC: ' : 'AD: ';
    12541251    let countryElement = jQuery('#' + countryElementId);
    12551252    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    }
    12561272
    12571273    countryElement.on('change', function (e) {
     1274        let countryValue = jQuery(this).val();
     1275
     1276        eShipperConsoleLog(logPrefix, 'Country selected - ' + countryValue)
    12581277
    12591278        // Disable both Country & State fields until results are obtained from ajax
     
    12621281
    12631282        // Show the loader
    1264         let loader = jQuery('#' + stateElementId + '-loader');
    12651283        loader.removeClass('es-d-none')
    12661284
    12671285        // Remove all previous options
    12681286        jQuery('#' + stateElementId + ' > .' + stateElementId + '-option').remove();
    1269 
    1270         let countryValue = jQuery(this).val();
    12711287
    12721288        if (countryValue === '') {
     
    12771293        }
    12781294
    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
     1299function 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
     1334function eShipperConsoleLog(prefix = '', message) {
     1335    console.log(prefix + message);
    13021336}
    13031337
  • eshipper-commerce/tags/2.16.3/framework/shippingmethod.php

    r2966127 r2984482  
    788788                                Calculate Shipping and check live rates from eShipper
    789789                            </h3>
    790                             <p>This page helps you (the site-admin) check live shipping rates for a set of products and shipping address without having
    791                                 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>
    792792                            <p>If you are able to see shipping rates on this page after clicking 'Calculate Shipping', this implies that your store is
    793793                                able to receive live rates from eShipper.</p>
     
    984984                                    </tr>
    985985                                    </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>
    986996                                </table>
    987997                            </div>
  • eshipper-commerce/tags/2.16.3/plugin/PluginHealthHelper.php

    r2966127 r2984482  
    6363        }
    6464
    65         $create_plugin_health_table = " CREATE TABLE $table(
    66             $columns
     65        $create_plugin_health_table = " CREATE TABLE $table($columns
    6766            created_time timestamp DEFAULT CURRENT_TIMESTAMP,
    6867            updated_time timestamp DEFAULT NULL
  • eshipper-commerce/tags/2.16.3/readme.txt

    r2977583 r2984482  
    55Tested up to: 6.3.1
    66Requires PHP: 7.1
    7 Stable tag: 2.16.2
     7Stable tag: 2.16.3
    88License: GPLv3
    99License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    5454
    5555== 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
    5659= 2.16.2 =
    5760* Support for WordPress version 6.3.1
     
    9699
    97100== Upgrade Notice ==
     101= 2.16.3 =
     102Bug fixes for Shipping Calculator.
     103
    98104= 2.16.2 =
    99105Support for WordPress version 6.3.1
  • eshipper-commerce/tags/2.16.3/woocommerce-eshipper.php

    r2977583 r2984482  
    44    Plugin URI: https://ww2.eshipper.com/ecommerce/
    55    Description: Extends WooCommerce with Shipping Rates from eShipper
    6     Version: 2.16.2
     6    Version: 2.16.3
    77    Author: eShipper
    88    Author URI: https://ww2.eshipper.com/
     
    2828    get_site_option('active_sitewide_plugins')
    2929))) {
    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');
    3232    define('ESHIPPER_VERSION_DB_UPDATE', '2.15.3');
    3333    //Plugin Path
     
    519519    function es_select_country_states()
    520520    {
     521        wc_get_logger()->debug('SC: Request received for States', ['source' => 'eshipper']);
     522
    521523        $data = [];
    522524
    523525        // If no data in post request, return error
    524526        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);
    526531
    527532            if (!empty($states)) {
     
    535540        }
    536541
    537         $response = [
     542        $response = json_encode([
    538543            '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;
    542549        die();
    543550    }
  • eshipper-commerce/trunk/framework/lib/admin-settings.js

    r2966127 r2984482  
    565565
    566566    // Clear country and state fields
    567     jQuery('#es-sc-address-country').val('');
     567    // jQuery('#es-sc-address-country').val('');
    568568    jQuery('#es-sc-address-state').val('').attr('disabled', true);
    569569
    570     // State/country fields handling - show state when country is selected
    571     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);
    572572
    573573    // Initialize select2 on first product row
     
    605605            }
    606606        }).on('select2:select select2:unselect', function (e) {
    607             console.log('event');
    608             console.log(e);
    609607            let data = e.params.data;
    610608            let qtyElement = jQuery(this).parents('tr').find('.es-sc-quantity');
     
    653651            // Get the value of quantity
    654652            let qty = jQuery(this).val();
    655             console.log('qty value changed - ' + qty);
    656653
    657654            // If quantity was set to empty, remove rate & price values
     
    661658                // Now proceed to update product price if rate is not empty (fail-safe check)
    662659                let rate = rateElement.text() ?? rateElement.data('value');
    663                 console.log('Rate ' + rate);
    664660                if (rate !== '') {
    665661                    es_sc_update_html_and_data(es_sc_format_amount(rate * qty), priceElement)
     
    674670    jQuery('#es-sc-add-product-btn').on('click', function (e) {
    675671        e.preventDefault();
    676         console.log('Adding new product row');
    677672        // Create a unique id for the new product row
    678673        let itemId = 'es-sc-product-row-' + Date.now();
     
    761756            // Now that all fields are filled, proceed with form submission
    762757            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();
    764765        }
    765766
     
    775776        };
    776777
    777         console.log('shipping calculator formdata: ');
     778        console.log('Shipping Calculator request - ');
    778779        console.log(formData);
    779780
     
    896897
    897898        if (_parent.prop('checked')) {
    898             console.log('es_Checkbox-parent checked');
    899899            nextli.each(function () {
    900900                jQuery(this).children().prop('checked', true);
     
    902902
    903903        } else {
    904             console.log('es_Checkbox-parent un checked');
    905904            nextli.each(function () {
    906905                jQuery(this).children().prop('checked', false);
     
    911910
    912911    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'));
    916912        var ths = jQuery(this);
    917913        var parentinput = ths.closest('div').prev().children();
     
    954950     */
    955951
    956     // State/country fields handling - show state when country is selected
     952    // For Address Settings: State/country fields handling - show state when country is selected
    957953    registerCountryStateHandler('es-settings-address-country', 'es-settings-address-state')
    958954
     
    968964        success: function (response) {
    969965            if (response.data != null) {
    970                 console.log('Showing Shipping Address');
     966                console.log('Address: Showing Shipping Address');
    971967                console.log(response);
    972968
     
    991987                jQuery("#es-settings-address-country").val(country);
    992988
    993                 console.log('Country received - ' + country);
     989                console.log('Address: Country received - ' + country);
    994990                // Get States of the country received in response and add them to the available options in state dropdown
    995991                jQuery.ajax({
     
    1002998                    },
    1003999                    success: function (response) {
    1004                         console.log('Populating state options');
     1000                        console.log('Address: Populating state options');
    10051001                        console.log(response);
    10061002                        // Add all options received in response
     
    10091005                        });
    10101006
    1011                         console.log('Setting value of state - ' + state);
     1007                        console.log('Address: Setting value of state - ' + state);
    10121008                        // Set the value of state as received in response & show it selected
    10131009                        jQuery("#es-settings-address-state").val(state);
     
    11001096        }
    11011097
    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);
    11041100
    11051101        jQuery.ajax({
     
    11121108            },
    11131109            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);
    11161112
    11171113                // Show message
     
    11261122            },
    11271123            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);
    11301126
    11311127                // Show message
     
    12021198        }
    12031199
    1204         console.log('Margin Settings form data');
    1205         console.log(formData);
     1200        // console.log('Margin Settings form data');
     1201        // console.log(formData);
    12061202
    12071203        jQuery.ajax({
     
    12141210            },
    12151211            success: function (response) {
    1216                 console.log('Margin save response');
    1217                 console.log(response);
     1212                // console.log('Margin save response');
     1213                // console.log(response);
    12181214
    12191215                messageElement.text(response.msg)
     
    12311227            },
    12321228            error: function (response) {
    1233                 console.log('Margin save ERROR');
    1234                 console.log(response);
     1229                // console.log('Margin save ERROR');
     1230                // console.log(response);
    12351231
    12361232                // Show message
     
    12501246});
    12511247
    1252 function registerCountryStateHandler(countryElementId, stateElementId) {
    1253 
     1248function registerCountryStateHandler(countryElementId, stateElementId, sc = false) {
     1249
     1250    let logPrefix = sc ? 'SC: ' : 'AD: ';
    12541251    let countryElement = jQuery('#' + countryElementId);
    12551252    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    }
    12561272
    12571273    countryElement.on('change', function (e) {
     1274        let countryValue = jQuery(this).val();
     1275
     1276        eShipperConsoleLog(logPrefix, 'Country selected - ' + countryValue)
    12581277
    12591278        // Disable both Country & State fields until results are obtained from ajax
     
    12621281
    12631282        // Show the loader
    1264         let loader = jQuery('#' + stateElementId + '-loader');
    12651283        loader.removeClass('es-d-none')
    12661284
    12671285        // Remove all previous options
    12681286        jQuery('#' + stateElementId + ' > .' + stateElementId + '-option').remove();
    1269 
    1270         let countryValue = jQuery(this).val();
    12711287
    12721288        if (countryValue === '') {
     
    12771293        }
    12781294
    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
     1299function 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
     1334function eShipperConsoleLog(prefix = '', message) {
     1335    console.log(prefix + message);
    13021336}
    13031337
  • eshipper-commerce/trunk/framework/shippingmethod.php

    r2966127 r2984482  
    788788                                Calculate Shipping and check live rates from eShipper
    789789                            </h3>
    790                             <p>This page helps you (the site-admin) check live shipping rates for a set of products and shipping address without having
    791                                 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>
    792792                            <p>If you are able to see shipping rates on this page after clicking 'Calculate Shipping', this implies that your store is
    793793                                able to receive live rates from eShipper.</p>
     
    984984                                    </tr>
    985985                                    </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>
    986996                                </table>
    987997                            </div>
  • eshipper-commerce/trunk/plugin/PluginHealthHelper.php

    r2966127 r2984482  
    6363        }
    6464
    65         $create_plugin_health_table = " CREATE TABLE $table(
    66             $columns
     65        $create_plugin_health_table = " CREATE TABLE $table($columns
    6766            created_time timestamp DEFAULT CURRENT_TIMESTAMP,
    6867            updated_time timestamp DEFAULT NULL
  • eshipper-commerce/trunk/readme.txt

    r2977583 r2984482  
    55Tested up to: 6.3.1
    66Requires PHP: 7.1
    7 Stable tag: 2.16.2
     7Stable tag: 2.16.3
    88License: GPLv3
    99License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    5454
    5555== 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
    5659= 2.16.2 =
    5760* Support for WordPress version 6.3.1
     
    9699
    97100== Upgrade Notice ==
     101= 2.16.3 =
     102Bug fixes for Shipping Calculator.
     103
    98104= 2.16.2 =
    99105Support for WordPress version 6.3.1
  • eshipper-commerce/trunk/woocommerce-eshipper.php

    r2977583 r2984482  
    44    Plugin URI: https://ww2.eshipper.com/ecommerce/
    55    Description: Extends WooCommerce with Shipping Rates from eShipper
    6     Version: 2.16.2
     6    Version: 2.16.3
    77    Author: eShipper
    88    Author URI: https://ww2.eshipper.com/
     
    2828    get_site_option('active_sitewide_plugins')
    2929))) {
    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');
    3232    define('ESHIPPER_VERSION_DB_UPDATE', '2.15.3');
    3333    //Plugin Path
     
    519519    function es_select_country_states()
    520520    {
     521        wc_get_logger()->debug('SC: Request received for States', ['source' => 'eshipper']);
     522
    521523        $data = [];
    522524
    523525        // If no data in post request, return error
    524526        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);
    526531
    527532            if (!empty($states)) {
     
    535540        }
    536541
    537         $response = [
     542        $response = json_encode([
    538543            '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;
    542549        die();
    543550    }
Note: See TracChangeset for help on using the changeset viewer.