/** * pay! */ public function action_checkout() { if (!Auth::instance()->logged_in()) { $this->redirect(Route::get('oc-panel')->uri()); } $user = Auth::instance()->get_user(); //resend confirmation email if (is_numeric($id_order = $this->request->param('id'))) { $order = new Model_Order($id_order); if ($order->loaded() and $order->id_user == $user->id_user and $order->status == Model_Order::STATUS_CREATED) { //verify the coupon and check order against user information, if its different update order info and maybe price! $order->check_pricing(); $this->template->title = __('Checkout'); Breadcrumbs::add(Breadcrumb::factory()->set_title($this->template->title)); $this->template->content = View::factory('pages/product/checkout', array('order' => $order, 'user' => $user, 'product' => $order->product)); } else { Alert::set(Alert::WARNING, __('Order not found or already paid')); $this->redirect(Route::url('oc-panel', array('controller' => 'profile', 'action' => 'orders'))); } } else { Alert::set(Alert::ERROR, __('Order not found')); $this->redirect(Route::url('oc-panel', array('controller' => 'profile', 'action' => 'orders'))); } }
/** * confirms a checkout when its a free order * @return [type] [description] */ public function action_checkoutfree() { $order = new Model_Order($this->request->param('id')); if ($order->loaded()) { //if paid...no way jose if ($order->status != Model_Order::STATUS_CREATED) { Alert::set(Alert::INFO, __('This order was already paid.')); $this->redirect(Route::url('default')); } //checks coupons or amount of featured days $order->check_pricing(); //he needs to pay...little prick if ($order->amount > 0) { $this->redirect(Route::url('default', array('controller' => 'ad', 'action' => 'checkout', 'id' => $order->id_order))); } else { $order->confirm_payment('cash'); $this->redirect(Route::url('oc-panel', array('controller' => 'profile', 'action' => 'orders'))); } } else { //throw 404 throw HTTP_Exception::factory(404, __('Page not found')); } }
/** * pay an invoice, renders the paymenthods button, anyone with an ID of an order can pay it, we do not have control * @return [type] [description] */ public function action_checkout() { $order = new Model_Order($this->request->param('id')); if ($order->loaded()) { //hack jquery paymill Paymill::jquery(); //if paid...no way jose if ($order->status != Model_Order::STATUS_CREATED) { Alert::set(Alert::INFO, __('This order was already paid.')); $this->redirect(Route::url('default')); } //checks coupons or amount of featured days $order->check_pricing(); //template header $this->template->title = __('Checkout') . ' ' . Model_Order::product_desc($order->id_product); Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Home'))->set_url(Route::url('default'))); Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Pricing'))->set_url(Route::url('pricing'))); Breadcrumbs::add(Breadcrumb::factory()->set_title($this->template->title)); Controller::$full_width = TRUE; $this->template->bind('content', $content); $this->template->content = View::factory('pages/ad/checkout', array('order' => $order)); } else { //throw 404 throw HTTP_Exception::factory(404, __('Page not found')); } }