public function actionBrandView($lang = null, $alias)
 {
     $brand = Brand::find()->lang($lang)->andWhere(['alias' => $alias])->one();
     if (!$brand) {
         throw new HttpException(404, 'Брэнд не найден');
     }
     if (\Yii::$app->request->isAjax) {
         return $this->renderAjax('brandView', ['brand' => $brand]);
     }
     return $this->render('brandView', ['brand' => $brand]);
 }
示例#2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Brand::find()->lang();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'position' => $this->position]);
     $query->andFilterWhere(['like', 'lang', $this->lang])->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'descriptionShort', $this->descriptionShort])->andFilterWhere(['like', 'alias', $this->alias]);
     return $dataProvider;
 }
示例#3
0
 public function getBrand()
 {
     return $this->hasOne(Brand::className(), ['id' => 'brandId'])->andWhere(['lang' => \Yii::$app->language]);
 }
示例#4
0
文件: _brand.php 项目: ivphpan/iris
<?php

/**
 * Created by PhpStorm.
 * User: ivphpan
 * Date: 19.01.16
 * Time: 18:06
 */
/** @var  $brandList \app\modules\catalog\models\Brand*/
$brandList = \app\modules\catalog\models\Brand::find()->lang()->all();
?>
<div class="brand-logo bounceInUp animated">
    <div class="container">
        <div class="slider-items-products">
            <div id="brand-logo-slider" class="product-flexslider hidden-buttons">
                <div class="slider-items slider-width-col6">

                    <?php 
foreach ($brandList as $brand) {
    ?>
                    <!-- Item -->
                    <div class="item">
                        <a href="<?php 
    echo $brand->url;
    ?>
"><img src="<?php 
    echo $brand->imageSrc('130x50', \yii\image\drivers\Image::AUTO, 1);
    ?>
" alt="Image"></a>
                    </div>
                    <!-- End Item -->
示例#5
0
文件: _form.php 项目: ivphpan/iris
<?php

use app\modules\catalog\models\CategoryRecord;
/* @var $this yii\web\View */
/* @var $model app\modules\catalog\models\CategoryRecord */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="category-record-form">

    <div class="well">

        <div class="row">
            <div class="col-md-4">
                <?php 
echo $form->field($model, '[' . $k . ']brandId')->dropDownList(\app\modules\catalog\models\Brand::dropdown(), ['prompt' => '-']);
?>

                <?php 
echo $form->field($model, '[' . $k . ']title')->textInput(['maxlength' => true]);
?>

                <?php 
echo $form->field($model, '[' . $k . ']alias')->textInput(['maxlength' => true]);
?>
                <small><?php 
echo $model->FullPath;
?>
</small>