Posted: October 25, 2012 at 2:03 pm
|
Hi, I’m using the Multiple Event Registration add-on to set up registration for a one day conference. Each class at the conference is an event in the Event Espresso system. There are 5 different hour long sessions during the day of the conference and each session has at least 5 classes being taught during the session. So, a user can only register for up to 5 classes (1 per each session) for the conference. I need to find a way to keep the user from registering for more than one class (i.e. an event) per session (i.e. the user can only be in once place at a time). By the way I’m using the Add to Cart feature of the Multi Event Regisration add-on. So for example, if the user adds class 1 of session 1 to their cart, he shouldn’t be able to add class 2 of session 1 because he can’t be in both classes at the same time. How would I protect against double booking in this system? What existing functions could I use. If I need to write custom functions, what types of calls would I need to make and where in the code/db would I query? Thanks much! |
Hi Justin, One way that you could accomplish this is by hiding the rest of the table when one event is selected. Each group of classes would need to be its own table. You could add a bit of jQuery to the page that displays the tables of classes like this:
So when the add to cart link is clicked, the other class options in that group are hidden. Here’s a simple demo: |
|
|
Thanks Josh, this is a good idea. A few questions: When I add jQuery to the page as you’ve suggested, are the other jQuery functions associated with the add to cart, or delete from cart going to still function properly? In other words, does adding this break anything? Also, if the user makes a mistake or changes their mind, I’d like to have a way for them to view the class listings again. What you’ve provided is a great start. I’ll see how I can expand upon it to meet my needs. Let me know if you have other ideas to expand upon this solution. One more question. If I modify this file: ~/wp-content/plugins/event-espresso/scripts/espresso_cart_functions.js can I save it off to the ~uploads/espresso/templates directory similar to the template files? Or is it only the .php and .css files that work this way in your system? I have a few other things I’m trying to do and I’m considering doing them in the .js file. Thoughts? Thanks! |
I’ll start with the last question: If you modify the espresso_cart_functions.js file, it will not work to copy it over to /wp-content/uploads/espresso/templates. Event Espresso only checks for templates there and specific CSS files there. The way I’d add that bit of JavaScript on the page would be via a custom page template, near the footer. Alteratively, you could conditionally load a different footer template. Or you could enqueue it as a separate file and conditionally load it, but for that little be of JS, i’d place it inline.
I tested this first on my deve site to make sure it didn’t break anything, but you’ll want to test any modifications. The delete from cart functions happen on a different page (the cart page). The above code should only be applied to the page that’s displaying the table of events, not the cart page.
Here’s one way to do this: There’s a shortcode that you can use to clear the cart. You can create a page, place this shortcode on it: Then create a “start over” button and link to that page, with a link button to take them back to the start of the process. |
|
|
Thanks Josh! One more question… I’ve worked out a process so that on the cart page, if the user has selected more than one class for a session, I give them a warning and disable the Complete Registration button. Seems to work okay except for a small hiccup in IE7 – I can’t get the page to refresh (needed to re-render the page, warnings, etc). But I’m going to leave that for now and declare a victory. My problem now is the Registration page (where we ask for the user’s info – questions, i.e. load_checkout_page). That page displays the questions for every single class/event the person has registered for. We only need it once, of course. I’m looking into how I can hide all the extra forms and use jQuery to popuplate the hidden fields. But that seems kind crazy. Can you think of a better way to only ask for the user’s information in one form? Thanks! |
Hi Justin, The current version of Event Espresso has the “Copy above information to all forms?” button/option. This will populate the forms for each event in the cart based on what’s filled in the first form. If you really need to hide the other forms, you could use the CSS nth child selector and set all the forms except for the first one to display:none;
|
|
Just wanted to post an update here. We came up with a solution to hide the registration forms for additional events. We are going to add a setting in the org options to hide the additional reg forms on the checkout page and pass all of the information from the first registration form to the additional registrations. |
|
The support post ‘Protect Against Double Booking’ 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.