/**
  * Finds the Brend model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Brend the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Brend::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Exemple #2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Brend::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id]);
     $query->andFilterWhere(['like', 'name', $this->name]);
     return $dataProvider;
 }
Exemple #3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getBrend()
 {
     return $this->hasOne(Brend::className(), ['id' => 'brend_id']);
 }
 public function actionDetail()
 {
     $data = $this->getCommonDate();
     $modelBest = Goods::getBest(3);
     $iP = Yii::$app->session->id;
     $quantityInCart = Cart::getQountAllByIp($iP);
     $id = Yii::$app->request->get('item');
     $modelReview = Review::getReviewsByGoodId($id);
     $modelGoodsCategories = GoodsCategory::find()->all();
     $modelBrends = Brend::find()->all();
     if (!$id) {
         $this->redirect('/shop/index');
     }
     $model = Goods::getItemById($id);
     $modelPhotos = GoodsPhotos::getItemsByGoodId($id);
     $_modelReview = new Review();
     return $this->render('detail', ['modelPhotos' => $modelPhotos, 'data' => $data, 'model' => $model, 'modelGoodsCategories' => $modelGoodsCategories, 'modelReview' => $modelReview, '_modelReview' => $_modelReview, 'modelBest' => $modelBest, 'modelBrends' => $modelBrends]);
 }
Exemple #5
0
<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper;
use common\models\GoodsCategory;
use backend\assets\AppAsset;
use common\models\Brend;
$this->registerJsFile('/js/custom/upload_goods.js', ['depends' => AppAsset::className()]);
$arrGoodsCategory = GoodsCategory::find()->all();
$arrBrend = Brend::find()->all();
?>

<div class="shop-form">

    <?php 
$form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data'], 'id' => 'form-send-file']);
?>

    <?php 
echo $form->field($model, 'item')->textInput(['maxlength' => 255]);
?>

    <?php 
echo $form->field($model, 'price')->textInput();
?>

    <?php 
echo $form->field($model, 'rating')->dropDownList([1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5]);
?>