Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search: show nearest entry on map #57

Open
holhel11 opened this issue Apr 25, 2016 · 1 comment
Open

Search: show nearest entry on map #57

holhel11 opened this issue Apr 25, 2016 · 1 comment

Comments

@holhel11
Copy link

holhel11 commented Apr 25, 2016

No description provided.

@Jammooka
Copy link

Not sure exactly how this would tie in to your set up, but you can use a regular form to search for location, then get this from the url:

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

Then you can pass that to get your results:

{% if location | length %}
    {% set params = {
        address: location,
    } %}
    {% set store = craft.entries.section('storeEntries')
                            .mapField(params)
                            .order('distance asc')
                            .limit(1)
    %}

That will give you your closest store, which you'll have to tie in to your existing set up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants