4 * Class CRM_Event_Cart_Page_RemoveFromCart
6 class CRM_Event_Cart_Page_RemoveFromCart
extends CRM_Core_Page
{
9 * This function takes care of all the things common to all pages.
11 * This typically involves assigning the appropriate smarty variables :)
13 public function run() {
14 $transaction = new CRM_Core_Transaction();
15 $this->_id
= CRM_Utils_Request
::retrieve('id', 'Positive', $this, TRUE);
16 $cart = CRM_Event_Cart_BAO_Cart
::find_or_create_for_current_session();
17 $cart->load_associations();
18 $event_in_cart = $cart->get_event_in_cart_by_event_id($this->_id
);
19 $removed_event = $cart->remove_event_in_cart($event_in_cart->id
);
20 $removed_event_title = $removed_event->event
->title
;
21 CRM_Core_Session
::setStatus(ts("<b>%1</b> has been removed from your cart.", [1 => $removed_event_title]), '', 'success');
22 $transaction->commit();
23 return CRM_Utils_System
::redirect($_SERVER['HTTP_REFERER']);