Exemplo n.º 1
0
 /**
  * Gets one or more customer product options.
  *
  * @param int $customer_id Customer ID.
  * @param int $id          Product option ID.
  *
  * @return void
  */
 public function get_index($customer_id = null, $id = null)
 {
     if (!$customer_id) {
         throw new HttpNotFoundException();
     }
     $customer = \Service_Customer::find_one($customer_id);
     if (!$customer || $customer->seller != \Seller::active()) {
         throw new HttpNotFoundException();
     }
     if (!$id) {
         $products = \Service_Customer_Product_Option::find(array('customer' => $customer));
     } else {
         $products = \Service_Customer_Product_Option::find_one($id);
         if (!$products || $products->customer != $customer) {
             throw new HttpNotFoundException();
         }
     }
     $this->response($products);
 }
Exemplo n.º 2
0
 /**
  * Displays a customer's products.
  *
  * @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->products = Service_Customer_Product_Option::find(array('customer' => $customer, 'status' => 'all'));
 }