示例#1
0
 /**
  * Show detail of order (only user's orders)
  * @return void
  * @param integer id of order
  */
 public function order($id)
 {
     // Check user permission
     if (user::is_logged()) {
         // Aditional model
         $order = new Order_Model();
         // Settings
         $this->set_title(Kohana::lang('eshop.customer_order'));
         $this->add_breadcrumb(Kohana::lang('eshop.order'), url::current());
         // Fetch data
         $data = $order->get_one($id, user::user_id());
         if (empty($data['id'])) {
             // Go away if data is empty (means that user trying to display someone else order)
             url::redirect('denied');
         }
         $ordered = $order->get_one_ordered($id);
         $total = $order->get_total($id);
         // View
         $this->template->content = new View('customer_order');
         $this->template->content->data = $data;
         $this->template->content->ordered = $ordered;
         $this->template->content->total = $total;
     } else {
         url::redirect('/denied');
     }
 }
示例#2
0
 public function confirm()
 {
     if ($this->order->id) {
         $order = new Order_Model($this->order->id);
         if ($order) {
             $order->status = 1;
             $order->orders_address_id = $this->setAddress();
             $order->trans_id = $this->getTransID();
             $order->date_modified = time();
             $order->date_created = time();
             $order->save();
         }
         $this->addOrderBasket();
         $this->updateInventory();
         $this->updateStatusList(1);
         $this->order->fulfillment_state = 'NEW';
         return $order->trans_id;
     }
 }
示例#3
0
 /**
  * Payment
  * @param id of order
  * @return void
  */
 public function payment($id)
 {
     // Check user permission
     if (user::is_logged()) {
         $payment = new Payment_Model();
         $order = new Order_Model();
         $payment_id = $order->get_payment($id);
         $shipping = new Shipping_Model();
         if ($payment->get_type($payment_id) == "pre") {
             // Paying inside shop (e.g. paypal, credit card) //continue here
             if ($order->get_status($id) == "none") {
                 // go to payment now
                 // TODO: payment module implementation
             } else {
                 // Settings & View
                 $this->set_title(Kohana::lang('eshop.already_paid'));
                 $this->add_breadcrumb(Kohana::lang('eshop.already_paid'), NULL);
                 $this->template->content = new View('cart_paid');
             }
         } else {
             // Paying outside shop (e.g. bank transfer) => finish here
             // Show message about success
             // Settings & View
             $this->set_title(Kohana::lang('eshop.payment'));
             $this->add_breadcrumb(Kohana::lang('eshop.payment'), '/cart/payment');
             $this->template->content = new View('cart_post');
             $this->template->content->vsymbol = $id;
             $this->template->content->payment = $payment->get_info($payment_id);
         }
     }
 }