Forum Academy Marketplace Showcase Pricing Features

URGENT: Will pay for help! Do a Search for Thing within a certain driving distance (Google Distance Matrix API Plugin)

Hi all,

Thanks in advance for your support! I’ve spent quite a lot of time in bubble, yet I feel like I’m making a simple error that I just can’t resolve. :roll_eyes:

I am creating a food marketplace similar to doordash, that I am launching in 3 days, but encountered a problem that I need to solve by using the Google Distance Matrix API.

I am trying to display “restaurants” in a repeating group. I only want to display “restaurants” that are within a certain driving distance to the customer’s delivery address (using the Google Distance Matrix Plugin).

To calculate the distance between 2 points using the plugin you simply choose: dynamic data - Google Matrix API - input origin address & destination address.

The problem arises when I try to set the constraints in the search for “restaurants”.
“Distance Max in km” is a value set by the restaurant to specify how far they want to deliver. So I set that to ≤ the calculated distance value.

When I try to calculate the distance from “customer’s address” (=SearchBox Address complete’s value) to “restaurants address”, I cannot find the dynamic data option for “restaurant’s address”.

Does somebody has an idea how to solve this - maybe a workaround - or maybe I am doing something wrong.

If someone can help me solve this it would save my day.

Thanks in advance for everyone who reads this & tries to help me.

Have a great day.
Manuel

Hi,

I think I may have a solution for you using the built in distance function. You will need Google Geocode API key. I have not been able to test this but it may give you an inspiration.

1 Like

Thank you so much @edward.w.douglas for your help!

I was able to solve it using :filtered .

Awesome thanks a lot. :pray: :+1:

2 Likes

a filter always happens after the search, so try to see if you can do it inside the search itself. Make sure you use the less than or equal operator ( <= ) , instead of less than.

1 Like

Yes, using ( <= ) may be a good idea :+1:

Do you guys also have an idea how to decrease API requests to google? To make a rough calculation: like this if I have for example 1000 restaurants on the marketplace each user’s search means 1000 requests = around 8€ :money_mouth_face:

I was thinking about grouping the addresses to addresses near them or to only search for restaurants that ship to specific ZIP codes (also needs to be specified in advance by restaurant owner…)

what do you guys think about this?

Nevertheless thank you both a lot for your help.

1 Like

@nocodeventure thank you a lot. This will help me to reduce costs by a lot!

1 Like

About 90 percent indeed, you’re welcome. :+1:

1 Like