Support

Home Forums Event Espresso Premium Ticket selector showing tickets that are not available

Ticket selector showing tickets that are not available

Posted: October 23, 2018 at 6:23 pm

Viewing 7 reply threads


lupineart

October 23, 2018 at 6:23 pm

Hey guys,

I believe that one of my tickets shouldn’t be showing up, as it’s not yet available.

This is the event: https://lupineart.com/events/acrylic-painting-2-value-rythm-john-piper/

This is a screenshot of the tickets: https://www.dropbox.com/s/ke6md5oto1kfaj6/Screenshot%202018-10-23%2017.19.54.png?dl=0

I believe that as soon as this ticket Advance Pricing 6pm-8pm - Goes to $185 Nov 1 (5 Classes) (1 left...) went sold out, then both that listed as sold out (as it should), but also this one appeared:

Paint with us 6pm-8pm (5 Classes)

The Paint with us 6pm-8pm (5 Classes) shouldn’t show until Nov 1 when it becomes available.

I increased the allowable capacity for those datetimes to make it not sold out, then the Paint with us 6pm-8pm (5 Classes) ticket went hidden again, as it should.

https://www.dropbox.com/s/fny7n1ohrc2hoxn/Screenshot%202018-10-23%2017.23.53.png?dl=0

Can you help me hide the ticket that hasn’t become available yet, even if those datetimes are sold out?

Thanks,

Derek


Tony

  • Support Staff

October 24, 2018 at 4:45 am

Hi Derek,

That’s odd, what kind of datetime setup do you have here?

I’m assuming that’s 2 datetimes and the first 2 tickets are for datetime 1 and the other 2 for datetime 2?


lupineart

October 24, 2018 at 11:36 am

Hi Tony,

Sort of correct, same principle.

There are 10 datetimes with 5 assigned to 2 of each of the tickets (evening and morning classes). All datetimes have a limit of 12. The tickets also have a limit of 12 each.

https://www.dropbox.com/s/x00x6nty8p5egal/Screenshot%202018-10-24%2010.31.08.png?dl=0

https://www.dropbox.com/s/rysbvpu3ot9lryq/Screenshot%202018-10-24%2010.31.13.png?dl=0

Perhaps this isn’t new, come to think of it, I’m not sure if we have sold out datetimes before the 2nd (later) ticket became available – I’m not sure.

At any rate, I suppose it’s not a big deal. Ideally I would like only the available tickets show, based on their available dates, even if they are sold out. So I’d like it to show this ticket only:

Advance Pricing 6pm-8pm - Goes to $185 Nov 1 (5 Classes) (1 left...)

Easy to implement? If not, let’s not worry about it – I can just go in and manually mess around with the tickets as this comes up (i.e. delete the 2nd/later ticket or change the dates to an earlier date to hide the first one).

Thanks, Derek


Josh

  • Support Staff

October 24, 2018 at 1:01 pm

You could add the following to your custom stylesheet (CSS) :

.ticket-sales-sold-out {
display: none;
}


lupineart

October 24, 2018 at 1:27 pm

Unfortunately, I think that will remove all ‘sold-out’ tickets, will it not?

I just want the ones that are unavailable based on set availability to be hidden.

Thanks, Derek


Josh

  • Support Staff

October 24, 2018 at 1:31 pm

Technically sold out tickets aren’t available, maybe you can explain what you mean by “unavailable based on set availability”?


lupineart

October 24, 2018 at 1:48 pm

I have 2 tickets for each set of date times. When one becomes unavailable (per availability dates set for each ticket), the other becomes available at the same time. It’s a less expensive ticket purchased before a certain date. So for example on Nov 1, the early priced ticket will expire and the regular price ticket will become available.

Currently, the ones that are not ‘on sale’ yet are hidden, unless sold out, as the topic of this thread.

However, as the earlier ticket sold out, EE is showing both tickets as sold out even though the 2nd one is not available per the dates set in the ticket. I would prefer it only showed the one that is available (per date) now, not the one that comes available Nov 1.

I just remembered how this was done and used this code provided:

/**
 * The purpose of this snippet is to filter the event archive (and event taxonomy archive) pages so that they exclude events
 * that have tickets no longer on sale.
 *
 *  NOTE: This query is only valid for Event Espresso 4.8+
 *
 * To Implement this code, add it to the bottom of your themes functions.php file, or add it to a site specific plugin.
 *
 */
function de_ee_tweak_event_list_exclude_ticket_expired_events_where( $SQL, WP_Query $wp_query ) {
	if ( isset( $wp_query->query_vars['post_type'] ) && ( $wp_query->query_vars['post_type'] == 'espresso_events'  || ( is_array( $wp_query->query_vars['post_type'] ) && in_array( 'espresso_events', $wp_query->query_vars['post_type'] ) ) ) && ! $wp_query->is_singular ) {
		$SQL .= ' AND Ticket.TKT_end_date > "' . current_time( 'mysql', true ) . '" AND Ticket.TKT_deleted=0';
	}
	return $SQL;
}
add_filter( 'posts_where', 'de_ee_tweak_event_list_exclude_ticket_expired_events_where', 15, 2 );
function de_ee_tweak_event_list_exclude_ticket_expired_events_join( $SQL, $wp_query ) {
	if ( isset( $wp_query->query_vars['post_type'] ) && ( $wp_query->query_vars['post_type'] == 'espresso_events'  || ( is_array( $wp_query->query_vars['post_type'] ) && in_array( 'espresso_events', $wp_query->query_vars['post_type'] ) ) ) && ! $wp_query->is_singular ) {
		if ( ! $wp_query->is_espresso_event_archive && ! $wp_query->is_espresso_event_taxonomy  ) {
			$SQL .= ' INNER JOIN ' . EEM_Datetime::instance()->table() . ' ON ( ' . EEM_Event::instance()->table() . '.ID = ' . EEM_Datetime::instance()->table() . '.' . EEM_Event::instance()->primary_key_name() . ' ) ';
		}
		$SQL .= ' INNER JOIN ' . EEM_Datetime_Ticket::instance()->table() . ' AS Datetime_Ticket ON ( Datetime_Ticket.DTT_ID=' . EEM_Datetime::instance()->table() . '.' . EEM_Datetime::instance()->primary_key_name() . ' ) INNER JOIN ' . EEM_Ticket::instance()->table()  . ' AS Ticket ON ( Datetime_Ticket.TKT_ID=Ticket.' . EEM_Ticket::instance()->primary_key_name() . ' ) ';
	}
	return $SQL;
}
add_filter( 'posts_join', 'de_ee_tweak_event_list_exclude_ticket_expired_events_join', 3, 2 );

As mentioned, if it’s a pain, then I can work around it another way.

Thanks,

Derek


Josh

  • Support Staff

October 24, 2018 at 2:31 pm

However, as the earlier ticket sold out, EE is showing both tickets as sold out even though the 2nd one is not available per the dates set in the ticket.

And that’s why it’s showing, because it’s technically sold out because the related ticket for the same datetime is sold out. You can’t sell more tickets than the limit (because the limit is reached). So the ticket is no longer “pending”.

I would prefer it only showed the one that is available (per date) now, not the one that comes available Nov 1.

The ticket that has a sale start date of Nov. 1 isn’t going to be available if the related datetime has reached its limit.

Viewing 7 reply threads

The support post ‘Ticket selector showing tickets that are not available’ 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