I use the Places Autocomplete Service to search for a specific address. The Adress should be stored to database on my model to know where it is located. My site is multi lingual and I have to print the adress (e.g. the country names) in the choosen language. Also I have to filter the models by country or city's name.
Is there a way to get the PlaceResult in multiple languages?
I use the Javascript API in the version v3.8
Related
I'm totally new to Moqui/PopCommerce and my first impressions of it are great.
One thing that I didn't find how to do was country-specific postal address formatting: unfortunately, every country has a different address format, with different fields, ordering and arrangement of the fields.
For example, in most of Europe, the Zip code is expected left of the city name and there is no '#' sign in front of the house number. In France, the house number is left of the street and followed by a comma.
Some countries e.g. in Asia even have multiple address formats depending on other factors (e.g. rural vs city)
You can see explanations and examples here:
https://en.wikipedia.org/wiki/Address_(geography)#Format_by_country
http://www.columbia.edu/~fdc/postal/
So for any software that handles postal addresses, there are at least two situations where that country-specific address formatting is relevant:
1. in any output of a postal address (e.g. display, printout, mail, pdf, etc.)
2. in input of a postal address (e.g. address input form)
While an input form that doesn't adapt to the country-specific format is only a secondary problem (at least as long as it is only used by internal users and not external customers), any address output (especially one that is seen by any external customers) really HAS to conform to the country-specific address format and order, which means that there should be some way in the input form to choose an address format profile (e.g. by adapting to the chosen country).
I didn't see how to do that easily. I did find a PostalAddressSimpleTemplate variable in /vapps/system/Localization , but as I understand it, adding translations there would make the output dependent on the locale chosen by the user and not on the country of the address.
So my questions are:
* Is there any easy way to do this? (maybe I just didn't find it?)
* If not, is this something that would likely be added in the near future?
To date the functionality in SimpleScreens (which is where the postal address entry forms and display templates are located) is more USA oriented because all of the sponsorship for it has been by companies in the USA. There have been a few contributions that are localization related, and a few localization components that others have built (see the Add Ons page on moqui.org), but these particular forms seem to be customized rather than made more dynamic to work better across a wider variety of locales.
If you are targeting a specific locale the best thing to do is plugin your own address entry form and display template, and if you are building a public facing web site you probably shouldn't use the forms or templates from SimpleScreens anyway (all are meant for internal applications, or portal sorts of sites for external users with a limited scope, but really not for ecommerce and other sorts of sites where they are publicly available and users won't use them enough to be able to use them with no training or documentation, or from another point of view benefit from the standard UI patterns).
The OOTB input form has started to move in a more country-generic direction with the country drop-down being to the left of the state/province drop-down (for whatever sub-country region is used in the country) and the state/province drop-down reloads from the server when the country is changed.
The output structure (in the address .gstring file, for HTML output) doesn't currently do anything different based on the country.
These will both change over time, but right now basically to handle country-specific input forms or output templates customization is required.
I am new to Magento.
I want a text box where i can type the zip code and if the store available in that location then i need to show the products of that particular store otherwise we need to show that "the store is not available in particular location".
The following is the example site. i want it as it is.
this site prompts for users zip location .after it will display stores of that particular.
Click on this link to see the working example
how do i do this . Do i need to install a module ?
Follow Some Steps:
You need an entity 'store' that is bound to a geo location.
You need to create a multi select attribute which values are located (using a
source model) with these stores. This way, you can attach a single product to
multiple stores (one to many relation)
Then you need some sort of external API to convert a postcode entered by the
customer to a geo location. I assume the Google Maps API can do this. It would
be best to handle this server side.
Then you need the math to calculate the distance between 2 geo locations in
your database query (probably enough to find on that subject on Google) and
filter your product collection on that.
Once you have the collection you have the power.
The external API will probably have a request threshold so you might have to
pay for that (depending on the traffic).
You need to determine the radius of maximum distance between 2 geo locations.
In a small country like the Netherlands stores could be a couple of km's apart
from each other, whilst in the United States it's not uncommon to have stores
tens or hundreds of km's from each other.
**Best Of Luck For Your Project**
For my app I will need to access different town and store data for each town. Basically it will be a 2d array with one dimension being the town and the next the data. I was just wondering (using Xcode and Objective C) how I could access every town in a country (I'm looking at the UK if that helps). I don't need it on a map I just need it so people can store data relative to their town simply by searching for the town and adding their data to the array for that town. Thanks in advance!
There are a couple of ways to do it. If you want to use the user's device GPS to identify its location, than you can use the Google Places API that you can install through cocoapod
If you want to perform a search, you can obtain a API key from Google and then use their URL based search. For example, this URL should return a list of Starbuks in Seattle. There are more parameters that can be set and can apply to your case.
https://maps.googleapis.com/maps/api/place/textsearch/json?query=starbucks+seattle&sensor=false&key=YOUR_API_KEY
I would like to return specific places (stores like Target, Macy's, etc.) by location (latitude, longitude).
I have been using the google places api and entering the different stores in the name parameter. The results are inconsistent at best.
Is this the api I should be using to return specific stores by name and proximity? The google places api near by search has only a single name parameter. I would ideally like to search for several specific stores in a single request to the endpoint for performance reasons.
In conclusion
What api should I be using to return specific stores by name and proximity?
The Google Places API is the correct Google API to use; however, as you mentioned it does not support multiple name or keyword parameters. There is an active Places API - Feature Request for this here, please star it if you wish to see it resolved and to be notified of future changes.
Instead of using the name parameter, try using the keyword parameter. The keyword parameter is matched against all available fields, including but not limited to name, type, and address, as well as customer reviews and other third-party content. This can often yield more or better results.
It seems as if the foursquare api does let you search for multiple specific places.
Here is an example url that does the trick:
https://api.foursquare.com/v2/venues/search?ll=34.017717,-118.159335&query=Target Victoria's Secret Macy's &intent=browse&radius=16094&oauth_token=mytoken
g
So I'm abandoning Google Places and going with FourSquare.
I recently joined a team working on an application that maintains listings with addresses. The user searches, and includes their zipcode, and the application displays the distance to each listing. Currently we use the Google Maps API for this. Reading through questions here on StackOverflow seem to suggest that this is the best way of doing things:
php/mysql zip code proximity search
Search engine by distance
However, while reading through the API documentation, this seems to be expressly forbidden unless we also show a map for each result (and possibly also for each result we filter out, depending on how you read the following statement):
Use of the Distance Matrix API must relate to the display of information on a Google Map; for example, to determine origin-destination pairs that fall within a specific driving time from one another, before requesting and displaying those destinations on a map. Use of the service in an application that doesn't display a Google map is prohibited.
( https://developers.google.com/maps/documentation/distancematrix/ )
What's the best way to accomplish this without running afoul of any API terms?
do you consider the Geo::PostalCode module (perl)? It uses maxmind database to calculate distances between locations (and there is bind in different languages).