Plugin Directory

Changeset 2938346


Ignore:
Timestamp:
07/13/2023 04:28:02 PM (3 years ago)
Author:
devpress
Message:

Update to version 1.1.1 from GitHub

Location:
address-autocomplete-google-places
Files:
6 edited
1 copied

Legend:

Unmodified
Added
Removed
  • address-autocomplete-google-places/tags/1.1.1/address-autocomplete.php

    r2878134 r2938346  
    11<?php
    22/**
    3  * Plugin Name: Address Autocomplete Google Places
     3 * Plugin Name: Address Autocomplete with Google Places
    44 * Plugin URI: https://github.com/devpress/address-autocomplete-google-places
    55 * Description: Enables address autocomplete with Google Places API for WooCommerce.
    6  * Version: 1.1.0
     6 * Version: 1.1.1
    77 * Author: DevPress
    88 * Author URI: https://devpress.com
     
    1010 * Requires at least: 6.0
    1111 * Requires PHP: 7.2
    12  * Tested up to: 6.1.1
     12 * Tested up to: 6.2.2
    1313 *
    1414 * WC requires at least: 5.6.0
    15  * WC tested up to: 7.2.2
     15 * WC tested up to: 7.8.2
    1616 *
    1717 * License: GNU General Public License v3.0
  • address-autocomplete-google-places/tags/1.1.1/assets/address-autocomplete.js

    r2878134 r2938346  
    105105        const addressComponents = place.address_components;
    106106
     107        // Useful for debugging.
     108        if (false) {
     109            for (const component of place.address_components) {
     110                const componentType = component.types[0];
     111                console.log(componentType);
     112                console.log(component);
     113            }
     114        }
     115
    107116        // Get country first since address components vary by country.
    108117        const country = this.getAddressComponentShortName(
     
    130139        );
    131140        if (stateField.tagName == "SELECT") {
    132             stateField.value = stateComponent.short_name;
    133141            Array.prototype.forEach.call(stateField.options, function (option) {
    134                 if (stateComponent.short_name == option.value) {
     142                // We can generally assume the shortname will be the value.
     143                if (option.value == stateComponent.short_name) {
     144                    stateField.value = stateComponent.short_name;
     145                    option.selected = true;
     146                    return true;
     147                }
     148
     149                // But if there isn't a match, we can try the long name.
     150                // This was implemented for Mexico.
     151                if (option.text == stateComponent.long_name) {
     152                    stateField.value = stateComponent.long_name;
    135153                    option.selected = true;
    136154                    return true;
  • address-autocomplete-google-places/tags/1.1.1/readme.txt

    r2878134 r2938346  
    44Tags: woocommerce
    55Requires at least: 6.0
    6 Tested up to: 6.1.1
    7 Stable tag: 1.1.0
     6Tested up to: 6.2.2
     7Stable tag: 1.1.1
    88Requires PHP: 7.0
    99License: GPLv2 or later
     
    2323
    2424== Frequently Asked Questions ==
     25
     26= What countries are supported? =
     27
     28This extension should work for any country Google Places supports. It has been tested with:
     29
     30* Canada (CA)
     31* Mexico (MX)
     32* Portugal (PT)
     33* Puerto Rico (PR)
     34* United Kingdom (UK)
     35* United States (US)
     36
     37If you find a bug or issue with address parsing for a specific country, please reach out to support!
    2538
    2639= How do I get a Google Places API Key? =
     
    4962== Changelog ==
    5063
     64= 1.1.1 =
     65
     66* Update: Support for Mexico.
     67
    5168= 1.1.0 =
    5269
  • address-autocomplete-google-places/trunk/address-autocomplete.php

    r2878134 r2938346  
    11<?php
    22/**
    3  * Plugin Name: Address Autocomplete Google Places
     3 * Plugin Name: Address Autocomplete with Google Places
    44 * Plugin URI: https://github.com/devpress/address-autocomplete-google-places
    55 * Description: Enables address autocomplete with Google Places API for WooCommerce.
    6  * Version: 1.1.0
     6 * Version: 1.1.1
    77 * Author: DevPress
    88 * Author URI: https://devpress.com
     
    1010 * Requires at least: 6.0
    1111 * Requires PHP: 7.2
    12  * Tested up to: 6.1.1
     12 * Tested up to: 6.2.2
    1313 *
    1414 * WC requires at least: 5.6.0
    15  * WC tested up to: 7.2.2
     15 * WC tested up to: 7.8.2
    1616 *
    1717 * License: GNU General Public License v3.0
  • address-autocomplete-google-places/trunk/assets/address-autocomplete.js

    r2878134 r2938346  
    105105        const addressComponents = place.address_components;
    106106
     107        // Useful for debugging.
     108        if (false) {
     109            for (const component of place.address_components) {
     110                const componentType = component.types[0];
     111                console.log(componentType);
     112                console.log(component);
     113            }
     114        }
     115
    107116        // Get country first since address components vary by country.
    108117        const country = this.getAddressComponentShortName(
     
    130139        );
    131140        if (stateField.tagName == "SELECT") {
    132             stateField.value = stateComponent.short_name;
    133141            Array.prototype.forEach.call(stateField.options, function (option) {
    134                 if (stateComponent.short_name == option.value) {
     142                // We can generally assume the shortname will be the value.
     143                if (option.value == stateComponent.short_name) {
     144                    stateField.value = stateComponent.short_name;
     145                    option.selected = true;
     146                    return true;
     147                }
     148
     149                // But if there isn't a match, we can try the long name.
     150                // This was implemented for Mexico.
     151                if (option.text == stateComponent.long_name) {
     152                    stateField.value = stateComponent.long_name;
    135153                    option.selected = true;
    136154                    return true;
  • address-autocomplete-google-places/trunk/readme.txt

    r2878134 r2938346  
    44Tags: woocommerce
    55Requires at least: 6.0
    6 Tested up to: 6.1.1
    7 Stable tag: 1.1.0
     6Tested up to: 6.2.2
     7Stable tag: 1.1.1
    88Requires PHP: 7.0
    99License: GPLv2 or later
     
    2323
    2424== Frequently Asked Questions ==
     25
     26= What countries are supported? =
     27
     28This extension should work for any country Google Places supports. It has been tested with:
     29
     30* Canada (CA)
     31* Mexico (MX)
     32* Portugal (PT)
     33* Puerto Rico (PR)
     34* United Kingdom (UK)
     35* United States (US)
     36
     37If you find a bug or issue with address parsing for a specific country, please reach out to support!
    2538
    2639= How do I get a Google Places API Key? =
     
    4962== Changelog ==
    5063
     64= 1.1.1 =
     65
     66* Update: Support for Mexico.
     67
    5168= 1.1.0 =
    5269
Note: See TracChangeset for help on using the changeset viewer.