Exemple #1
0
 /**
  * Don't let the customer on the login page if they are already authenticated
  * @Developer brandon
  * @Date Oct 12, 2010
  */
 public function new_one()
 {
     if (customer::logged_in()) {
         url::redirect(url::site());
     }
     parent::new_one();
 }
Exemple #2
0
 /**
  * Get the cart
  * @Developer brandon
  * @Date Oct 20, 2010
  */
 public static function get()
 {
     if (customer::logged_in()) {
         return customer::current()->load_cart();
     } else {
         if (Session::instance()->get('cart_' . store::get())) {
             return ORM::factory('cart', Session::instance()->get('cart_' . store::get()));
         } else {
             $cart = ORM::factory('cart');
             $cart->save();
             Session::instance()->set('cart_' . store::get(), (string) $cart);
             return $cart;
         }
     }
 }