Posted: October 19, 2016 at 7:57 am
|
Hi, I’m running EE4 and using EE_Event_List_Query as the basis for a query which returns upcoming events along with their start and end dates etc – What I’d like to do is to bring the ticket price along with this. My events only have one ticket price, so I’m not worried about multiple prices coming along for the ride.. Any ideas? Thanks! Andrew |
Hi Andrew, One idea is you can adapt some of the code from step 11 of this tutorial: |
|
|
Good idea! Here’s what I’ve used just in case it helps anyone else -it works fine if your event only has one ticket price… <?php thanks Josh, Andrew |
|
Actually I was being a bit premature there – it turns out that it works well as long as 8 events are returned, but after that something breaks and NO more of the page is processed, including include get_footer() and other includes.. thanks, Andrew |
Hi Andrew, The above doesn’t point to anything that would cause this. Have you enabled WP_DEBUG to see if any error is shown when 9 events are shown? Anything different with the 9th event or does it matter which order they are shown with the above snippet? |
|
|
Thanks Tony – you put me on to the right track – it turned out to be a weird bug (or maybe feature!) – The error came when an event’s tickets Sell Until Date had passed… |
Yeah, I see. You’ll want to check you have an EE_Ticket object before attempting to use the object. For example:
espresso_event_tickets_available() only returns available tickets, so if there are none $ticket will == NULL If you try to run a method on NULL it will thrown an error. Anyway, I’m glad you found the problem 🙂 |
|
The support post ‘EE4 – Returning ticket prices in a template’ 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.