Reset Filters on Filterbar when doing a search

Home Forums Calendar Products Events Calendar PRO Reset Filters on Filterbar when doing a search

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1006752
    David
    Participant

    Hi there,
    Is it possible to reset the active filter-settings in the filterbar, when doing a search for a term in the event bar?
    For example if you hit the “search” button, all the category and price-filter settings are deactivated.
    I am afraid that some visitors are doing a search with active filters and the search term won’t be found then?
    So I was wondering if there would be a simple function or hook etc.?
    Sincerely,
    David

    #1007064
    Barry
    Member

    Hi David,

    This is by design and, unfortunately, I don’t see any terribly easy ways of implementing this cleanly.

    It’s definitely possible we might consider making a change to facilitate this, however, so I’d love to hear a little more about how you envision this working.

    If the visitor has checked various filters, would they remain checked when they perform a search (even if they are ignored) – or be wiped? Would you need to maintain an avenue for visitors to search filtered results, or would that not be a concern in your case?

    Thanks!

    #1009180
    David
    Participant

    Hi Barry!
    I think it would be great to have a visual notification or something which is informing the user about active Filters when searching for a term. I did a usability test and the user had to find a certain event. First he started to use the filter. After there were too many result, the user did a search by “term”. The event didn’t show up, because it was in a different category. As the filters were chosen by a dropdown menu, there is no visual confirmation that after doing a search by term, they are still activating. So my idea was wether resetting the filters when performing the search or notifying the user about the filters still being active.
    I know that in the first place the categories should be more specific to prevent this scenario happening.
    I hope I made my request a little bit more clear to you!
    Cheers,
    David

    #1009315
    Barry
    Member

    Thanks, David – that definitely provides a little more insight.

    So let’s say you want to provide a stronger indication to the user that one or more filters have been applied (following a search). You might use some logic like this to trigger that alert:

    if ( is_search() && tribe_is_filtered_request() ) { /* ... */ }

    There is no such helper function as tribe_is_filtered_request(), however, so you’d need to build this yourself. Right at this time each filter exists as an anonymous object so trying to obtain information from those objects – such as if they are filtering the query or not – is tricky at best.

    Even so, we can look at other variables which are accessible to us and make a pretty good informed guess about which if any filters have been applied.

    Here are the different “filter slugs” used by default:

    • eventcategory
    • cost
    • tags
    • venues
    • organizers
    • dayofweek
    • timeofday

    When a visitor tries to apply these, a new query parameter is added to the URL, in the form tribe_SLUG=xxx. You can use this to try and detect if a filter has been added by looking at the keys of the $_REQUEST or $_GET variables.

    Combining this with a little theming work would allow you to put together a suitable alert making it as clear as possible to the user that their search results are subject to a number of still-applied filters.

    You could also effectively “disable” the filters by testing to see if they are set during a search, just like we covered, but instead of displaying an alert you could perform a redirect back to the same page (but with the relevant parameters removed from the URL query).

    I appreciate this all sounds a little complicated and we’ll certainly consider some changes to make things more customizable going forward.

    #1014078
    Support Droid
    Keymaster

    This topic has not been active for quite some time and will now be closed.

    If you still need assistance please simply open a new topic (linking to this one if necessary)
    and one of the team will be only too happy to help.

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Reset Filters on Filterbar when doing a search’ is closed to new replies.