Support

Home Forums Event Espresso Premium Adapting custom function for ticket selector

Adapting custom function for ticket selector

Posted: May 18, 2020 at 3:40 pm

Viewing 1 reply thread


Nick

May 18, 2020 at 3:40 pm

Hello,

I have created a custom function for my ticket selector on this page. It clarifies how many tickets are left for an event and whether it is sold out. If an event is sold out it also includes a link to the events list page so the user can see other events coming up that they may like to book for. Instead of linking to the events list page, I would like the link to point to the next event (i.e. ordered by date) in the same event category. So, the text would say “Details of our next seminar can be found HERE”, with the link pointing to a single event page. Is it possible to adapt my function to achieve this and, if so, what would the additional function/code look like?

Secondly, I would like to add some text to the form if an event is sold out and there is a waiting list (in addition to the wait list button). Is there a way of checking to see if there is a waiting list with places still available in the function?

Thanks,

Nick


Tony

  • Support Staff

May 19, 2020 at 7:42 am

Hi Nick,

Is it possible to adapt my function to achieve this and, if so, what would the additional function/code look like?

In short, most likely yes but I haven’t seen your code so I can’t say for sure.

You can use our models to do what you need and we have documentation on using those here:

https://github.com/eventespresso/event-espresso-core/tree/master/docs/G–Model-System

The EE4 Upcoming events widget has a slightly similar example of what you need to do HERE only you’ll be basing your code on DTT_EVT_start and can use get_one() to pull a single event rather than all.

Secondly, I would like to add some text to the form if an event is sold out and there is a waiting list (in addition to the wait list button). Is there a way of checking to see if there is a waiting list with places still available in the function?

Yes, but we don’t have a public method you can just run to check.

Take a look at how the \eea-wait-lists\domain\services\event\WaitListMonitor::eventHasOpenWaitList() method checks for available waitlist spaces. You’ll basically need to duplicate that check to do what you are requesting.

Viewing 1 reply thread

The support post ‘Adapting custom function for ticket selector’ 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