Support

Home Forums Event Espresso Premium EE4 Ticket Status: "sold_out" overrides "expired"

EE4 Ticket Status: "sold_out" overrides "expired"

Posted: July 28, 2014 at 11:12 am

Viewing 9 reply threads


Paul Doyle

July 28, 2014 at 11:12 am

I have a version of ticket_selector_chart.template.php in my theme folder. Tickets with status == expired are not displayed… which works great! … But as I’m now getting tickets which are status == “sold out” it is now displaying sold out tickets that have expired. I’m fine with sold out tickets for furute events displaying, just not ones in the past. Is there a way to check if a sold out ticket has expired? is there a function similar to $ticket->ticket_status(); I can use to test the end date?


Lorenzo Orlando Caum

  • Support Staff

July 28, 2014 at 1:54 pm

Hi Paul,

Would hiding a sold out ticket work for you?


Lorenzo


Paul Doyle

July 28, 2014 at 2:03 pm

Hi Lorenzo,

No, unfortunately that’s not the preferred option. All expired tickets should not be displayed as I using EE4 for 6 and 8 week courses with lots of datetimes and tickets. Here’s a page with the issue I’m having… I don’t want to show last week’s class…

http://www.pregnancyclasses.ie/events/pregnancy-yogalates-thursday-afternoon-july-2014/


Paul Doyle

July 28, 2014 at 2:07 pm

I should add … if the class is not sold out then the ticket status is “expired” and doesn’t display, It’s only an issue for classes that have been fully booked. As this page does…


Paul Doyle

July 28, 2014 at 2:08 pm

Sorry forgot link …
http://www.pregnancyclasses.ie/events/pregnancy-yogalates-thursday-evening-july-2014/


Lorenzo Orlando Caum

  • Support Staff

July 28, 2014 at 2:12 pm

So you would like to remove the week 1 class?

Are you wanting to remove anything else on that page?

Could you also share another event that is structured in a similar manner?


Lorenzo


Paul Doyle

July 28, 2014 at 2:26 pm

Yes and the “Book Full Course” as that is no longer available after the first class commences. I’m not looking for a css solution here. I’m just hoping I can add a conditional line to test the “end date” in the switch case EE_Ticket::sold_out :


Dean

July 29, 2014 at 12:55 am

Hi Paul,

Hopefully I have understood your question here. To clarify, you want expired tickets to not show and fully booked tickets that have expired to also not show, while making sure normal tickets and fully booked (in the future) tickets still show?

If that’s correct my solution would be this:

https://gist.github.com/Apina/3877630a7d58cc4c3569

  • This reply was modified 10 years, 4 months ago by Dean. Reason: changed from code in forum post to Gist


Paul Doyle

July 29, 2014 at 2:29 am

Hi Dean,

Brilliant! Thanks (yet again) for a great solution. I applied it a little differently as I’m also not displaying pending tickets.

For all tickets I don’t want displayed I set $status_class = ”; within the switch block. Then test if(!$status_class = ”) at the start of the next section where the tickets are displayed. So it was neater for me to place

$cur_date = strtotime(date(‘Y-m-d H:i:s’)); //current date
$evt_end_date = strtotime( $ticket->end_date() ); //ticket end date
if($evt_end_date > $cur_date) {
$status_class = ‘ticket-sales-sold-out lt-grey-text’; // not expired
} else {
$status_class = ”; // expired
}

inside

case EE_Ticket::sold_out :

Works perfectly. Thanks again!


Dean

July 29, 2014 at 2:44 am

No problem and thanks for sharing your solution. I will mark this thread as resolved. If you want to take this further, please start a new forum thread and reference this one. Thanks!

Viewing 9 reply threads

The support post ‘EE4 Ticket Status: "sold_out" overrides "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