OmniBar search JS error
-
The omnibar search shortcode is returning an error in some situations. See example response:
{ "errors": { "idx_api_error": [ "Error 400: Invalid request sent to IDX Broker API, please re-install the IMPress for IDX Broker plugin." ] }, "error_data": { "idx_api_error": { "status": 400, "rest_error": "Invalid request sent to IDX Broker API, please re-install the IMPress for IDX Broker plugin." } } }
The ternary operator doesn’t account for this response, so I added a conditional before the ternary in the JS file. See diff:
diff --git a/wp-content/plugins/idx-broker-platinum/assets/js/idx-omnibar.min.js b/wp-content/plugins/idx-broker-platinum/assets/js/idx-omnibar.min.js index 3bbf68c5c..533010402 100644 --- a/wp-content/plugins/idx-broker-platinum/assets/js/idx-omnibar.min.js +++ b/wp-content/plugins/idx-broker-platinum/assets/js/idx-omnibar.min.js @@ -323,6 +323,10 @@ var idxOmnibar = function (e) { return t; }, s = function (e, t, i, n) { + if (e.errors) { + return false; + } + return ( "zip" === i ? e.forEach(function (e) {
I’m not sure if this is the correct solution but it at least stops all JS from failing on the search.
Note that the above url won’t have the issue because I have patched it in prod.
The page I need help with: [log in to see the link]
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.