Hi. Im developing an aplication for a marketplace with delivery like ubereats. I need to introduce a searchbar in the landing page that can automaticaly find the current location of the user so it can only display the restaurants available in a certain range distance because those will be the ones they can purchase from. How do i do that? Im new in bubble and learning fast on my own so please explain as detailed as you can.
Thank you in advance
Actually getting the data itself into your servers would be the thing here. Once you have a list of restaurants and residential addresses to reference it will be extremely easy to build the functionality you want.
If the user has revealed their address to you, a conditional on the search bar can override its data source to just be âcurrent users addressâ. If you donât know the users address yet the search box can be set to filter the list of addresses based on the keystrokes. Then you can give the user the option to save their address for next time.
As to the initial problem of getting the data you can either download it somewhere and load it all directly into your database or connect to what I assume will be readily available APIs made just for that.
@motinhaparedespenafie Bubble has a built in dynamic expression âcurrent geographic positionââŚthis is the most accurate way to get the location of the user, however, it requires them to grant access to your application, and so if you rely just on that, and the user denies location, functions will break.
You can also install a free plugin like âBrowserâ which will allow you to extract the browser location, however, this is not that accurate at times, mostly dependent on the location of the user. If they are in a densely populated city center, it is pretty accurate, but if they are located in a more rural location it can be extremely inaccurate.
Another option is not to not have it pre-populated and have them enter their address and use Google Places for that in a search box element. The problem with that is it doesnât allow you to restrict based on country as Bubble built it. But if you build your own with API connected to Google directly you can restrict by country.
The last option is most advanced, so likely not a rabbit hole you need to go down now. Iâd suggest use the âcurrent geographic positionâ and make conditions for if it is not accessible then use the search box element with Google places.
This topic was automatically closed after 70 days. New replies are no longer allowed.