Esempio n. 1
0
 public static function initSessionVariables()
 {
     //This function initializes the values stored in the session IF THEY DON'T ALREADY EXIST
     //For example, the shipping object, payment, etc
     if (!isset($_SESSION['authenticated_user'])) {
         $_SESSION['authenticated_user'] = new User();
     }
     if (!isset($_SESSION['cart_basket'])) {
         $_SESSION['cart_basket'] = array();
     }
     if (!isset($_SESSION['cart_checkout']['shipping'])) {
         $_SESSION['cart_checkout']['shipping'] = Shipping::factory('EAndA');
         //Always set the shipping to EAndA
     }
     if (!isset($_SESSION['cart_checkout']['payment'])) {
         $_SESSION['cart_checkout']['payment'] = Payment::factory('Paypal');
     }
     if (!isset($_SESSION['cart_checkout']['address']['shipping_address'])) {
         $_SESSION['cart_checkout']['address']['shipping_address'] = new Address();
     }
     if (!isset($_SESSION['cart_checkout']['address']['billing_address'])) {
         $_SESSION['cart_checkout']['address']['billing_address'] = new Address();
     }
     if (!isset($_SESSION['cart_checkout']['order'])) {
         $_SESSION['cart_checkout']['order'] = new CartOrder();
     }
     if (!isset($_SESSION['cart_checkout']['orderFailureReason'])) {
         $_SESSION['cart_checkout']['orderFailureReason'] = "";
     }
 }