示例#1
0
 public function actionProductdetail($id = null)
 {
     if ($id !== null || $id !== 0) {
         $product = Productmedias::find()->with('product')->where('ProductId = ' . $id)->asArray()->one();
     } else {
     }
     return $this->render('productdetail', ['product' => $product]);
 }
示例#2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Productmedias::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['ProductMediaId' => $this->ProductMediaId, 'ProductId' => $this->ProductId, 'DisplayOrder' => $this->DisplayOrder, 'IsVideo' => $this->IsVideo, 'IsPrimary' => $this->IsPrimary, 'IsActive' => $this->IsActive, 'created_by' => $this->created_by, 'LastUpdatedBy' => $this->LastUpdatedBy, 'updated_at' => $this->updated_at, 'created_at' => $this->created_at, 'deleted_at' => $this->deleted_at]);
     $query->andFilterWhere(['like', 'SmallImageUrl', $this->SmallImageUrl])->andFilterWhere(['like', 'ImageUrl', $this->ImageUrl])->andFilterWhere(['like', 'ZoomImageUrl', $this->ZoomImageUrl])->andFilterWhere(['like', 'EmbedCode', $this->EmbedCode])->andFilterWhere(['like', 'HtmlAlt', $this->HtmlAlt])->andFilterWhere(['like', 'HtmlTitle', $this->HtmlTitle])->andFilterWhere(['like', 'FeaturedText', $this->FeaturedText])->andFilterWhere(['like', 'Comment', $this->Comment]);
     return $dataProvider;
 }