4 * Class CRM_Event_Cart_Page_RemoveFromCart
6 class CRM_Event_Cart_Page_RemoveFromCart
extends CRM_Core_Page
{
7 public function run() {
8 $transaction = new CRM_Core_Transaction();
9 $this->_id
= CRM_Utils_Request
::retrieve('id', 'Positive', $this, TRUE);
10 $cart = CRM_Event_Cart_BAO_Cart
::find_or_create_for_current_session();
11 $cart->load_associations();
12 $event_in_cart = $cart->get_event_in_cart_by_event_id($this->_id
);
13 $removed_event = $cart->remove_event_in_cart($event_in_cart->id
);
14 $removed_event_title = $removed_event->event
->title
;
15 CRM_Core_Session
::setStatus(ts("<b>%1</b> has been removed from your cart.", array(1 => $removed_event_title)), '', 'success');
16 $transaction->commit();
17 return CRM_Utils_System
::redirect($_SERVER['HTTP_REFERER']);