diff --git a/CHANGELOG-PUBLIC.MD b/CHANGELOG-PUBLIC.MD index c414ecf..f536a3c 100644 --- a/CHANGELOG-PUBLIC.MD +++ b/CHANGELOG-PUBLIC.MD @@ -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 + + diff --git a/CHANGELOG.MD b/CHANGELOG.MD index c414ecf..f536a3c 100755 --- a/CHANGELOG.MD +++ b/CHANGELOG.MD @@ -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 + + diff --git a/README.md b/README.md index 46e163d..d3fdfc6 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # 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 ----- @@ -9,10 +9,7 @@ Facts 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: @@ -20,11 +17,11 @@ The extension features address auto-complete for: 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 ------------------------- @@ -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 ------- diff --git a/composer.json b/composer.json index 9c47be1..2478200 100755 --- a/composer.json +++ b/composer.json @@ -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" diff --git a/src/view/frontend/templates/address/autocomplete.phtml b/src/view/frontend/templates/address/autocomplete.phtml index e11d039..91a6962 100644 --- a/src/view/frontend/templates/address/autocomplete.phtml +++ b/src/view/frontend/templates/address/autocomplete.phtml @@ -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);