Example #1
0
 /**
  * Gets one or more products.
  *
  * @param int $id Product ID.
  *
  * @return void
  */
 public function get_index($id = null)
 {
     $seller = \Seller::active();
     if (!$id) {
         $products = \Service_Product::find(array('seller' => $seller));
     } else {
         $products = \Service_Product::find_one($id);
         if (!$products || $products->seller != $seller) {
             throw new HttpNotFoundException();
         }
     }
     $this->response($products);
 }
Example #2
0
 /**
  * Display's a seller's products.
  *
  * @return void
  */
 public function action_index()
 {
     $products = Service_Product::find(array('seller' => Seller::active()));
     $this->view->products = $products;
 }