public function __construct()
 {
     // If items are stored in a session, get them now
     if (Session::get('Commerce.ShoppingCart.Items')) {
         $this->items = unserialize(Session::get('Commerce.ShoppingCart.Items'));
     } else {
         $this->items = ArrayList::create();
     }
     // If discounts stored in a session, get them, else create new list
     if (Session::get('Commerce.ShoppingCart.Discount')) {
         $this->discount = unserialize(Session::get('Commerce.ShoppingCart.Discount'));
     }
     // If we don't have any discounts, a user is logged in and he has
     // access to discounts through a group, add the discount here
     if (!$this->discount && Member::currentUserID()) {
         $member = Member::currentUser();
         $this->discount = $member->getDiscount();
         Session::set('Commerce.ShoppingCart.Discount', serialize($this->discount));
     }
     parent::__construct();
 }
 /**
  * The ContentController will take the URLSegment parameter from the URL and use that to look
  * up a SiteTree record.
  */
 public function __construct($dataRecord = null)
 {
     $this->dataRecord = $dataRecord;
     $this->failover = $this->dataRecord;
     parent::__construct();
 }