Skip to content

Commit

Permalink
20.5.0 MNB-1843 User submitted enhancement to refactor add new addres…
Browse files Browse the repository at this point in the history
…s UI. MNB-1789 Fix for street address becoming uneditable on Google API error
  • Loading branch information
wsajosh committed Nov 30, 2021
1 parent 82e567b commit 23f5919
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 10 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG-PUBLIC.MD
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,7 @@ MNB-1058 Fix conditionals and fix issue with whole address printing in street li
RIV-534 support Enhanced Checkout


## 20.5.0 (2021-11-30)
MNB-1843 User submitted enhancement to refactor add new address UI. MNB-1789 Fix for street address becoming uneditable on Google API error


4 changes: 4 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,7 @@ MNB-1058 Fix conditionals and fix issue with whole address printing in street li
RIV-534 support Enhanced Checkout


## 20.5.0 (2021-11-30)
MNB-1843 User submitted enhancement to refactor add new address UI. MNB-1789 Fix for street address becoming uneditable on Google API error


22 changes: 13 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,27 @@
# ShipperHQ Address Auto-Complete
Add address lookup to your Magento 2 site using the simple tool, harnessing Google's Address Auto-Complete API.

More information on ShipperHQ capabilities are available at www.shipperhq.com
You do not need a ShipperHQ account to use this extension. For more information on ShipperHQ capabilities are available at [ShipperHQ](https://shipperhq.com/magento2)

Facts
-----
- [extension on GitHub](https://github.com/shipperhq/module-address-autocomplete)

Description
-----------
ShipperHQ Address Auto-Complete will install a simple shipping extension in Magento 2. No account is necessary and it's free to use.
It requires installation of ShipperHQ extension, although a ShipperHQ account is NOT REQUIRED to use the address autocomplete feature.

There's no cost for the extension and ShipperHQ is free for 30 days.
ShipperHQ Address Auto-Complete will install a simple extension in Magento 2. No ShipperHQ account is necessary and it's free to use.

The extension features address auto-complete for:

1. Guest checkout support for entering shipping address
2. Logged in customer entering a new address in their address book
3. Logged in customer entering a new shipping address at checkout

For more information see [ShipperHQ](https://shipperhq.com/magento2).
You will need a Google API key that has been enabled with “Google Places API Web Service” access

Compatibility
-------------
- Magento >= 2.0 (Incl 2.2)
- Magento >= 2.3

Installation Instructions
-------------------------
Expand All @@ -40,17 +37,24 @@ We recommend you also install our logging module
2. composer update
3. bin/magento setup:upgrade

Further information is available from [ShipperHQ documentation](http://docs.shipperhq.com/installing-the-shipperhq-address-autocomplete-extension/)
Further information is available from [our help documentation](http://docs.shipperhq.com/installing-the-shipperhq-address-autocomplete-extension/)

Configuration Instructions
-------------------------

Further information is available from [ShipperHQ documentation](http://docs.shipperhq.com/configure-shipperhq-address-autocomplete/)
1. Once installed, go to Stores > Configuration > Sales > Shipping Settings
2. Open ShipperHQ Address Autocomplete tab and enable the extension
3. Enter your Google API key – if you do not have a key, please register and ensure you have enabled the Google Places API services on your [Google account](https://developers.google.com/maps/documentation/places/web-service/get-api-key)
4. Save the configuration
5. Refresh the cache in Magento from System > Cache Management

Further information is available from [our help documentation](http://docs.shipperhq.com/configure-shipperhq-address-autocomplete/)

Limitations
-------

1. No support for address autocomplete on any admin forms
2. No support for address autocomplete on the billing address

Support
-------
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "shipperhq/module-address-autocomplete",
"description": "ShipperHQ Address Autocomplete Tool",
"type": "magento2-module",
"version": "20.4.0",
"version": "20.5.0",
"license": [
"OSL-3.0",
"AFL-3.0"
Expand Down
21 changes: 21 additions & 0 deletions src/view/frontend/templates/address/autocomplete.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,27 @@ $viewModel = $block->getViewModel();
postal_code: 'zip'
}

window.gm_authFailure = function() {
document.getElementById('street_1').setAttribute('placeholder', '');
document.getElementById('street_1').removeAttribute("style");
document.getElementById('street_1').removeAttribute("disabled")
google.maps.event.clearInstanceListeners(document.getElementById('street_1'));
removeElementsByClass("pac-container")
};

/**
* Removes element by class name. Credit to
* https://stackoverflow.com/questions/4777077/removing-elements-by-class-name
*
* @param className
*/
function removeElementsByClass(className){
const elements = document.getElementsByClassName(className);
while(elements.length > 0){
elements[0].parentNode.removeChild(elements[0]);
}
}

function initAutocomplete() {
var input = document.getElementById('street_1');
input.addEventListener('focus', geolocate, true);
Expand Down

0 comments on commit 23f5919

Please sign in to comment.