Ian province abbreviation patch - issue 724
[civicrm-core.git] / CRM / Event / Cart / Page / RemoveFromCart.php
CommitLineData
6a488035 1<?php
0cf587a7
EM
2
3/**
4 * Class CRM_Event_Cart_Page_RemoveFromCart
5 */
6a488035 6class CRM_Event_Cart_Page_RemoveFromCart extends CRM_Core_Page {
00be9182 7 public function run() {
6a488035 8 $transaction = new CRM_Core_Transaction();
353ffa53
TO
9 $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE);
10 $cart = CRM_Event_Cart_BAO_Cart::find_or_create_for_current_session();
6a488035 11 $cart->load_associations();
353ffa53
TO
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);
6a488035
TO
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']);
18 }
96025800 19
6a488035 20}