Closed nigelramsay closed 3 years ago
Here is the Hubspot ticket to follow up with customer when the issue is fixed: https://app.hubspot.com/contacts/20223507/ticket/507239987/
Can you give me more instructions of how to replicate the error for this issue? what exact page. Is it on page load or do I need to interact in a certain way? This is what I got so far, but none of the errors are related to the issue.
Also, can I get access to Hubspot so I can follow the issue.
In some scenarios, the
widgetConfig.defaultCountry
is not set - and this causes issues when the widget is activated.I believe the root cause of the problem is this line: https://github.com/AddressFinder/addressfinder-magento/blob/develop/view/base/web/js/source/magento-plugin.js#L35
I think the
default_search_country
key is confined to PHP, and should not be used in JS/HTML. Here is the place where PHP configuration is prepared for conversion to JS - https://github.com/AddressFinder/addressfinder-magento/blob/develop/Model/WidgetConfigProvider.php#L98This should be the last place that
default_search_country
is referred to. From this point onwards, it looks likedefault_country
is the new key. ~I believe that default_country is translated into JS syntax as defaultCountry~ Not correct.And I think that this block of PHP config is invected into the HTML here (note the
json_encode
function call): https://github.com/AddressFinder/addressfinder-magento/blob/develop/view/frontend/templates/plugin.phtml#L11Summary
We have 3 different keys which are mis-matched, and need to be understood why - and perhaps fixed/aligned:
There is an email trail of attempting to provide a workaround for this problem here: https://app.hubspot.com/live-messages/20223507/inbox/1481277347
The ultimate solution that got it going was change
file: view/frontend/web/js/magento-plugin.js line: 148 from:
defaultCountry: this.widgetConfig.default_search_country
to:defaultCountry: this.widgetConfig.default_country