Support

Home Forums Event Espresso Premium Adding venue name to Registration Page

Adding venue name to Registration Page

Posted: April 4, 2017 at 11:04 pm

Viewing 2 reply threads


gazingelement

April 4, 2017 at 11:04 pm

Hi EE Crew,

I’ve created a custom template for the registration page. And I’ve been stuck trying to display the venue name for the registered event.

$checkout = EE_Registry::instance()->SSN->checkout();
if ( $checkout instanceof EE_Checkout ) {
$transaction = $checkout->transaction;
// Get Event Feature Image
$event_name =”;
foreach ( $transaction->registrations() as $registration ) {
if ( $registration instanceof EE_Registration ) {
$event = $registration->event();
if ( $event instanceof EE_Event ) {
$event_id = $event->ID();
$event_name = $event->name();
$feat_img_url = $event->feature_image_url(‘full’);
echo ‘‘;
$venue = $event->venues();
if ( $venue instanceof EE_Venue ) {
$venue_name = $venue->name();
echo $venue_name;
}
break;
}
}
}
}

I was wondering if you could show me how to get the venue name in the registration page.

Thanks very much!


Tony

  • Support Staff

April 5, 2017 at 4:35 am

Hi there,

$venue = $event->venues();

Will not return an instanceof EE_Venue, it will return an array containing a EE_Venue object. (one reason for this is to accommodate for multiple venues on a single event, which isn’t available currently, but could be in the future).

So you need to so something like:

$venues = $event->venues();
$venue = !empty( $venues ) ? array_shift( $venues ) : NULL;

Then $venue will be an instanceof EE_Venue, if there is one assigned to the event, otherwise, NULL.


gazingelement

April 7, 2017 at 5:29 am

Thanks for the in depth explanation, Tony!

It worked nicely!

Viewing 2 reply threads

The support post ‘Adding venue name to Registration Page’ 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