Support

Home Forums Event Espresso Premium Missing Events in Events Table

Missing Events in Events Table

Posted: October 11, 2018 at 7:45 pm

Viewing 10 reply threads


baystate

October 11, 2018 at 7:45 pm

Hi,
This is related to this thread:
https://eventespresso.com/topic/event-table-hide-events-with-no-tickets-on-sale/

I input that code (below) and it worked great! Any event sold out or upcoming (without tickets on sale) was hidden.However, we have noticed to events that are not showing. Both these events have tickets for sale and from everything I can see have the same settings as the events that are displaying. If I take the code out then these events appear (along with sold out and upcoming without tickets on sale).
The two events are Quincy and Weymouth, there is a link to each below, you can see there is an option to purchase tickets. Any idea what may be causing this? Happy to provide credentials if you would like to see the admin.

Thank you!

Events Table:
https://baystateskatingschool.org/classes/register/

Quincy:
https://baystateskatingschool.org/class/city-season-lesson-6/

Weymouth:
https://baystateskatingschool.org/class/west-roxbury-sunday-session-i/

Code:
// Added to hide sold outs ========
if ( $event->is_sold_out() || $event->is_sold_out(TRUE ) ) {
continue;
}
//If the event does not have tickets on sale, do not show
if( !$event->tickets_on_sale() ) {
continue;
}

Added right below:
//Get the category for this event
$event = EEH_Event_View::get_event();


Josh

  • Support Staff

October 11, 2018 at 7:51 pm

Hi,

if ( $event->is_sold_out() || $event->is_sold_out(TRUE ) ) {

needs to be changed to be:

if ( $event->is_sold_out() ) {


baystate

October 12, 2018 at 12:21 am

Hi Josh,
Thank you, made that change, but still same results as before.


Tony

  • Support Staff

October 12, 2018 at 3:12 am

If I take the code out then these events appear (along with sold out and upcoming without tickets on sale).

So you are removing both blocks of code at once?

Try removing each one individually to see which condition is causing the problem.

You can just comment out the continue on each one, for example:

// Added to hide sold outs ========
if ( $event->is_sold_out() ) {
    //continue;
}
//If the event does not have tickets on sale, do not show
if( !$event->tickets_on_sale() ) {
    continue;
}

Retest to see if it’s the sold out check causing the problem. Then:

// Added to hide sold outs ========
if ( $event->is_sold_out() ) {
    continue;
}
//If the event does not have tickets on sale, do not show
if( !$event->tickets_on_sale() ) {
    //continue;
}

Retest to see if it’s the tickets on sale check.


baystate

October 12, 2018 at 8:13 am

It is the Tickets on sale that appears to be causing the problem:
//If the event does not have tickets on sale, do not show
if( !$event->tickets_on_sale() ) {
continue;
}

When I remove sold out the problem still exists, removing on sale but leaving sold out brings that two events back.
Any ideas on why that would be? And/or is there another function I can use to hide events that do not have tickets on sale?

Thank you


Tony

  • Support Staff

October 12, 2018 at 8:45 am

That’s strange.

Can you add a screenshot of your datetime and ticket editor within the event, please?

https://eventespresso.com/wiki/troubleshooting-checklist/#screenshots


baystate

October 12, 2018 at 9:00 am

Below is a screenshot of the Weymouth event. Also, I noticed that changing the sold out code to Josh’s suggestion above did not remove sold out, I had to change it back to:
if ( $event->is_sold_out() || $event->is_sold_out(TRUE ) ) {

https://baystateskatingschool.org/wp-content/uploads/2018/10/weymouth.jpg

Thank you


Josh

  • Support Staff

October 12, 2018 at 9:32 am

Two things:

The tickets_on_sale() isn’t going to work well for your site because your site has events with tickets past their sale date, currently on sale, and not on sale yet. So instead of adding a check for tickets_on_sale() directly into your template, you can add this code to a functions plugin or the theme’s functions.php file:

https://github.com/eventespresso/ee-code-snippet-library/blob/master/templates/de_ee_filter_events_out_with_expired_tickets.php

and that will take care of removing any events that do not have tickets on sale at this moment. Without removing anything unexpected.

If you’re not sure how to set up a custom functions plugin, we have a guide here:
https://eventespresso.com/wiki/create-site-specific-plugin-wordpress-site/

With regards to the sold out check, we recommend not adding the $event->is_sold_out(TRUE ) part because it will significantly slow your site down. At one point the plugin had that check and there were sites that had issues with timing out and were just overall slower.


baystate

October 12, 2018 at 10:54 am

Thanks Josh, I removed all the changes from the events table template and added the function above to my custom functions. That is hiding the sold out events (perfect!), but the upcoming events are still showing. I put a test event in with tickets on sale in the future and it is showing currently on the table view, how can we hide this? Thanks again!

Table view:
https://bsss.staging.wpengine.com/classes/register/

Screenshot of the test event setup:
https://bsss.staging.wpengine.com/wp-content/uploads/2018/10/test.jpg


Josh

  • Support Staff

October 12, 2018 at 12:54 pm

OK, you can use this code instead:

https://gist.github.com/joshfeck/7d419c1f12a0ec1c8b6153931521e89e


baystate

October 12, 2018 at 4:21 pm

Awesome! Works great, thanks so much for all the help Josh!

Viewing 10 reply threads

The support post ‘Missing Events in Events Table’ 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