Help Desk

Custom Filter options?

  • Posts: 35 Topics: 13
    | Permalink

    First off – great to have this plugin launched! I’ve been itching!
    Now.. how much of a ball-ache would it be to add the functionality to be able to add our own filter options? ie If I have events that have atributries of say, distance (like a run) and I want to be able to scale (similar to the “Cost” option)?

    Posts: 4809 Topics: 3 Answers: 6
    | Permalink

    Howdy Christopher!

    We are super excited about it as well. I do appreciate your patience with us this week, half the team celebrated our launch by jetting off to where it is sunny and warm. Hampered our response time a bit.

    While I am not the developer of this addon it looks like the TEC filters have been designed from the ground up with this sort of extensibility in mind. So basically each filter is an instance of the new TribeEventsFilter class. To add a new TEC filter you would want to extend that class. Since it sounds like what you want to do will be similar to cost in a fair amount of ways, check out \the-events-calendar-filterbar\lib\filters\TribeEventsFilter_Cost.php. You might even copy that as your starting point. Keep in mind there will be some differences. For instance, assuming your data is stored as text/string using our Additional Fields then some casting may be in order for your queries.

    Once you have created your TEC filter you would need to attach it. How I would do it is by adding my TEC filter to the tribe_events_all_filters_array. That is WP filter that you can hook into with add_filter. Simply add your TEC filter to the end of that array and return.

    We do not have our documentation up yet. Once we do it is possible that the developers themselves will have outlined even better ways of doing this. But, the above looks easy enough if you do not mind jumping into some PHP.

    Please let me know if you have questions. Thanks!

    – Brook

    Posts: 13 Topics: 6
    | Permalink

    Hello I have some doubts before using this plugins. I haven’t try it yet (I’m not IT) but could you please tell me if this ie. case require intense “code programming” or is possible to simply configuration?
    Case 1_
    I have 3 cities with 10 different neighbour each city. Users will select the City first and I would like that all the neighbours appear in the FILTER BAR. Then users could click any of the 10 neighbours and apply the Slider of distance. Need code-programming? or simply configuration?
    Case 2_
    Ie. User click MUSIC in the firt search, and then I would like that in the FILTER BAR appears all Subcategories of Music, like “FESTIVALS” “CONCERTS” an inside CONCERTS, I would like “Jazz” “Rock” “Soul” is this possible? Requires code-programming? or I could simple configurate from WordPress desktop?
    Case 3_
    Insise “PRICE” I would like to have 4 options, “Free” “from x to x” “No price” and “more than x” Is possible without code programming?
    I hope I have been clear, sorry for my basic english, thank you very much your your answer!

    Posts: 4809 Topics: 3 Answers: 6
    | Permalink

    Howdy eliasgarcia,

    Those are good questions. My apologies for the belated response. Just so you know we tend to have much quicker responses times when a new topic is opened for each unique set of issues.

    1) Requires programming. The biggest thing that will require programming is setting up these neighborhoods, especially if they are not recognized by Google or another Maps API provider. If they are, then you could limit search results to to a neighborhood, then simply modify the distance selector to be a slider instead of a drop down.

    2) How the filterbar is currently setup is pretty awesome. Instead of requiring a user to first select your main category, like music, then the sub, it saves a step. It lists all of your categories and their subcategories using <optgroup>s. If a user is currently viewing a certain category, like music, then it will be selected by default and its children listed underneath. It is very straightforward.

    3) By default cost is a slider, with two slides. You can very easily select a min and max price for your search. If you want to convert this to a text + radio button field instead you certainly could with relative ease. However, to be quite frank from the sound of it this will just make it more difficult to use for your users. We put a lot of thought into the default functionality and it works really well.

    Thanks Elias. If you have more questions or would like to follow up, would you mind opening a new topic? We would be glad to help, but I do not want to spam Christopher’s inbox if we can avoid it. Cheers!

    – Brook

    Posts: 13 Topics: 6
    | Permalink
    This reply has been marked as private.