Support

Home Forums Event Espresso Premium Displaying spaces available on Events Table View

Displaying spaces available on Events Table View

Posted: February 19, 2018 at 5:41 am

Viewing 4 reply threads


cvg

February 19, 2018 at 5:41 am

I have a single date set up for my events and primarily use the Event Table View plugin to display the events for a category.

What I’d like to be able to do is within the table display, show the number of available spaces for an event within the listing.

I’ve read through the support posts and the nearest one to this is this one, could this be integrated into the table view as it’d be a valuable piece of information to include in the listings without the requirement of clicking on the actual event registration to see available via the quantity dropdown.

Using EE4 along with the Events Table View.


Josh

  • Support Staff

February 19, 2018 at 3:57 pm

Hi cvg,

You can use this example code for the part that outputs the actual “spaces available” text:

https://gist.github.com/joshfeck/f19c050bc47682ff30b62202cfcde9d8

You’ll also need to add an html column heading and column to the event table view template. This is best done by copying the template from the plugin and putting the copy into your WordPress theme. If your theme gets updates, it’s best to set up a child theme. The documentation has more specific instructions on how to set up your custom template file:

https://eventespresso.com/wiki/events-table-view-template-add-on/#customizations


cvg

February 21, 2018 at 3:33 am

Thanks Josh,
Although that didn’t quite work when I popped that into the loop on the table, after a bit of tweaking, I got it working to my requirement.

I rem’d out the if ( $datetime->sold_out() ) and the if ( $limit == EE_INF ) {
As the results were only displaying the ‘A lot available’ statement and just used the $remain as the condition, ie.

if( $remain > 4 ) {
$remaintext = ‘> 4‘;
} else {
$remaintext = $remain .’ left’;
}

That shouldn’t present any problems for a single date event should it? Seems to work ok for now.


Tony

  • Support Staff

February 21, 2018 at 6:43 am

I rem’d out the if ( $datetime->sold_out() ) and the if ( $limit == EE_INF ) {
As the results were only displaying the ‘A lot available’ statement

Do you not have a ‘limit’ set on the datetime of the event? If so that’s why.

That shouldn’t present any problems for a single date event should it?

No, it shouldn’t.

$remain is created using $datetime->spaces_remaining( true ); which takes into consideration the tickets on a datetime and the limit values set on those.

So as long as you have a limit on your ticket(s) it should work fine.


cvg

February 21, 2018 at 3:36 pm

Cheers Josh,
Very useful snippet that. Thanks for the advice.

Viewing 4 reply threads

The support post ‘Displaying spaces available on Events Table View’ 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