objectivehtml / Google-Maps-for-Craft

The complete geolocation toolkit for Craft CMS.
Other
94 stars 20 forks source link

Force search within specific country #51

Closed neilbradley closed 8 years ago

neilbradley commented 8 years ago

Hi, In the ExpressionEngine version, there is the option to add the following hidden field to a search form to always search within a specific country:

<input type="hidden" name="country" value=", UK" />

Is something similar possible with the Craft version?

objectivehtml commented 8 years ago

Hey man, sorry for the delay. I was out most of last year with health issues but back in action now. Here is how you do what you are asking in Twig. Basically just append a string to the query.

{% set query = craft.request.getParam('q') %}

{% set params = {
    address: query ~ ', UK',
    distance: 200
} %}