Support

Home Forums Multiple Event Registration Add-on Throwing an Exception in Shopping Cart

Throwing an Exception in Shopping Cart

Posted: July 2, 2014 at 3:15 pm


ctoravetz

July 2, 2014 at 3:15 pm

Hi EE Support Team,

I’ve a particular need that I’m hoping can be a minor code addition. I’m using the Multiple Event Registration and need to introduce a requirement for a registrant to proceed from the shopping cart to the registration page. My website is: http://nyfamilylife.org/store/register

My office offers primarily 3 categories of events; however 2 of these categories are linked and must be registered for together. We call these our “Day-One” course, “Day-Two” course, and “Four-Evening” course. I need to introduce a requirement in the shopping cart so that a customer must register for a Day-One and a Day-Two together – they cannot register for just a Day-One alone nor a Day-Two alone.

I’m hoping to add a requirement in the code, so that if a person tries to register for a Day-One alone or a Day-Two alone, they receive an error similar to when a person tries to checkout with 0 items in their shopping cart and they get the message: “Attention…please make sure to select at least one attendee or delete it from your cart.” I’d like it to say something along the lines of, “Attention… you must select Day-One and Day-Two together.”

Is it possible to adjust/add code to accomplish this? It seems like I could add something to the cart.php file, and if the categories of the events in the cart don’t fit the requirement, catch this error.

Thanks so much.


ctoravetz

July 2, 2014 at 3:17 pm

Hi EE Support Team,

I’ve a particular need that I’m hoping can be a minor code addition. I’m using the Multiple Event Registration and need to introduce a requirement for a registrant to proceed from the shopping cart to the registration page. My website is: http://nyfamilylife.org/store/register

My office offers primarily 3 categories of events; however 2 of these categories are linked and must be registered for together. We call these our “Day-One” course, “Day-Two” course, and “Four-Evening” course. I need to introduce a requirement in the shopping cart so that a customer must register for a Day-One and a Day-Two together – they cannot register for just a Day-One alone nor a Day-Two alone. If they try do, I hope to throw an exception and error message.

I’m hoping to add a requirement in the code, so that if a person tries to register for a Day-One alone or a Day-Two alone, they receive an error message similar to when a person tries to checkout with 0 items in their shopping cart and they get the message: “Attention…please make sure to select at least one attendee or delete it from your cart.” I’d like it to say something along the lines of, “Attention… you must select Day-One and Day-Two together.”

Is it possible to adjust/add code to accomplish this? It seems like I could add something to the cart.php file, and if the categories of the events in the cart don’t fit the requirement, throw this exception.

Thanks so much.


Dean

July 3, 2014 at 2:56 am

Hi,

While this is outside of the scope of support, I would say that you would need to modify the shopping_cart.php file in 2 ways.

Firstly you would need to use the $result array (it contains the event data) to add a class or similar marker with the event category.

Then add in some jquery that on submit button click, checks to see if X and Y class exists. If not it stops the button from functioning and throws an alert error, if the classes exist it will allow progress.

We have a list of recommended developers should you require assistance creating this, https://eventespresso.com/developers/event-espresso-pros/, though really any developer should be able to add this sort of functionality in.

The support post ‘Throwing an Exception in Shopping Cart’ 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