Blame view

frontend/views/site/index.php 12 KB
3a00e6d1   Yarik   Files added
1
  <?php
d45d5682   Yarik   Catalog
2
      use artbox\catalog\models\Brand;
fe6d4ac1   Yarik   Layout
3
4
      use artbox\catalog\models\Category;
      use artbox\catalog\models\Product;
d45d5682   Yarik   Catalog
5
      use artbox\core\components\SeoComponent;
05f1b3e2   Alexey Boroda   -Blog at main
6
7
      use artbox\core\helpers\ImageHelper;
      use artbox\weblog\models\Article;
fe6d4ac1   Yarik   Layout
8
      use yii\bootstrap\Html;
05f1b3e2   Alexey Boroda   -Blog at main
9
      use yii\helpers\Url;
fe6d4ac1   Yarik   Layout
10
      use yii\web\View;
3a00e6d1   Yarik   Files added
11
      
fe6d4ac1   Yarik   Layout
12
      /**
d45d5682   Yarik   Catalog
13
14
15
16
17
       * @var View         $this
       * @var Category[]   $categories
       * @var Product[]    $topItems
       * @var Product[]    $newItems
       * @var Product[]    $saleItems
a00f1f42   Yarik   Social auth + vie...
18
       * @var Product[]    $historyItems
d45d5682   Yarik   Catalog
19
20
21
22
       * @var int          $brandCount
       * @var int          $productCount
       * @var Brand[]      $brands
       * @var SeoComponent $seo
05f1b3e2   Alexey Boroda   -Blog at main
23
       * @var Article[]    $articles
fe6d4ac1   Yarik   Layout
24
       */
3a00e6d1   Yarik   Files added
25
      $this->title = 'My Yii Application';
d45d5682   Yarik   Catalog
26
      $seo = Yii::$app->get('seo');
3a00e6d1   Yarik   Files added
27
  ?>
fe6d4ac1   Yarik   Layout
28
  <section class="category-carousel-box">
05f1b3e2   Alexey Boroda   -Blog at main
29
    <!-- *** HOMEPAGE CAROUSEL ***
fe6d4ac1   Yarik   Layout
30
  _________________________________________________________ -->
05f1b3e2   Alexey Boroda   -Blog at main
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
    <div class="container">
      
      <div class="row">
        <div class="col-sm-3">
            <?php
                echo $this->render(
                    '@frontend/views/layouts/_category_menu',
                    [
                        'isHome' => true,
                    ]
                );
            ?>
        </div>
        
        <div class="col-sm-9">
          <div class="home-carousel">
            
            <div class="dark-mask"></div>
            
            <div class="homepage owl-carousel">
              <div class="item">
5e838104   Eugeny Galkovskiy   Баннер на главной...
52
                  <img src="/img/acdc-main-banner.png">
3a00e6d1   Yarik   Files added
53
              </div>
05f1b3e2   Alexey Boroda   -Blog at main
54
55
            </div>
            <!-- /.project owl-slider -->
3a00e6d1   Yarik   Files added
56
          </div>
05f1b3e2   Alexey Boroda   -Blog at main
57
        </div>
3a00e6d1   Yarik   Files added
58
      </div>
05f1b3e2   Alexey Boroda   -Blog at main
59
60
    </div>
    <!-- *** HOMEPAGE CAROUSEL END *** -->
3a00e6d1   Yarik   Files added
61
62
  </section>
  
fe6d4ac1   Yarik   Layout
63
64
  
  <section>
05f1b3e2   Alexey Boroda   -Blog at main
65
66
67
68
69
70
    <div class="container">
        <?php
            if (!empty($newItems)) {
                ?>
              <div class="heading text-center">
                <h2><?php echo \Yii::t('app', 'Новинки'); ?></h2>
3a00e6d1   Yarik   Files added
71
              </div>
05f1b3e2   Alexey Boroda   -Blog at main
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
              
              <div class="product-carousel">
                <div class="homepage owl-carousel">
                    <?php
                        $newItemsArrays = array_chunk($newItems, 4);
                        foreach ($newItemsArrays as $newItemsArray) {
                            ?>
                          <div class="products">
                              <?php
                                  foreach ($newItemsArray as $product) {
                                      echo $this->render(
                                          '_slider_product',
                                          [
                                              'product' => $product,
                                          ]
                                      );
                                  }
                              ?>
                          </div>
                            <?php
                        }
                    ?>
                </div>
3a00e6d1   Yarik   Files added
95
              </div>
05f1b3e2   Alexey Boroda   -Blog at main
96
97
98
99
100
101
                <?php
            }
            if (!empty($saleItems)) {
                ?>
              <div class="heading text-center">
                <h2><?php echo \Yii::t('app', 'Акции'); ?></h2>
3a00e6d1   Yarik   Files added
102
              </div>
05f1b3e2   Alexey Boroda   -Blog at main
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
              <div class="product-carousel">
                <div class="homepage owl-carousel">
                    <?php
                        $newItemsArrays = array_chunk($saleItems, 4);
                        foreach ($newItemsArrays as $newItemsArray) {
                            ?>
                          <div class="products">
                              <?php
                                  foreach ($newItemsArray as $product) {
                                      echo $this->render(
                                          '_slider_product',
                                          [
                                              'product' => $product,
                                          ]
                                      );
                                  }
                              ?>
d45d5682   Yarik   Catalog
120
                          </div>
05f1b3e2   Alexey Boroda   -Blog at main
121
122
123
124
125
126
127
128
129
130
                            <?php
                        }
                    ?>
                </div>
              </div>
                <?php
            }
            if (!empty($topItems)) {
                ?>
              <div class="heading text-center">
543f1653   Yarik   Fixed
131
                <h2><?php echo \Yii::t('app', 'Топ'); ?></h2>
05f1b3e2   Alexey Boroda   -Blog at main
132
133
134
135
136
137
138
139
              </div>
              <div class="product-carousel">
                <div class="homepage owl-carousel">
                    <?php
                        $newItemsArrays = array_chunk($topItems, 4);
                        foreach ($newItemsArrays as $newItemsArray) {
                            ?>
                          <div class="products">
d45d5682   Yarik   Catalog
140
                              <?php
05f1b3e2   Alexey Boroda   -Blog at main
141
142
                                  foreach ($newItemsArray as $product) {
                                      echo $this->render(
a00f1f42   Yarik   Social auth + vie...
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
                                          '_slider_product',
                                          [
                                              'product' => $product,
                                          ]
                                      );
                                  }
                              ?>
                          </div>
                            <?php
                        }
                    ?>
                </div>
              </div>
                <?php
            }
            if (!empty($historyItems)) {
                ?>
              <div class="heading text-center">
                <h2><?php echo \Yii::t('app', 'Недавно просматривали'); ?></h2>
              </div>
              <div class="product-carousel">
                <div class="homepage owl-carousel">
                    <?php
                        $newItemsArrays = array_chunk($historyItems, 4);
                        foreach ($newItemsArrays as $newItemsArray) {
                            ?>
                          <div class="products">
                              <?php
                                  foreach ($newItemsArray as $product) {
                                      echo $this->render(
05f1b3e2   Alexey Boroda   -Blog at main
173
                                          '_slider_product',
d45d5682   Yarik   Catalog
174
                                          [
05f1b3e2   Alexey Boroda   -Blog at main
175
                                              'product' => $product,
d45d5682   Yarik   Catalog
176
177
178
179
                                          ]
                                      );
                                  }
                              ?>
05f1b3e2   Alexey Boroda   -Blog at main
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
                          </div>
                            <?php
                        }
                    ?>
                </div>
              </div>
                <?php
            }
        ?>
    </div>
  </section>
  
  <section class="bar color-white no-mb">
    <div class="container">
      <div class="row showcase">
        <div class="col-md-4 col-sm-6">
          <div class="item">
            <div class="icon"><i class="fa fa-cubes"></i>
            </div>
            <h4><span class="counter"><?php echo $productCount; ?></span><br>
              
              Позиций товаров</h4>
          </div>
        </div>
        <div class="col-md-4 col-sm-6">
          <div class="item">
            <div class="icon"><i class="fa fa-tags"></i>
            </div>
            <h4><span class="counter"><?php echo $brandCount; ?></span><br>
              
              Брендов</h4>
          </div>
        </div>
        <div class="col-md-4 col-sm-6">
          <div class="item">
            <div class="icon"><i class="fa fa-copy"></i>
            </div>
            <h4><span class="counter">12</span> ... <span class="counter">36</span><br>
              
              Месяцев Гарантия </h4>
          </div>
        </div>
      </div>
      <!-- /.row -->
    </div>
    <!-- /.container -->
  </section>
  <!-- /.bar -->
  <?php
      if (!empty($brands)) {
          ?>
        <section class="bar background-gray no-mb">
          <div class="container">
            <div class="row">
              <div class="col-md-12">
                <div class="heading text-center">
                  <h2><?php echo \Yii::t('app', 'Бренды'); ?></h2>
                </div>
fc66ded4   Yarik   Artbox great prep...
238
239
    
                <ul class="owl-carousel customers brand-carousel">
05f1b3e2   Alexey Boroda   -Blog at main
240
241
242
243
244
                    <?php
                        foreach ($brands as $brand) {
                            echo Html::tag(
                                'div',
                                Html::img(
fc66ded4   Yarik   Artbox great prep...
245
246
247
                                    ImageHelper::set($brand->image->getPath())
                                               ->setWidth(150)
                                               ->render(),
05f1b3e2   Alexey Boroda   -Blog at main
248
249
250
251
252
253
254
255
256
257
258
259
                                    [
                                        'class' => 'img-responsive',
                                    ]
                                ),
                                [
                                    'class' => 'item',
                                ]
                            );
                        }
                    ?>
                </ul>
                <!-- /.owl-carousel -->
fe6d4ac1   Yarik   Layout
260
              </div>
05f1b3e2   Alexey Boroda   -Blog at main
261
262
263
264
            
            </div>
          </div>
        </section>
d45d5682   Yarik   Catalog
265
266
267
          <?php
      }
  ?>
fe6d4ac1   Yarik   Layout
268
  <section class="bar background-white no-mb">
05f1b3e2   Alexey Boroda   -Blog at main
269
270
271
272
273
274
    <div class="container">
      
      <div class="col-md-12">
        <div class="heading text-center">
          <h2>Полезные статьи</h2>
        </div>
05f1b3e2   Alexey Boroda   -Blog at main
275
276
        
        <!-- *** BLOG HOMEPAGE ***
fe6d4ac1   Yarik   Layout
277
  _________________________________________________________ -->
05f1b3e2   Alexey Boroda   -Blog at main
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
        
        <div class="row">
            
            <?php foreach ($articles as $article) { ?>
              <div class="col-md-3 col-sm-6">
                <div class="box-image-text blog">
                  <div class="top">
                    <div class="image">
                        <?= ImageHelper::set(
                            $article->image ? $article->image->getPath() : '@frontend/web/img/no-image.png'
                        )
                                       ->cropResize(255, 192)
                                       ->renderImage(
                                           [
                                               'class' => 'img-responsive',
                                               'alt'   => $article->lang->title,
                                           ]
                                       ) ?>
                    </div>
                    <div class="bg"></div>
                    <div class="text">
                      <p class="buttons">
                        <a href="<?= Url::to(
                            [
                                'blog/article',
                                'id' => $article->id,
                            ]
fc66ded4   Yarik   Artbox great prep...
305
306
307
308
                        ) ?>" class="btn btn-template-transparent-primary"><i class="fa fa-link"></i> <?php echo \Yii::t(
                                'app',
                                'Read more'
                            ); ?></a>
05f1b3e2   Alexey Boroda   -Blog at main
309
310
                      </p>
                    </div>
3a00e6d1   Yarik   Files added
311
                  </div>
05f1b3e2   Alexey Boroda   -Blog at main
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
                  <div class="content">
                    <h4><a href="<?= Url::to(
                            [
                                'blog/article',
                                'id' => $article->id,
                            ]
                        ) ?>"><?= $article->lang->title; ?></a></h4>
                      <?php if ( !empty($article->category) ) { ?>
                    <p class="author-category"><a href="<?= Url::to(
                            [
                                'blog/category',
                                'id' => $article->category->id,
                            ]
                        ) ?>"><?= $article->category->lang->title ?></a>
                        <?php } ?>
                    </p>
                    <p class="intro"><?= $article->lang->body_preview; ?></p>
                    <p class="read-more">
                      <a href="<?= Url::to(
                          [
                              'blog/article',
                              'id' => $article->id,
                          ]
2246dbb7   Eugeny Galkovskiy   небольшие перевод...
335
                      ) ?>" class="btn btn-template-main"><?php echo \Yii::t('app', 'Continue reading'); ?></a>
05f1b3e2   Alexey Boroda   -Blog at main
336
                    </p>
3a00e6d1   Yarik   Files added
337
                  </div>
05f1b3e2   Alexey Boroda   -Blog at main
338
339
                </div>
                <!-- /.box-image-text -->
3a00e6d1   Yarik   Files added
340
              </div>
05f1b3e2   Alexey Boroda   -Blog at main
341
342
343
344
345
346
            <?php } ?>
        
        </div>
        <!-- /.row -->
        
        <!-- *** BLOG HOMEPAGE END *** -->
d45d5682   Yarik   Catalog
347
      
3a00e6d1   Yarik   Files added
348
      </div>
05f1b3e2   Alexey Boroda   -Blog at main
349
350
351
    
    </div>
    <!-- /.container -->
3a00e6d1   Yarik   Files added
352
  </section>
3a00e6d1   Yarik   Files added
353
  <!-- /.bar -->
05f1b3e2   Alexey Boroda   -Blog at main
354
  
3a00e6d1   Yarik   Files added
355
  
8c3ef8da   Eugeny Galkovskiy   правки вёрстка 1
356
  <section class="bar background-white no-mb">
05f1b3e2   Alexey Boroda   -Blog at main
357
358
359
    <div class="container">
      <div class="col-md-12">
          <?php echo $seo->text; ?>
3a00e6d1   Yarik   Files added
360
      </div>
05f1b3e2   Alexey Boroda   -Blog at main
361
    </div>
fe6d4ac1   Yarik   Layout
362
  </section>