/** * 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(); //adds VAT to the amount $order->add_VAT(); //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(); //adds VAT to the amount $order->add_VAT(); //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')); } }