Support

Home Forums Event Espresso Premium Adding a Back Button to the Thank You page

Adding a Back Button to the Thank You page

Posted: April 1, 2016 at 12:33 pm


eddy@mibeachclub.com

April 1, 2016 at 12:33 pm

My client has a large number of weekly events and their members may want to register for multiple weeks at a time. I had explored the multiple registration add on but discovered this is not compatible with the event table add-on we are using.

So our workaround is to add a back button from the Thank You page, back to the page where our event tables are listed. My only idea on how to do this, would be to query the event category, and then based on the category, add a link to that page.

How would I get an event’s category slug on the Thank You page?

Also, any other ideas on how to achieve this end result are welcome… this was the only thing I could come up with.


Josh

  • Support Staff

April 1, 2016 at 12:48 pm

We do not recommend adding a back button to the Thank You page because this can result in overwriting the previous registration (because they’re all happening in the same session).

If you want to allow for registration of multiple events in one order, the Multi Event Registration add-on is really the only way to do this. I can suggest converting the event archive template into an html table. This way you’ll be able to view the events as a table, and add each of them to the cart.


eddy@mibeachclub.com

April 1, 2016 at 4:04 pm

I think with the multi event add on it would show the ticket selector for each event on the same page, correct? This client has over 150+ events so what they’d like is to have a table without any ticket selector, just the registration button to keep the page more simple. From what I understand, this is not possible with the Multi Registration Add On?

The Back button wouldn’t be going back into your browser history, it would just be a link back to the page they started on. If I can grab the event category, I can drop in the proper link. With the session issue, are you saying that even if they were to navigate back to the main events page and register for another event, this could overwrite their previous registration? In my testing, I did not find this to be an issue but am now wondering if I should be concerned.

Thanks


Josh

  • Support Staff

April 1, 2016 at 4:20 pm

You’re not really asking for a back button then, it’s more of a link to the category archive of events they started from. Which by the way the session should reset if they’re on a bona-fide event archive.

One way to grab the event archive from the checkout is pull it from the checkout object. Some example code follows:

$events = array();
$checkout = EE_Registry::instance()->SSN->checkout();
if ( $checkout instanceof EE_Checkout ) {
    $transaction = $checkout->transaction;
    if ( $transaction instanceof EE_Transaction ) {
        foreach ( $transaction->registrations() as $registration ) {
            if ( $registration instanceof EE_Registration ) {
                $event = $registration->event();
                if ( $event instanceof EE_Event ) {
                    $events[ $event->ID() ] = $event;
                    $category = $event->first_event_category();
                    if ( $category instanceof EE_Term ) {
                        $category_slug = $category->slug();
                        $categories[] = $category_slug;
                    }
                }
            }
        }   
    }
}
return $categories;


eddy@mibeachclub.com

April 1, 2016 at 5:55 pm

Thank you! You’re right, I wrote that in a confusing way. The text will say “Back to xxx” but it’s not really a back button. Which template would I add this on? Would it go here: thank-you-page-transaction-details.template.php ?

I’m trying to get the category on the Thank You page, not checkout page, btw.


Josh

  • Support Staff

April 2, 2016 at 10:04 am

You generally can avoid editing templates if you put the code in a functions.php file (like in your theme’s functions.php file) and use an action hook. Here’s a more specific example that uses an action hook:


eddy@mibeachclub.com

April 4, 2016 at 5:51 pm

Thanks so much! And thank you for the tip on Action Hooks… I’m still learning to use those.


Tony

  • Support Staff

April 5, 2016 at 4:11 am

Event Espresso is full of hooks, both action hooks (prefixed AHEE_) and filter hooks (prefixed FHEE_).

Using hooks is the best method to add/alter functionality to EE.

WordPress is heavily focused around hooks, learn to love them, it will make work so much easier for yourself the more you use them 🙂

A good guide on hooks is available here:

https://www.smashingmagazine.com/2011/10/definitive-guide-wordpress-hooks/


eddy@mibeachclub.com

April 5, 2016 at 2:35 pm

Thank you, Tony!


Tony

  • Support Staff

April 5, 2016 at 2:43 pm

You’re most welcome 🙂

The support post ‘Adding a Back Button to the Thank You 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.

Support forum for Event Espresso 3 and Event Espresso 4.
Documentation for EE3 and EE4
Documentation for Event Espresso 3

Documentation for Event Espresso 4

Status: closed

Updated by  Tony 3 years, 2 months ago ago

Topic Tags

Notifications

This topic is: not resolved
Do NOT follow this link or you will be banned from the site!