Support

Home Forums Event Espresso Premium timer to prevent overselling

timer to prevent overselling

Posted: June 5, 2015 at 9:23 am

Viewing 5 reply threads


Michael

June 5, 2015 at 9:23 am

Hi, I’m exploring ways of putting a redirect timer on pages to try to prevent overselling that can occur when two customers register at approximately the same time.

In order to test this out, I would like to know when EE checks its ticket inventory. For example, can I put a timer on the event page, the registration page, the billing info page?

At what point does the last inventory check occur? If I put the timer after the last check, then it won’t do me any good!

Thanks


Michael

June 5, 2015 at 9:24 am

To be clear, I will be redirecting users back to either the event page, or the event list page, after a set amount of time.


Josh

  • Support Staff

June 9, 2015 at 8:20 am

Hi Michael,

You can look in the EE core plugin for usage of the is_sold_out() method to see the places where it checks for whether the event is sold out.

Along with that, it turns out there is already a built in timer that starts counting down when a registration begins. It begins the moment that a ticket selection is submitted and redirected to the registration form page.

You can set the countdown timer to display on the registation checkout page by adding the following code to your theme’s functions.php file or into a custom snippets plugin.

add_filter( 'FHEE__registration_page_wrapper_template__display_time_limit', 'ee_display_countdown_timer' );

function ee_display_countdown_timer() {
    return TRUE;
}

The default time limit is 60 minutes. You can change the time by using a filter hook. For example, the following will change the limit to 30 minutes:

add_filter( 'FHEE__EE_Session__construct___lifespan', 'ee_change_reg_time_limit' );

function ee_change_reg_time_limit() {
    return 30 * MINUTE_IN_SECONDS;
}


Michael

June 9, 2015 at 9:58 am

thank you, Josh. You made this very easy to implement.

I’ve observed the following:
the timer applies to registration, and not payment details, meaning that if user advances to payment step before the timer elapses, user has unlimited time to complete payment. However, if time runs out before registration details are entered, timer works as expected: Proceed to Payment results in a generic error (“no valid registrations”).

The timer would be improved if it also applied to the payment step, especially since another ticket inventory check is not performed again.

Even though the timer does not apply to Payment Details form, it is still displayed.

I found is_sold_out 4 times in the core files, but I can’t get anywhere with it, it’s beyond me. It looks like the last check of inventory happens when user selects payment type.


Josh

  • Support Staff

June 9, 2015 at 10:53 am

Thanks for the feedback Michael. Currently the countdown timer isn’t wired up to prevent overselling. It’s simply a way to keep track of how long the session has gone on.

Currently there’s an open ticket to address this issue, and this is our plan for it:

  1. When someone begins the reg process, we add their ticket selections, quantities, and the time their registration began to an array and save that as a WP transient. The array would be organized by event ID.
  2. Then some JavaScript on the page begins a countdown timer, and gives them 15 minutes (or whatever) to complete their registration.
  3. Then when someone else goes to visit the event list or an event details page, we pull that transient, remove any expired registrations, and factor what’s left into our available tickets calculations.
  4. If the timer runs out on someone while they are still in the registration process, then their record in the WP transient gets removed, and they get bumped to the Registration Cancelled page with an appropriate message (ie: Your registration time limit has expired, please try again)
  5. If they complete the registration, then the regular ticket sales records are updated to reflect their purchase, and their record in the WP Transients array is removed

I will update this thread when we have this implemented, and added your feedback to the ticket.


Michael

June 9, 2015 at 11:08 am

Wow, it’s great that you already have a plan for this. Thanks for the update and thanks again for the snippets above. You all do a great job with EE and this forum.

Viewing 5 reply threads

The support post ‘timer to prevent overselling’ 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