search display and sort

This topic contains 7 replies, has 3 voices, and was last updated by  Alex Rollin 4 years, 6 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket

Tagged: ,

  • Author
    Posts
  • #515955

    Mitch Canton
    Expired Member
    Post count: 167

    Hello,

    I have to be missing something simple. I’ve read through the docs and the forums, but just can’t figure out why this is not working.

    I simply want to be able to do a search and sort display.

    The search would be based on creating a button with a link something like this:
    URL/wpgd-search/?geodir_search=1&stype=gd_place&s=pizza&snear=&sgeo_lat=&sgeo_lon=&near=me

    My expectation is that this would render a map and archive of those listings which include the term ‘pizza’ and then those listing would be sorted based on distance from my (mobile) geolocation.

    The shortcode on the page is:
    [gd_notifications]
    [gd_search customize_filters=”searched”]
    [gd_map width=”100%” height=”360px” maptype=”ROADMAP” zoom=”10″ map_type=”archive” post_settings=”1″ post_type=”gd_place”]
    [gd_loop_actions]
    [gd_loop layout=5]
    [gd_loop_paging]

    This process DOES work to return a map of the related (term) items. But they are NOT limited to the distance I would expect (based on the settings in places>search>max search range =3mi — I’m getting all related listings, even 15-20-mi away); nor are they sorted by the distance from my geolocation (they seem to be sorted A-Z).

    Any help setting me in the right direction is greatly appreciated.

    Thanks!

    #515958

    Kor
    Moderator
    Post count: 16516

    Hi Mitch,

    Thanks for your post. Search results are sorted with relevance to what the visitor is searching for. Title, description, tags, and categories are searched, and the location is also considered.

    https://wpgeodirectory.com/docs-v2/places/sorting/#intro

    #515961

    Mitch Canton
    Expired Member
    Post count: 167

    Hi Kor,

    Thanks for the timely reply. I understand the standard search structure, but in this case the visitor isn’t searching, we create a ‘search url’ that specifically only searches for a term and the url includes the ‘near me’ and ‘lat lng’ info if allowed (like the example I provided), so why can’t it sort by distance?

    With such a high percentage of our users on mobile, search based on ‘near me’ is really important. It seems as though we can add info that to the URL structure, but what good does that feature do if the search return gives us listings 10 miles away as the first ones displayed.

    Maybe have the search listings page have a shortcode option to display only items within x distance of the lat lng generated in the search?

    There has to be some way to get a closer set of marker points for someone searching on mobile.

    Thank you.

    #515987

    Alex Rollin
    Moderator
    Post count: 27815

    Hello,

    to find the right URLs, just perform the search you want and copy that URL.

    If you are doing a near search with the search bar then yes, the listings should be sorted by nearest and show distance. Example:

    https://wpgeo.directory/supreme-directory/search/?geodir_search=1&stype=gd_place&spost_category%5B%5D=&s=+&snear=hotel+mark+intercontinental+san+francisco&sgeo_lat=37.7915187&sgeo_lon=-122.41013659999999

    #516014

    Mitch Canton
    Expired Member
    Post count: 167

    Hey Alex,

    Yes, that’s exactly how I figured out to do a specific search link in a button, copying the URL from a previous search.

    But I am trying to make it work as a “Near Me” function, where the geo_lat and geo_lng are determined by the user geolocation.

    Using a “Near Me” shortcode/button generates the geo data, but that seems to drop me in to the ‘Location’ page. How do I create a “Near Me” functionality as part of the URL where I have included “&stype=gd_place&s=pizza&snear=”

    Thanks!

    #516099

    Alex Rollin
    Moderator
    Post count: 27815

    Use the “Near Me” in the Near Search field to create URLs like that:

    https://wpgeo.directory/supreme-directory/search/?geodir_search=1&stype=gd_place&spost_category%5B%5D=&s=pizza&snear=&sgeo_lat=37.78603004429283&sgeo_lon=-122.40912209472663&near=me

    It is not possible to dynamically insert the user location, though. The user will need to submit their own location and search.

    #516181

    Mitch Canton
    Expired Member
    Post count: 167

    If I click on a “near me” button, as created via shortcode GD>Near Me Button “gd_location_near_me”, it drops me into the ‘location’ page

    (that page has the shortcode)
    [gd_map map_type=”auto” zoom=”12″ width=”100%” height=”425px” search_filter=”1″ cat_filter=”0″]
    [gd_search]
    [gd_listings post_limit=8 add_location_filter=’1′]

    which DOES display all markers on map, display limit 8 listed below it that are NEAR ME, and that page has the url = url/location/near/me/actuallat123,actuallng456/

    which THEN if I place the search term in the search box on that Location page, it sends me back to the wpgd-search URL – with the expected listings.

    I finally get the listings I want, but must take multiple steps to get there.

    Why can’t I simply shorten this process? Just be able to add a “&s=pizza” (or coffee, or whatever) search term to what happens when I click the ‘near me’ button?

    Thank you.

    #516211

    Alex Rollin
    Moderator
    Post count: 27815

    That’s what the search bar does, I think, unless I am missing something.

Viewing 8 posts - 1 through 8 (of 8 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket