Support

Home Forums Multiple Event Registration Add-on Trying to hack Add to Cart Button functionality

Trying to hack Add to Cart Button functionality

Posted: February 12, 2013 at 7:12 pm


Thomas Donnelly

February 12, 2013 at 7:12 pm

Hello, I’m in the processes of customizing the event_list.php and event_list_display.php templates and am hoping to change the behavior of the Add to Cart button. Basically instead of “Add to Cart” changing to “View Cart” which then moves the user to the cart I would like “Add to Cart” to alternate with “Remove from Cart” with a single button at the bottom of the list to move onto the next step (view the cart and select quantities).

It appears my best hope is hacking a couple lines in cart.php. Specifically I’m looking at:

if ($view_cart || (is_array($events_in_session) && array_key_exists($event_id, $events_in_session))) {
$registration_cart_url = get_option('siteurl') . '/?page_id=' . $event_page_id . '&regevent_action=show_shopping_cart';
$registration_cart_anchor = __("View Cart", 'event_espresso')
} else {
//show them the add to cart link
$registration_cart_url = isset($externalURL) && $externalURL != '' ? $externalURL : get_option('siteurl') . '/?page_id=' . $event_page_id . '&regevent_action=add_event_to_cart&event_id=' . $event_id . '&name_of_event=' . stripslashes_deep($event_name);
$registration_cart_anchor = $anchor;
$registration_cart_class = 'ee_add_item_to_cart';
}

It seems that adding “$registration_cart_class = ‘ee_remove_item_to_cart’;” to the IF statement while changing $registration_cart_url to “javascript:void(0)” (so the link does not take you off page) does successfully remove the item from the cart. Unfortunately , I’m left with the spinning symbol and it never reverts back to “Add to Cart.”

I suspect there might be something similar to “&regevent_action=delete_event_from_cart” that I should pass along in the URL but I can’t see to find it or fully figure out how the Add to Cart > View Cart change happens.

Any help?


Thomas Donnelly

February 13, 2013 at 11:53 am

Never mind. I figured it out.

The support post ‘Trying to hack Add to Cart Button functionality’ 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