Import from SVN (r45945, r596)
[civicrm-core.git] / CRM / Event / Cart / Page / RemoveFromCart.php
CommitLineData
6a488035
TO
1<?php
2class CRM_Event_Cart_Page_RemoveFromCart extends CRM_Core_Page {
3 function run() {
4 $transaction = new CRM_Core_Transaction();
5 $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE);
6 $cart = CRM_Event_Cart_BAO_Cart::find_or_create_for_current_session();
7 $cart->load_associations();
8 $event_in_cart = $cart->get_event_in_cart_by_event_id($this->_id);
9 $removed_event = $cart->remove_event_in_cart($event_in_cart->id);
10 $removed_event_title = $removed_event->event->title;
11 CRM_Core_Session::setStatus(ts("<b>%1</b> has been removed from your cart.", array(1 => $removed_event_title)), '', 'success');
12 $transaction->commit();
13 return CRM_Utils_System::redirect($_SERVER['HTTP_REFERER']);
14 }
15}
16
17
18