Cocolabs-SAS / cocorico

👐 Cocorico is an open source marketplace solution for services and rentals. More information right here: https://www.cocorico.io/ 🚀 Cocorico is also available in an off-the-shelf SaaS package, check out https://www.hatch.li to launch your platform today. 😍 We are hiring (telecommute welcome 🏡): https://www.welcometothejungle.com/en/companies/cocorico/jobs/candidatures-spontanees#apply
https://www.cocolabs.com
MIT License
857 stars 610 forks source link

geo google place #521

Closed gonzasylv closed 3 years ago

gonzasylv commented 3 years ago
Q A
Bug report? [ ]
Feature request? [ ]
Support request? [ x ]

hi @cocolabssas ,

I ask my question even if I see that the answers are very rare, can we make sure that when a user does a search in the geolocation part, he is provided with only cities, not streets, etc. .

Example: I look for "p" that returns "Paris" and all the cities of the country which have "p".

I'm talking about this field: http://imgur.com/tCBmANfl.png

Thanks :)

cocolabssas commented 3 years ago

Hi @gonzasylv,

Sorry for not having time to respond as quickly as you would like. In order for you to get your answers as quickly as possible, I recommend that you spend some time to look at the code in more depth to try to figure it out for yourself.

In the meantime, here are a few tips that may help you : The configuration you need to modify can be found here: src/Cocorico/GeoBundle/Resources/views/Common/js/_geocoding_js.html.twig:100

Try to change this :

               autoComplete = new google.maps.places.Autocomplete(
                    autoCompleteElt,
                    {types: ['geocode']}
                );

To :

               autoComplete = new google.maps.places.Autocomplete(
                    autoCompleteElt,
                    {types: ['(cities)']}
                );

If you need more I recommend you to understand by yourself how google place autocomplete place restriction works by looking to its documentation : https://developers.google.com/places/web-service/autocomplete

Hope it helps!

gonzasylv commented 3 years ago

Thanks @cocolabssas