当前位置: 首页>>代码示例>>PHP>>正文


PHP Product::getProduct方法代码示例

本文整理汇总了PHP中app\models\Product::getProduct方法的典型用法代码示例。如果您正苦于以下问题:PHP Product::getProduct方法的具体用法?PHP Product::getProduct怎么用?PHP Product::getProduct使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\models\Product的用法示例。


在下文中一共展示了Product::getProduct方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionProduct

 public function actionProduct($id)
 {
     $modelProduct = new Product();
     foreach ($modelProduct->getProduct($id) as $product) {
         $idProduct = $product['id'];
         $nameProduct = $product['name'];
         $typeProduct = $product['type'];
         $priceProduct = $product['price'];
         $descriptionProduct = $product['description'];
         $imageProduct = $product['image'];
     }
     return $this->render('product', ['idProduct' => $idProduct, 'nameProduct' => $nameProduct, 'typeProduct' => $typeProduct, 'priceProduct' => $priceProduct, 'descriptionProduct' => $descriptionProduct, 'imageProduct' => $imageProduct]);
 }
开发者ID:royutoan,项目名称:pianodanang,代码行数:13,代码来源:SiteController.php

示例2: actionIndex

 public function actionIndex($mpn = null, $availability = 0, $pricesort = 0)
 {
     if ($this->validate($mpn, $availability, $pricesort)) {
         $product = Product::getProduct($mpn, $availability, $pricesort);
         $this->result['mpn'] = $mpn;
         if ($product) {
             $this->result['status'] = 'OK';
             $this->result['id'] = $product->id;
             $offers = unserialize($product->offer);
             if ($availability) {
                 $filter = new Filter($offers, $availability);
                 $offers = $filter->execute();
             }
             if ($pricesort) {
                 $sort = new PriceSort($offers, $pricesort);
                 $offers = $sort->execute();
             }
             $this->result['array'] = $offers;
         } else {
             $this->result['status'] = 'NOT FOUND';
         }
     }
     echo json_encode($this->result, JSON_PRETTY_PRINT);
 }
开发者ID:androidrf992,项目名称:restful-api,代码行数:24,代码来源:GetpriceController.php

示例3: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show(Label $labelModel, History $historyModel, Purchase $purchaseModel, Provider $providerController, Brand $brandModel, Category $categoryModel, Product $productModel, $id)
 {
     $product = $productModel->getProduct($id);
     if (!$product) {
         abort(404);
     }
     $purchase = $purchaseModel->getPurchase($id);
     $historyProduct = $historyModel->getProductHistory($id);
     $historyPurchase = $historyModel->getPurchaseHistory($id);
     $historySite = $historyModel->getSiteHistory($id);
     $labels = $labelModel->getLabelsByProductsId([$id]);
     $arLabels = [];
     foreach ($labels as $label) {
         $arLabels[] = $label->label;
     }
     $strLabels = implode(',', $arLabels);
     if (!empty($product->childs)) {
         $product->childs = unserialize($product->childs);
     }
     $categories_list = $categoryModel->getFullCategoriesList();
     $brands_list = $brandModel->getFullBrandsList();
     $provider_list = $providerController->getProvedrsList();
     return view('products.show')->with('title', $product->category_name . ' ' . $product->name)->with('product', $product)->with('purchase', $purchase)->with('categories_list', $categories_list)->with('brands_list', $brands_list)->with('provider_list', $provider_list)->with('history_product', $historyProduct)->with('history_purchase', $historyPurchase)->with('history_site', $historySite)->with('labels', $strLabels);
 }
开发者ID:enotsokolov,项目名称:vp_plus,代码行数:30,代码来源:ProductController.php


注:本文中的app\models\Product::getProduct方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。