Support

Home Forums Event Espresso Premium EE4 – Event Tables – Add dynamic filter to show/hide tickets Solde Out / Expired

EE4 – Event Tables – Add dynamic filter to show/hide tickets Solde Out / Expired

Posted: November 29, 2016 at 4:51 am

Viewing 2 reply threads


JacquesMivi

November 29, 2016 at 4:51 am

Hello,

On my custom template “espresso-events-table-template” of your last version of “eea-events-table-view-template” I want to add an option (radio buton for example) to show/hide expired tickets/Sold out tickets/Running TIckets.

By default I wish to hide this tickets. Is it possible ? How can I do this ?

If I can’t can I by default hide this tickets ?

Thanks for your help.


Josh

  • Support Staff

November 29, 2016 at 2:58 pm

Hi there,

This will require some custom coding on your part. One example of some of the code you could add would be to add a “sold-out” class to the markup, which could then be used as a “hook” for some jQuery (like the .toggle() method) to target to hide/show with your custom button controls.

So for example, in your template, there’s already this logic for checking for a sold out event:

if ( $event->is_sold_out() || $event->is_sold_out(TRUE ) ) {
$live_button	= '<a id="a_register_link-'.$post->ID.'" class="a_register_link_sold_out a_register_link" href="'.$registration_url.'">'.$sold_out_button_text.'</a>';
}

You can make use of that existing logic to add a sold-out class to the markup by making the following changes to the above:

$sold_out_class = '';
if ( $event->is_sold_out() || $event->is_sold_out(TRUE ) ) {
$live_button	= '<a id="a_register_link-'.$post->ID.'"   class="a_register_link_sold_out a_register_link" href="'.$registration_url.'">'.$sold_out_button_text.'</a>';
$sold_out_class = 'sold-out';
}

Then later in the part of the template that outputs the table row, it has this:

<tr class="espresso-table-row <?php echo $category_slugs; ?>">
You can change it to be:
<tr class="espresso-table-row <?php echo $category_slugs; echo ' ' . $sold_out_class; ?>">


JacquesMivi

November 30, 2016 at 2:57 pm

Perfect,

I just have added this input in template :
<input id="toggler" type="checkbox" style="margin:5px;"/><i>Montrer les ateliers complets</i><br>

And this code in Javascript

$(".sold-out").css("display", "none"); 
$('#toggler').click(function() {
$(".sold-out").toggle();
});
Viewing 2 reply threads

The support post ‘EE4 – Event Tables – Add dynamic filter to show/hide tickets Solde Out / Expired’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso