Support

Home Forums Event Espresso Premium EE4 – Get Next tickets – Number of datetimes and number of hours

EE4 – Get Next tickets – Number of datetimes and number of hours

Posted: April 3, 2017 at 2:58 am

Viewing 3 reply threads


JacquesMivi

April 3, 2017 at 2:58 am

Hello,

I’m working to a new presentation of the events, and I need some helps.

1) How can I have the next ticket available ?
I know how to have the next datimes, but how to get the related ticket from it ?

$datetime_next = EEM_Datetime::instance()->get_datetimes_for_event_ordered_by_start_time( $post->ID, false, false, 1 );

2) If is not available, How can I have the last tickets available ?
I would use the same logic that the first point.

3) For the next or the last tickets, how can I have the number of datetimes and number of hours by datetime ?

Have you something like that in your example ?


Tony

  • Support Staff

April 4, 2017 at 6:19 am

Hi there,

I highly recommend using Kint Debugger to find the methods available on the objects you have.

For example you have the datetime object already, if you install the above and wrap $datetime_next within d(), like so d($datetime_next); you’ll have a nice output with all of the available methods on $datetime_next

To pull the tickets from a datetime you use the tickets() method on that datetime:

$tickets = $datetime_next->tickets()

or

$tickets = $datetime_next->ticket_types_available_for_purchase()

3) For the next or the last tickets, how can I have the number of datetimes and number of hours by datetime ?

I’m not sure what you mean here, again run the objects through kint to find the available methods and see what info you can pull from there.

The number of hours by datetime? You mean the time between Event Start and Event End on the datetime? Use the length('hours') method on the datetime.


JacquesMivi

April 5, 2017 at 8:28 am

Thanks for this advices I will do that.

If I dont have futur datetime I would get the lastdatetime available, do you have a methode for that ?


Tony

  • Support Staff

April 5, 2017 at 8:33 am

Take a look within the EEH_Event_View.helper.php file, there should be a method for what you need in there.

Viewing 3 reply threads

The support post ‘EE4 – Get Next tickets – Number of datetimes and number of hours’ 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