Support

Home Forums Event Espresso Premium How to add a certain quanity to cart in multi-registration (EE3)

How to add a certain quanity to cart in multi-registration (EE3)

Posted: May 11, 2015 at 8:05 pm

Viewing 7 reply threads


lhammond

May 11, 2015 at 8:05 pm

I am using the espresso_table.php file as my starting place, and I would like to add a quantity drop-down before the Add to Cart button that updates the session with the specific number of attendees before I get to the cart. I’m not sure where the code is that does the work of adding that event to the session so it shows up in the cart and changes the button so it says View Cart instead. Can you please point me in the right direction?


lhammond

May 11, 2015 at 9:00 pm

Do I need to edit the event_espresso_cart_link() function in cart.php? Can I also have it add a placeholder row to the database at that point so that the user effectively grabs a seat in the class until the registration timeout expires? I already have that happening in the next step, after the submit the cart and go to fill out the registration details, but we’d like to reserve the spot earlier in the process. Thanks!


Dean

May 12, 2015 at 5:30 am

Hi,

The way the cart is set up, isn’t really ideal for what you are trying to do.

I think the way I would attempt it would be to send the dropdown contents over via $_POST (form) and then modify the shopping_cart.php file (modify a duplicate copied to wp-content/uploads/espresso/templates) to look for the $_POST response, and then modify the $_SESSION as required. BUT you will need to know the Result ID of the ticket from the SQL found in cart.php (examine the event_espresso_group_price_dropdown function in cart.php).

As I mentioned, it’s not ideally setup for this sort of modification. It looks like it can be done, but unless you are well versed in PHP it may require a developer to assist with

Can I also have it add a placeholder row to the database at that point so that the user effectively grabs a seat in the class until the registration timeout expires?

This might be possible but is outside of the scope of support, you would need to discuss it with a developer.


Dean

May 12, 2015 at 5:30 am

Hi,

The way the cart is set up, isn’t really ideal for what you are trying to do.

I think the way I would attempt it would be to send the dropdown contents over via $_POST (form) and then modify the shopping_cart.php file (modify a duplicate copied to wp-content/uploads/espresso/templates) to look for the $_POST response, and then modify the $_SESSION as required. BUT you will need to know the Result ID of the ticket from the SQL found in cart.php (examine the event_espresso_group_price_dropdown function in cart.php).

As I mentioned, it’s not ideally setup for this sort of modification. It looks like it can be done, but unless you are well versed in PHP it may require a developer to assist with

Can I also have it add a placeholder row to the database at that point so that the user effectively grabs a seat in the class until the registration timeout expires?

This might be possible but is outside of the scope of support, you would need to discuss it with a developer.


lhammond

May 12, 2015 at 8:16 am

I have done a lot of modifications already, and doing a standard post in PHP is no problem. But the thing I’m less familiar with is how the JSON object that changes the Add to Cart link to the View Cart link works. Is there javascript that updates the session, but then keeps you on the page?


Dean

May 13, 2015 at 1:30 am

Hi,

Yes I believe so. /wp-content/plugins/event-espresso/scripts/espresso_cart_functions.js contains the cart JS, and it looks like there is a global object that is updated when the link is clicked (see line 111).


lhammond

May 14, 2015 at 8:48 am

Ok, that’s helpful, I’ll take a look. Do you know what function is called on the cart page when someone selects a number of attendees? I’d like to add that same dropdown and call the same function from my espresso_table page.


Dean

May 18, 2015 at 1:05 am

Hi,

It looks like it is:

/wp-content/plugins/event-espresso/includes/functions/cart.php line 1243

event_espresso_multi_qty_dd() (same file line 947)

Viewing 7 reply threads

The support post ‘How to add a certain quanity to cart in multi-registration (EE3)’ 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