예제 #1
0
 public function action_index()
 {
     $args = array('seller' => Seller::active());
     $pagination = Pagination::forge('customer_pagination', array('total_items' => Service_Customer_Order::count($args)));
     $orders = Service_Customer_Order::find(array_merge($args, array('offset' => $pagination->offset, 'limit' => $pagination->per_page, 'order_by' => array('updated_at' => 'desc'))));
     $this->view->orders = $orders;
     $this->view->pagination = $pagination;
 }
예제 #2
0
 /**
  * Gets one or more orders.
  *
  * @param int $customer_id Customer ID.
  * @param int $id          Payment method ID.
  *
  * @return void
  */
 public function get_index($customer_id = null, $id = null)
 {
     $customer = $this->get_customer($customer_id);
     if (!$id) {
         $orders = \Service_Customer_Order::find(array('customer' => $customer));
     } else {
         $orders = \Service_Customer_Order::find_one($id);
         if (!$orders || $orders->customer != $customer || $orders->customer->seller != \Seller::active()) {
             throw new HttpNotFoundException();
         }
     }
     $this->response($orders);
 }
예제 #3
0
 /**
  * Displays a customer's orders.
  *
  * @param int $customer_id Customer ID.
  *
  * @return void
  */
 public function action_index($customer_id = null)
 {
     $customer = $this->get_customer($customer_id);
     $this->view->customer = $customer;
     $this->view->orders = Service_Customer_Order::find(array('customer' => $customer));
 }