add state & country to geolocation search form

5 posts by 3 authors in: Forums > CMS Builder: Plugins & Add-ons
Last Post: June 1, 2015   (RSS)

By Toledoh - May 31, 2015

Hi all,

I am using the basic proximity search form for the geolocation plugin.  Is there any way that I can add "Queensland, Australia" to any search entered? I want to make sure that if someone types "Texas", that the search is for Texas Queensland Australia - rather than working off Texas USA.

<form method="post" action="?" class="form-inline" role="form" id="proximitySearch">
<input type="hidden" name="search" value="1" />
<div class="form-group">
<label class="sr-only" for="fromAddress">Town name or postcode</label>
<input type="text" name="fromAddress" value="<?php echo htmlspecialchars(@$_REQUEST['fromAddress']); ?>" class="form-control" />
<input type="hidden" name="maxDistance" value="" />
</div>

<button type="submit" class="btn btn-default">Search</button>
</form>

Cheers,

Tim (toledoh.com.au)

By Toledoh - June 1, 2015

Hi Damon,

I think that 'fromAddress' will be replaced if people type in the field?  I need the Queensland Australia added to whatever they put in.

I was thinking that there would be some kind of "append" kind of thing.

The GEOCODER_REGION only identifies the country.  If someone types "brighton" - the system doesn't know whether it's Brighton in Victoria, New South Wales, or Queensland. For this website, it is purely focussed on Queensland, so I want to make the search "brighton" plus Queensland, Australia.

Cheers,

Tim (toledoh.com.au)

By Dave - June 1, 2015

Hi Tim, 

How about this? 

if (@$_REQUEST['fromAddress']) { $_REQUEST['fromAddress'] .= ", Queensland, Australia"; }

Let me know if that works for you.

Dave Edis - Senior Developer
interactivetools.com

By Toledoh - June 1, 2015

That's looking good Dave - thanks!

Cheers,

Tim (toledoh.com.au)