contents()->count()) $this->template->content = _('Cart is Empty'); else { $output = View::factory('cart/view')->set('o',$co); $output .= Form::open('checkout/before'); $output .= View::factory('cart/payment')->set('o',$co); $output .= Form::close(); Block::factory() ->body($output); } } /** * Add an item to the cart */ public function action_add() { $co = ORM::factory('Cart'); $co->values(Request::current()->post()); $co->session_id = Session::instance()->id(); if (! $this->save($co)) throw HTTP_Exception::factory(501,_('There was a problem adding the item to the cart.')); HTTP::redirect('cart/index'); } public function action_empty() { Cart::instance()->delete(); $this->template->content = _('Cart Emptied'); } } ?>