Skip to content

Commit

Permalink
20.3.3 MNB-1058 Fix conditionals and fix issue with whole address pri…
Browse files Browse the repository at this point in the history
…nting in street line 1
  • Loading branch information
wsajosh committed Apr 1, 2021
1 parent 96bd30b commit 6049b58
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 11 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG-PUBLIC.MD
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,7 @@ MNB-401 Fix issue with popup rendering for logged in users
MNB-532 Fix use long zip option


## 20.3.3 (2021-04-01)
MNB-1058 Fix conditionals and fix issue with whole address printing in street line 1


4 changes: 4 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,7 @@ MNB-401 Fix issue with popup rendering for logged in users
MNB-532 Fix use long zip option


## 20.3.3 (2021-04-01)
MNB-1058 Fix conditionals and fix issue with whole address printing in street line 1


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.3.2",
"version": "20.3.3",
"license": [
"OSL-3.0",
"AFL-3.0"
Expand Down
22 changes: 12 additions & 10 deletions src/view/frontend/web/js/autocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,23 +123,25 @@ define([
} else if (addressType == 'postal_code') {
postcode = value;
var thisDomID = uiRegistry.get('checkout.steps.shipping-step.shippingAddress.shipping-address-fieldset.postcode').uid
if ($('#'+thisDomID)) {
if ($('#'+thisDomID).length) {
$('#'+thisDomID).val(postcode + postcodeSuffix);
$('#'+thisDomID).trigger('change');
}
} else if (addressType == 'postal_code_suffix' && window.checkoutConfig.shipperhq_autocomplete.use_long_postcode === '1') {
postcodeSuffix = '-' + value;
var thisDomID = uiRegistry.get('checkout.steps.shipping-step.shippingAddress.shipping-address-fieldset.postcode').uid
if ($('#'+thisDomID)) {
if ($('#'+thisDomID).length) {
$('#'+thisDomID).val(postcode + postcodeSuffix);
$('#'+thisDomID).trigger('change');
}
} else {
var elementId = lookupElement[addressType];
var thisDomID = uiRegistry.get('checkout.steps.shipping-step.shippingAddress.shipping-address-fieldset.'+ elementId).uid;
if ($('#'+thisDomID)) {
$('#'+thisDomID).val(value);
$('#'+thisDomID).trigger('change');
if (elementId !== undefined) {
var thisDomID = uiRegistry.get('checkout.steps.shipping-step.shippingAddress.shipping-address-fieldset.' + elementId).uid;
if ($('#' + thisDomID).length) {
$('#' + thisDomID).val(value);
$('#' + thisDomID).trigger('change');
}
}
}
}
Expand All @@ -148,20 +150,20 @@ define([
street[0] = streetNumber;
var domID = uiRegistry.get('checkout.steps.shipping-step.shippingAddress.shipping-address-fieldset.street').elems()[0].uid;
var streetString = street.join(' ');
if ($('#'+domID)) {
if ($('#'+domID).length) {
$('#'+domID).val(streetString);
$('#'+domID).trigger('change');
}
}
var cityDomID = uiRegistry.get('checkout.steps.shipping-step.shippingAddress.shipping-address-fieldset.city').uid;
if ($('#'+cityDomID)) {
if ($('#'+cityDomID).length) {
$('#'+cityDomID).val(city);
$('#'+cityDomID).trigger('change');
}
if (region != '') {
if (uiRegistry.get('checkout.steps.shipping-step.shippingAddress.shipping-address-fieldset.region_id')) {
var regionDomId = uiRegistry.get('checkout.steps.shipping-step.shippingAddress.shipping-address-fieldset.region_id').uid;
if ($('#'+regionDomId)) {
if ($('#'+regionDomId).length) {
//search for and select region using text
$('#'+regionDomId +' option')
.filter(function () {
Expand All @@ -173,7 +175,7 @@ define([
}
if (uiRegistry.get('checkout.steps.shipping-step.shippingAddress.shipping-address-fieldset.region_id_input')) {
var regionDomId = uiRegistry.get('checkout.steps.shipping-step.shippingAddress.shipping-address-fieldset.region_id_input').uid;
if ($('#'+regionDomId)) {
if ($('#'+regionDomId).length) {
$('#'+regionDomId).val(region);
$('#'+regionDomId).trigger('change');
}
Expand Down

0 comments on commit 6049b58

Please sign in to comment.