Support

Home Forums Event Espresso Premium EE_Event->tickets() not setup

EE_Event->tickets() not setup

Posted: June 9, 2014 at 12:42 pm


Jamie Grisdale

June 9, 2014 at 12:42 pm

Hi, I’m trying to get ticket prices as per this post.

However the tickets() function is not actually setup. There’s no direct relationship between events and tickets only datetimes and tickets.

Here’s the error:

Uncaught exception 'EE_Error' with message 'Cannot get Ticket related to EE_Event. There is no model relation of that type. There is, however, Registration, Datetime, Question_Group, Venue, Term_Taxonomy, Promotion_Object, Message_Template_Group, Extra_Meta...'

EE4 latest, WP latest etc. Thanks.


Jamie Grisdale

June 10, 2014 at 4:51 am

Any thoughts? Can you tell me how to retrieve prices in EE4? I found lots of functions but everything is protected…


Jamie Grisdale

June 10, 2014 at 5:10 pm

Any particular reason why both my posts on this forum are being ignored? I’ve tried to be pretty specific about the issues. Most posts before and after have been responded to.


Sidney Harrell

June 10, 2014 at 5:18 pm

I did this:

$events = get_posts(array("post_type"=>'espresso_events'));
							//var_dump($events);
							foreach ($events as $event) {
								if ( !empty( $event->EE_Event ) ) {
									$datetimes = $event->EE_Event->datetimes_ordered();
									//var_dump($datetimes);
									foreach($datetimes as $datetime) {
										$tickets = $datetime->tickets();
										var_dump($tickets);
									}
								}
							}


Jamie Grisdale

June 11, 2014 at 2:43 am

Right, that returns the EE_Ticket object but as I said all of the values are protected or private. Relevant values:
`object(EE_Ticket)#2277 (30) {

[“_props_n_values_provided_in_constructor”:”EE_Base_Class”:private]=>array(18) {

[“TKT_price”]=>string(6) “20.000”

}

}


Sidney Harrell

June 11, 2014 at 1:31 pm

The ticket objects should have all the public methods on them listed here: http://code.eventespresso.com/classes/EE_Ticket.html

The ones at the top left of the list with the green check next to it. From new_instance() down to get_extra_meta().


Jamie Grisdale

June 12, 2014 at 1:14 am

Wow that’s really helpful I’ve been looking through the docs on this site but I didn’t come across any of that. Probably answers my other question too.

Thanks.

The support post ‘EE_Event->tickets() not setup’ 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