Blame view

frontend/views/special/category.php 2.48 KB
950817c6   Alex Savenko   first commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
  <?php
      /**
       * @var \yii\web\View                   $this
       * @var \artbox\catalog\models\Category $model
       * @var \yii\data\ActiveDataProvider    $dataProvider
       */
      use artbox\catalog\models\Product;
      use yii\bootstrap\Html;
      use yii\widgets\LinkPager;
      use yii\widgets\ListView;
      
      $seo = \Yii::$app->get('seo');
      $view = $this;
      $type = \Yii::$app->request->get('type');
      $this->params[ 'breadcrumbs' ][] = [
          'label' => \Yii::t(
              'app',
              'Все {type}',
              [
                  'type' => ( $type === 'new' ) ? \Yii::t('app', 'новинки') : \Yii::t(
                      'app',
                      'акционные'
                  ),
              ]
          ),
          'url'   => [
              'special/index',
              'type' => $type,
          ],
      ];
      $this->params[ 'breadcrumbs' ][] = $seo->title ? : ( ( $type === 'new' ) ? \Yii::t('app', 'Новинки') : \Yii::t(
              'app',
              'Акционные'
          ) ) . ' ' . $model->lang->title;
  ?>
  <div id="content">
    <div class="container">
      
      <div class="row">
        
        <div class="col-sm-12">
            
            <?php
                echo ListView::widget(
                    [
                        'options'      => [
                            'class' => 'row products',
                        ],
                        'itemOptions'  => [
                            'tag' => false,
                        ],
                        'layout'       => '{items}',
                        'dataProvider' => $dataProvider,
                        'itemView'     => function ($model) use ($view) {
                            /**
                             * @var Product $model
                             */
                            return $view->render(
                                '@frontend/views/category/_product_item',
                                [
                                    'product' => $model,
                                ]
                            );
                        },
                    ]
                );
                echo Html::tag(
                    'div',
                    LinkPager::widget(
                        [
                            'pagination' => $dataProvider->pagination,
                        ]
                    ),
                    [
                        'class' => 'pages',
                    ]
                );
            ?>
        
        </div>
      
      </div>
    
    </div>
    <!-- /.container -->
  </div>
  <!-- /#content -->