• Resolved tobiasholm

    (@tobiasholm)


    Hi! Great job with the Store Locator plugin!

    I was wondering if it is possible to filter/sort the stores by more factors than location and one category? Ideally, I want to sort the stores by the following:
    – Location (ex. “what’s closest?”)
    – Price range (ex. $1-100, $100-200, $200-300)
    – Store type (ex. Furniture shop, Electronics, Grocery stores)
    – Product type (phone, TV, PC)

    And then it would be really awesome, if I could combine the filters (ex. “The closest electronics store that sells phones for a price under $100-200”)

    If this is possible, how can I implement it? Sorry if this post already exists – I’ve looked through the topics and have not found anything related..

    Hope to hear from you soon! Thanks!

    https://wordpress.org/plugins/wp-store-locator/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Tijmen Smit

    (@tijmensmit)

    This isn’t possible without making several modifications to the code yourself.

    The first thing you need to do when you want to add additional filters is create a custom template, if you look at the code use in the create_category_filter then you can replicate that code, and use it for other dropdowns.

    The main issue is including them in the AJAX data. If you open the wpsl-gmap.js ( wpsl-gmap.min.js is used on the frontend ) and search for ‘function makeAjaxRequest‘ then you will see the ajaxData object, this holds the params for the AJAX request, so you need to include the custom dropdown values there.

    In the 2.2 update values from custom dropdowns are automatically included in the AJAX

    You can modify the sql query, and used placeholders with the https://wpstorelocator.co/document/wpsl_sql/ and https://wpstorelocator.co/document/wpsl_sql_placeholder_values/ filters to make sure all the custom filters are used to sort the data.

    So it’s possible, but will require some custom code.

    Tijmen Smit do you have a walkthrough for doing this? I’m definately need to implement for a few different filters but I’m not that well versed… With some good instruction I think I could figure it out.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to filter stores by more than location – price range, store type, product’ is closed to new replies.