Support

Home Forums Event Espresso Premium Accessing Event Date Times during Registration Process

Accessing Event Date Times during Registration Process

Posted: March 28, 2017 at 10:27 am


Akseli Olavi Ahopelto

March 28, 2017 at 10:27 am

Hello,
We’ve recently implemented a filter to the registration process that picks up the answer to a custom question and depending on the answer adds a new line-item to the final price of the trip. We heavily customized the ee_apply_transaction_surcharge code available on GitHub.
What I would like to know if it is possible to access the Event’s date-times to calculate the number of days the event lasts and feed this to the apply surcharge filter.
Thank you for your time!


Tony

  • Support Staff

March 28, 2017 at 1:06 pm

Hi there,

What I would like to know if it is possible to access the Event’s date-times to calculate the number of days the event lasts and feed this to the apply surcharge filter.

Do all of your events only use a single datetime?

You can pull the details needed but it depends what you have access to currently as to which way you would do this.

You have an instance of EE_Checkout correct?

You can use that to pull the current transaction, and with that the registrations and/or event, here is an example of pulling the events from an EE_Checkout object:

https://gist.github.com/Pebblo/f4561461339c59411a849f93c91912a9

From there you can use the model system to pull any details from the event that you may need:

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

However you may want to use the Ticket, and pull the datetimes that apply specifically to the ticket the user is registering onto and work it out from that, again it depends on your setup.

If you’d like to post your code within a gist we may have more documentation that may help with the objects you currently have available.

The support post ‘Accessing Event Date Times during Registration Process’ 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