0

We have a custom search page that makes use of the default components (search results, results count and page selector) along with the custom location finder (Location search box + services dropdown + distance dropdown). We want to trigger the search on the button click (JS) along with the search box functionalty (shipped default). On the button click, we need to perform the following

  1. generate the geo-coordinates for the address entered
  2. create hash parameters based on the geo codes and other filter dropdown and update the url
  3. trigger the search call to render the results.

Note: We do not want to use facet filter.

Can someone guide us to achieve this ?

1

Look like you are looking for the ready solution:) As far as I remember I already guide you to some scripts where we are generating the hash parameters.

  1. generate the geo-coordinates for the address entered - we are using typeahead plugin in the Location Finder to show some suggestions base on the location name entered by the user. So you can either use this or you can pass the text entered by the user to the XA.connector.mapsConnector.addressLookup() function and update the hash with the results
  2. create hash parameters based on the geo codes and other filter dropdown and update the url - I've already told you how to do that. Take a look at updateHash() function in component-search-location-filter.js. It does all that you need.
  3. trigger the search call to render the results - search will be triggered automacitally when you will update the hash (using e.g.: XA.component.search.query.updateHash function).
| improve this answer | |
  • :D, thanks. I'm giving a try – Lan Chandrasekaran Aug 8 '19 at 14:01
  • Thank you Dawid. That worked. For somereasons addressLookup() returns undefined. For now I called the geocode service to get the coordinates. I need to look why that happens. – Lan Chandrasekaran Aug 8 '19 at 18:03
  • Endure that valid Google Maps JavaScript API key in your site. – Dawid Rutkowski Aug 8 '19 at 20:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.