Commit 8cd678be91a24580c63f1566e9cc633ac9498844

Authored by Yarik
1 parent 9a840185

Special pages

frontend/config/main.php
... ... @@ -64,7 +64,9 @@
64 64 'route' => 'category/view',
65 65 'defaults' => [ 'filter' => '' ],
66 66 ],
67   - 'robots.txt' => 'site/robots',
  67 + 'special/<type:(new|sale)>' => 'special/index',
  68 + 'special/<category>/<type:(new|sale)>' => 'special/category',
  69 + 'robots.txt' => 'site/robots',
68 70 ],
69 71 ],
70 72 ],
... ...
frontend/controllers/SpecialController.php 0 → 100755
  1 +<?php
  2 +
  3 + namespace frontend\controllers;
  4 +
  5 + use artbox\catalog\models\Category;
  6 + use artbox\catalog\models\Product;
  7 + use yii\data\ActiveDataProvider;
  8 + use yii\web\Controller;
  9 + use yii\web\NotFoundHttpException;
  10 +
  11 + /**
  12 + * Class SpecialController
  13 + *
  14 + * @package frontend\controllers
  15 + */
  16 + class SpecialController extends Controller
  17 + {
  18 + /**
  19 + * Show all specials by type
  20 + *
  21 + * @param string $type
  22 + *
  23 + * @return string
  24 + */
  25 + public function actionIndex($type)
  26 + {
  27 + $query = Category::find()
  28 + ->with('lang.alias')
  29 + ->innerJoinWith('products', false)
  30 + ->groupBy('category.id');
  31 + if ($type === 'new') {
  32 + $query->where('product.mask & 2 != 0');
  33 + $productQuery = Product::find()
  34 + ->where('product.mask & 2 != 0');
  35 + } else {
  36 + $query->where('product.mask & 4 != 0');
  37 + $productQuery = Product::find()
  38 + ->where('product.mask & 4 != 0');
  39 + }
  40 + $categories = $query->all();
  41 + $dataProvider = new ActiveDataProvider(
  42 + [
  43 + 'query' => $productQuery,
  44 + ]
  45 + );
  46 + return $this->render(
  47 + 'index',
  48 + [
  49 + 'categories' => $categories,
  50 + 'dataProvider' => $dataProvider,
  51 + ]
  52 + );
  53 + }
  54 +
  55 + /**
  56 + * Show specials by type and category
  57 + *
  58 + * @param $type
  59 + * @param $category
  60 + *
  61 + * @return string
  62 + */
  63 + public function actionCategory($type, $category)
  64 + {
  65 + $model = $this->findCategory($category);
  66 + $query = Product::find()
  67 + ->with('variants', 'image')
  68 + ->innerJoinWith('categories', 'false')
  69 + ->where([ 'product_to_category.category_id' => $model->id ])
  70 + ->orderBy(
  71 + [
  72 + 'product.sort' => SORT_ASC,
  73 + 'product.created_at' => SORT_DESC,
  74 + ]
  75 + );
  76 + if ($type === 'new') {
  77 + $query->andWhere('product.mask & 2 != 0');
  78 + } elseif ($type === 'sale') {
  79 + $query->andWhere('product.mask & 4 != 0');
  80 + }
  81 + $dataProvider = new ActiveDataProvider(
  82 + [
  83 + 'query' => $query,
  84 + ]
  85 + );
  86 + return $this->render(
  87 + 'category',
  88 + [
  89 + 'model' => $model,
  90 + 'dataProvider' => $dataProvider,
  91 + ]
  92 + );
  93 + }
  94 +
  95 + /**
  96 + * @param string $category
  97 + *
  98 + * @return Category
  99 + * @throws \yii\web\NotFoundHttpException
  100 + */
  101 + protected function findCategory(string $category)
  102 + {
  103 + /**
  104 + * @var Category $model
  105 + */
  106 + $model = Category::find()
  107 + ->innerJoinWith('lang.alias', false)
  108 + ->where([ 'alias.value' => $category ])
  109 + ->one();
  110 + if (!empty($model)) {
  111 + return $model;
  112 + } else {
  113 + throw new NotFoundHttpException('Model not found');
  114 + }
  115 + }
  116 + }
0 117 \ No newline at end of file
... ...
frontend/views/category/_product_item.php
... ... @@ -5,89 +5,89 @@
5 5 use yii\web\View;
6 6  
7 7 /**
8   - * @var View $this
9   - * @var Product $product
  8 + * @var View $this
  9 + * @var Product $product
10 10 */
11 11 ?>
12 12 <div class="col-md-4 col-sm-6">
13   - <div class="product">
14   - <div class="image">
15   - <?php
16   - echo Html::a(
17   - Html::img(
18   - ImageHelper::set(
19   - $product->image ? $product->image->getPath() : '@frontend/web/img/no-image.png'
20   - )
21   - ->fillResize(260, 260)
22   - ->render(),
23   - [
24   - 'class' => 'img-responsive-image1',
25   - ]
26   - ),
  13 + <div class="product">
  14 + <div class="image">
  15 + <?php
  16 + echo Html::a(
  17 + Html::img(
  18 + ImageHelper::set(
  19 + $product->image ? $product->image->getPath() : '@frontend/web/img/no-image.png'
  20 + )
  21 + ->fillResize(260, 260)
  22 + ->render(),
27 23 [
28   - 'product/view',
29   - 'id' => $product->id,
  24 + 'class' => 'img-responsive-image1',
30 25 ]
31   - );
32   - ?>
33   - </div>
34   - <!-- /.image -->
35   - <div class="text">
36   - <h3>
37   - <?php
38   - echo Html::a(
39   - $product->lang->title,
40   - [
41   - 'product/view',
42   - 'id' => $product->id,
43   - ]
44   - );
45   - ?>
46   - </h3>
47   - <p class="price">
48   - <?php
49   - if ($product->variants[ 0 ]->price_old) {
50   - echo Html::tag('del', $product->variants[ 0 ]->price_old);
51   - }
52   - echo $product->variants[ 0 ]->price;
53   - ?></p>
54   - <p class="buttons">
55   - <?php
56   - echo Html::a(
57   - Html::tag(
58   - 'i',
59   - '',
60   - [
61   - 'class' => 'fa fa-shopping-cart',
62   - ]
63   - ) . \Yii::t('app', 'В корзину'),
64   - '#',
65   - [ 'class' => 'btn btn-template-main' ]
66   - );
67   - ?>
68   - </p>
69   - </div>
70   - <!-- /.text -->
71   - <?php
72   - if ($product->is(1)) {
73   - ?>
74   - <div class="ribbon new">
75   - <div class="theribbon"><?php echo \Yii::t('app', 'Новое'); ?></div>
76   - <div class="ribbon-background"></div>
77   - </div>
78   - <?php
79   - }
80   - if ($product->is(2)) {
81   - ?>
82   - <div class="ribbon sale">
83   - <div class="theribbon"><?php echo \Yii::t('app', 'Акция'); ?></div>
84   - <div class="ribbon-background"></div>
85   - </div>
86   - <?php
87   - }
  26 + ),
  27 + [
  28 + 'product/view',
  29 + 'id' => $product->id,
  30 + ]
  31 + );
88 32 ?>
89   -
90   - <!-- /.ribbon -->
91 33 </div>
92   - <!-- /.product -->
  34 + <!-- /.image -->
  35 + <div class="text">
  36 + <h3>
  37 + <?php
  38 + echo Html::a(
  39 + $product->lang->title,
  40 + [
  41 + 'product/view',
  42 + 'id' => $product->id,
  43 + ]
  44 + );
  45 + ?>
  46 + </h3>
  47 + <p class="price">
  48 + <?php
  49 + if ($product->variants[ 0 ]->price_old) {
  50 + echo Html::tag('del', $product->variants[ 0 ]->price_old . ' грн.');
  51 + }
  52 + echo ( $product->variants[ 0 ]->price ? : 0 ) . ' грн.';
  53 + ?></p>
  54 + <p class="buttons">
  55 + <?php
  56 + echo Html::a(
  57 + Html::tag(
  58 + 'i',
  59 + '',
  60 + [
  61 + 'class' => 'fa fa-shopping-cart',
  62 + ]
  63 + ) . \Yii::t('app', 'В корзину'),
  64 + '#',
  65 + [ 'class' => 'btn btn-template-main' ]
  66 + );
  67 + ?>
  68 + </p>
  69 + </div>
  70 + <!-- /.text -->
  71 + <?php
  72 + if ($product->is('new')) {
  73 + ?>
  74 + <div class="ribbon new">
  75 + <div class="theribbon"><?php echo \Yii::t('app', 'Новое'); ?></div>
  76 + <div class="ribbon-background"></div>
  77 + </div>
  78 + <?php
  79 + }
  80 + if ($product->is('akcia')) {
  81 + ?>
  82 + <div class="ribbon sale">
  83 + <div class="theribbon"><?php echo \Yii::t('app', 'Акция'); ?></div>
  84 + <div class="ribbon-background"></div>
  85 + </div>
  86 + <?php
  87 + }
  88 + ?>
  89 +
  90 + <!-- /.ribbon -->
  91 + </div>
  92 + <!-- /.product -->
93 93 </div>
... ...
frontend/views/category/view.php
... ... @@ -96,6 +96,32 @@ _________________________________________________________ --&gt;
96 96 <?php
97 97 }
98 98 ?>
  99 +
  100 + <?php
  101 + if (!empty($filterHelper->getFilter())) {
  102 + echo Html::a(
  103 + Html::icon(
  104 + 'times-circle',
  105 + [
  106 + 'prefix' => 'fa fa-',
  107 + ]
  108 + ) . Html::tag(
  109 + 'span',
  110 + \Yii::t('app', 'Сбросить фильтр'),
  111 + [
  112 + 'class' => 'hidden-sm',
  113 + ]
  114 + ),
  115 + [
  116 + 'view',
  117 + 'category' => $model->lang->alias->value,
  118 + ],
  119 + [
  120 + 'class' => 'btn btn-xs btn-danger',
  121 + ]
  122 + );
  123 + }
  124 + ?>
99 125  
100 126 <?php
101 127 $brands = $filterHelper->getBrands($model);
... ...
frontend/views/layouts/main.php
... ... @@ -77,526 +77,526 @@
77 77 ?>
78 78  
79 79 <?php $this->beginPage() ?>
80   -
81   - <!DOCTYPE html>
82   - <html lang="<?= \Yii::$app->language ?>">
83   - <head>
84   - <meta charset="<?= \Yii::$app->charset ?>">
85   - <meta name="viewport" content="width=device-width, initial-scale=1">
86   - <?= Html::csrfMetaTags() ?>
87   - <title><?= Html::encode($seo->title) ?></title>
88   - <?php $this->head() ?>
89   - </head>
90   - <body>
91   - <?php $this->beginBody() ?>
92   - <!-- Google Analytics -->
93   - <script>
94   - (function(i, s, o, g, r, a, m) {
95   - i[ 'GoogleAnalyticsObject' ] = r;
96   - i[ r ] = i[ r ] || function() {
97   - (i[ r ].q = i[ r ].q || []).push(arguments)
98   - }, i[ r ].l = 1 * new Date();
99   - a = s.createElement(o), m = s.getElementsByTagName(o)[ 0 ];
100   - a.async = 1;
101   - a.src = g;
102   - m.parentNode.insertBefore(a, m)
103   - })(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');
104   -
105   - ga('create', <?=$settings->ga_code?>, 'auto');
106   - ga('send', 'pageview');
  80 +
  81 + <!DOCTYPE html>
  82 + <html lang="<?= \Yii::$app->language ?>">
  83 + <head>
  84 + <meta charset="<?= \Yii::$app->charset ?>">
  85 + <meta name="viewport" content="width=device-width, initial-scale=1">
  86 + <?= Html::csrfMetaTags() ?>
  87 + <title><?= Html::encode($seo->title) ?></title>
  88 + <?php $this->head() ?>
  89 + </head>
  90 + <body>
  91 + <?php $this->beginBody() ?>
  92 + <!-- Google Analytics -->
  93 + <script>
  94 + (function(i, s, o, g, r, a, m) {
  95 + i[ 'GoogleAnalyticsObject' ] = r;
  96 + i[ r ] = i[ r ] || function() {
  97 + (i[ r ].q = i[ r ].q || []).push(arguments)
  98 + }, i[ r ].l = 1 * new Date();
  99 + a = s.createElement(o), m = s.getElementsByTagName(o)[ 0 ];
  100 + a.async = 1;
  101 + a.src = g;
  102 + m.parentNode.insertBefore(a, m)
  103 + })(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');
  104 +
  105 + ga('create', <?=$settings->ga_code?>, 'auto');
  106 + ga('send', 'pageview');
  107 +
  108 + </script>
  109 + <div id="all">
  110 + <header>
  111 +
  112 + <!-- *** TOP ***
  113 +_________________________________________________________ -->
  114 + <div id="top" class="hidden-sm hidden-xs">
  115 + <div class="container">
  116 + <div class="row">
  117 + <div class="col-xs-6 left-top-nav">
  118 + <?php
  119 + foreach ($pages as $page) {
  120 + echo Html::a(
  121 + $page->lang->title,
  122 + [
  123 + 'page/view',
  124 + 'id' => $page->id,
  125 + ]
  126 + );
  127 + }
  128 + ?>
  129 + </div>
  130 + <div class="col-xs-6 right-top-nav">
  131 + <div class="inline-block lang-link">
  132 + <?php
  133 + echo LangLink::widget();
  134 + ?>
  135 + </div>
  136 + <div class="inline-block">
  137 + <span class="top-phone"><i class="fa fa-phone"></i>&ensp;<?php echo $settings->phone; ?></span>
  138 + <a href="#" class="link-underline_dott">
  139 + Обратный звонок
  140 + </a>
  141 + </div>
  142 + <div class="inline-block login">
  143 + <a href="#" data-toggle="modal" data-target="#login-modal"><i class="fa fa-sign-in"></i>
  144 + <span>Вход</span></a>
  145 + </div>
  146 + </div>
  147 + </div>
  148 + </div>
  149 + </div>
  150 +
  151 + <!-- *** TOP END *** -->
  152 +
  153 + <!-- *** NAVBAR ***
  154 + _________________________________________________________ -->
  155 +
  156 + <div class="navbar-affixed-top" data-spy="affix" data-offset-top="200">
107 157  
108   - </script>
109   - <div id="all">
110   - <header>
111   -
112   - <!-- *** TOP ***
113   - _________________________________________________________ -->
114   - <div id="top" class="hidden-sm hidden-xs">
115   - <div class="container">
116   - <div class="row">
117   - <div class="col-xs-6 left-top-nav">
118   - <?php
119   - foreach ($pages as $page) {
120   - echo Html::a(
121   - $page->lang->title,
122   - [
123   - 'page/view',
124   - 'id' => $page->id,
125   - ]
126   - );
127   - }
128   - ?>
129   - </div>
130   - <div class="col-xs-6 right-top-nav">
131   - <div class="inline-block lang-link">
132   - <?php
133   - echo LangLink::widget();
134   - ?>
135   - </div>
136   - <div class="inline-block">
137   - <span class="top-phone"><i class="fa fa-phone"></i>&ensp;<?php echo $settings->phone; ?></span>
138   - <a href="#" class="link-underline_dott">
139   - Обратный звонок
140   - </a>
141   - </div>
142   - <div class="inline-block login">
143   - <a href="#" data-toggle="modal" data-target="#login-modal"><i class="fa fa-sign-in"></i>
144   - <span>Вход</span></a>
145   - </div>
146   - </div>
147   - </div>
148   - </div>
149   - </div>
150   -
151   - <!-- *** TOP END *** -->
152   -
153   - <!-- *** NAVBAR ***
154   - _________________________________________________________ -->
155   -
156   - <div class="navbar-affixed-top" data-spy="affix" data-offset-top="200">
157   -
158   - <div class="navbar navbar-default yamm" role="navigation" id="navbar">
159   -
160   - <div class="container">
161   - <div class="navbar-header">
162   - <?php
163   - echo Html::a(
164   - Html::img(
165   - $logo,
166   - [
167   - 'alt' => 'logo',
168   - ]
169   - ),
170   - [ '/site/index' ],
171   - [
172   - 'class' => 'navbar-brand home',
173   - ]
174   - )
175   - ?>
176   - <div class="navbar-buttons">
177   - <button type="button" class="navbar-toggle btn-template-main" data-toggle="collapse" data-target="#navigation">
  158 + <div class="navbar navbar-default yamm" role="navigation" id="navbar">
  159 +
  160 + <div class="container">
  161 + <div class="navbar-header">
  162 + <?php
  163 + echo Html::a(
  164 + Html::img(
  165 + $logo,
  166 + [
  167 + 'alt' => 'logo',
  168 + ]
  169 + ),
  170 + [ '/site/index' ],
  171 + [
  172 + 'class' => 'navbar-brand home',
  173 + ]
  174 + )
  175 + ?>
  176 + <div class="navbar-buttons">
  177 + <button type="button" class="navbar-toggle btn-template-main" data-toggle="collapse" data-target="#navigation">
178 178 <span class="sr-only"><?php echo \Yii::t(
179 179 'app',
180 180 'Toggle navigation'
181 181 ); ?></span>
182   - <i class="fa fa-align-justify"></i>
183   - </button>
184   - </div>
185   - </div>
186   - <!--/.navbar-header -->
187   -
188   - <div class="navbar-collapse collapse navbar-left" id="navigation">
189   - <ul class="nav navbar-nav navbar-left">
190   - <li class="main-nav-item active">
191   - <a href="#home-category-anchor" <?php echo $isHome ? '' : 'role="button" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-delay="200"'; ?>><span class="btn-like"><?php echo \Yii::t(
192   - 'app',
193   - 'Каталог'
194   - ); ?><i class="fa fa-bars" aria-hidden="true"></i></span></a>
195   - <?php
196   - if (!$isHome) {
197   - echo $this->render(
198   - '_category_menu',
199   - [
200   - 'isHome' => $isHome,
201   - ]
202   - );
203   - }
204   - ?>
205   - </li>
206   - <li class="main-nav-item">
207   - <?php
208   - echo Html::a(
209   - \Yii::t('app', 'Акции'),
210   - [
211   - '/product/category',
212   - 'sale' => true,
213   - ]
214   - );
215   - ?>
216   - </li>
217   - <li class="main-nav-item">
218   - <?php
219   - echo Html::a(
220   - \Yii::t('app', 'Новинки'),
221   - [
222   - '/product/category',
223   - 'new' => true,
224   - ]
225   - );
226   - ?>
227   - </li>
228   - <li class="main-nav-item">
229   - <?php
230   - echo Html::a(
231   - \Yii::t('app', 'Блог'),
232   - [
233   - '/blog/index',
234   - ]
235   - );
236   - ?>
237   - </li>
238   - </ul>
239   - </div>
240   - <!--/.nav-collapse -->
241   -
242   - <div class="cart-item" id="cart">
243   - <?php
244   - echo Html::a(
245   - Html::tag(
246   - 'span',
247   - \Yii::t('app', 'Корзина'),
248   - [
249   - 'class' => 'sub-title',
250   - ]
251   - ),
252   - [
253   - '/basket/index',
254   - ],
255   - [
256   - 'class' => 'cart-item-link',
257   - ]
258   - );
259   - ?>
260   - </div>
261   -
262   - <div class="search-block" id="search">
263   - <?php
264   - /**
265   - * @var Model $search
266   - */
267   - $search = \Yii::createObject(SearchForm::className());
268   - $searchForm = ActiveForm::begin(
269   - [
270   - 'action' => [ '/search/index' ],
271   - 'id' => 'search-form',
272   - 'method' => 'get',
273   - 'options' => [
274   - 'class' => 'navbar-form',
275   - 'role' => 'search',
276   - ],
277   - ]
278   - );
279   - echo Html::beginTag(
280   - 'div',
281   - [
282   - 'class' => 'input-group',
283   - ]
284   - );
285   - echo $searchForm->field(
286   - $search,
287   - 'word',
288   - [
289   - 'options' => [
290   - 'tag' => false,
291   - ],
292   - ]
293   - )
294   - ->label(false)
295   - ->textInput(
296   - [
297   - 'placeholder' => $search->getAttributeLabel('word'),
298   - ]
299   - );
300   - echo Html::tag(
301   - 'span',
302   - Html::submitButton(
303   - Html::tag(
304   - 'i',
305   - '',
306   - [
307   - 'class' => 'fa fa-search',
308   - ]
309   - ),
310   - [
311   - 'class' => 'btn btn-template-main',
312   - ]
313   - ),
314   - [
315   - 'class' => 'input-group-btn',
316   - ]
317   - );
318   - echo Html::endTag('div');
319   - $searchForm::end();
320   - ?>
321   - </div>
322   -
323   -
324   - <!--/.nav-collapse -->
325   - </div>
326   - </div>
327   - <!-- /#navbar -->
328   - </div>
329   - <!-- *** NAVBAR END *** -->
330   - </header>
331   -
332   - <!-- *** LOGIN MODAL ***
333   -_________________________________________________________ -->
334   -
335   - <div class="modal fade" id="login-modal" tabindex="-1" role="dialog" aria-labelledby="Login" aria-hidden="true">
336   - <div class="modal-dialog modal-sm">
337   -
338   - <div class="modal-content">
339   - <div class="modal-header">
340   - <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
341   - <h4 class="modal-title" id="Login">
342   - <?php echo \Yii::t('app', 'Customer login'); ?>
343   - </h4>
344   - </div>
345   - <div class="modal-body">
346   - <?php
347   - $login = ActiveForm::begin(
348   - [
349   - 'action' => [ '/site/login' ],
350   - ]
351   - );
352   - echo $login->field($loginForm, 'returnUrl')
353   - ->label(false)
354   - ->hiddenInput();
355   - echo $login->field($loginForm, 'username')
356   - ->label(false)
357   - ->textInput(
358   - [
359   - 'placeholder' => $loginForm->getAttributeLabel('username'),
360   - ]
361   - );
362   - echo $login->field($loginForm, 'username')
363   - ->label(false)
364   - ->passwordInput(
365   - [
366   - 'placeholder' => $loginForm->getAttributeLabel('password'),
367   - ]
368   - );
369   - $login::end();
370   - ?>
371   - <p class="text-center text-muted">
372   - <?php echo \Yii::t('app', 'Not registered yet?'); ?></p>
373   - <p class="text-center text-muted">
374   - <?php
375   - echo Html::a(
376   - Html::tag('strong', \Yii::t('app', 'Register now! ')),
377   - [
378   - '/site/signup',
379   - ]
380   - );
381   - echo \Yii::t(
382   - 'app',
383   - 'It is easy and done in 1&nbsp;minute and gives you access to special discounts and much more!'
384   - );
385   - ?>
386   - </p>
387   -
388   - </div>
389   - </div>
390   - </div>
  182 + <i class="fa fa-align-justify"></i>
  183 + </button>
  184 + </div>
391 185 </div>
392   -
393   - <!-- *** LOGIN MODAL END *** -->
  186 + <!--/.navbar-header -->
394 187  
395   - <!-- *** Breadcrumbs *** -->
396   - <?php
397   - if (!$isHome) {
398   - ?>
399   - <div id="heading-breadcrumbs">
400   - <div class="container">
401   - <?= Breadcrumbs::widget(
  188 + <div class="navbar-collapse collapse navbar-left" id="navigation">
  189 + <ul class="nav navbar-nav navbar-left">
  190 + <li class="main-nav-item active">
  191 + <a href="#home-category-anchor" <?php echo $isHome ? '' : 'role="button" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-delay="200"'; ?>><span class="btn-like"><?php echo \Yii::t(
  192 + 'app',
  193 + 'Каталог'
  194 + ); ?><i class="fa fa-bars" aria-hidden="true"></i></span></a>
  195 + <?php
  196 + if (!$isHome) {
  197 + echo $this->render(
  198 + '_category_menu',
402 199 [
403   - 'links' => isset( $this->params[ 'breadcrumbs' ] ) ? $this->params[ 'breadcrumbs' ] : [],
404   - 'homeLink' => [
405   - 'label' => \Yii::t('app', 'Home'),
406   - 'url' => [ '/site/index' ],
407   - ],
  200 + 'isHome' => $isHome,
408 201 ]
409   - ) ?>
410   - </div>
411   - </div>
  202 + );
  203 + }
  204 + ?>
  205 + </li>
  206 + <li class="main-nav-item">
412 207 <?php
413   - }
414   - ?>
415   - <!-- *** crumbs END *** -->
416   -
417   - <?= $content ?>
  208 + echo Html::a(
  209 + \Yii::t('app', 'Акции'),
  210 + [
  211 + '/special/index',
  212 + 'type' => 'sale',
  213 + ]
  214 + );
  215 + ?>
  216 + </li>
  217 + <li class="main-nav-item">
  218 + <?php
  219 + echo Html::a(
  220 + \Yii::t('app', 'Новинки'),
  221 + [
  222 + '/special/index',
  223 + 'type' => 'new',
  224 + ]
  225 + );
  226 + ?>
  227 + </li>
  228 + <li class="main-nav-item">
  229 + <?php
  230 + echo Html::a(
  231 + \Yii::t('app', 'Блог'),
  232 + [
  233 + '/blog/index',
  234 + ]
  235 + );
  236 + ?>
  237 + </li>
  238 + </ul>
  239 + </div>
  240 + <!--/.nav-collapse -->
418 241  
419   - <!-- *** FOOTER ***
420   - _________________________________________________________ -->
  242 + <div class="cart-item" id="cart">
  243 + <?php
  244 + echo Html::a(
  245 + Html::tag(
  246 + 'span',
  247 + \Yii::t('app', 'Корзина'),
  248 + [
  249 + 'class' => 'sub-title',
  250 + ]
  251 + ),
  252 + [
  253 + '/basket/index',
  254 + ],
  255 + [
  256 + 'class' => 'cart-item-link',
  257 + ]
  258 + );
  259 + ?>
  260 + </div>
421 261  
422   - <footer id="footer">
423   - <div class="container">
424   - <div class="col-md-3 col-sm-6">
425   - <h4><?php echo \Yii::t('app', 'About us'); ?></h4>
426   -
427   - <p><?php echo $settings->about; ?></p>
428   -
429   - <hr>
430   -
431   - <h4>Join our monthly newsletter</h4>
432   - <?php
433   - $newsletterForm = ActiveForm::begin(
434   - [
435   - 'action' => '/site/subscribe',
436   - ]
437   - );
438   - echo Html::beginTag(
439   - 'div',
440   - [
441   - 'class' => 'input-group',
442   - ]
443   - );
444   - echo $newsletterForm->field(
445   - $newsletter,
446   - 'email',
447   - [
448   - 'options' => [
449   - 'tag' => false,
450   - ],
451   - ]
452   - )
453   - ->label(false)
454   - ->textInput();
455   - echo Html::tag(
456   - 'span',
457   - Html::button(
458   - Html::tag(
459   - 'i',
460   - '',
  262 + <div class="search-block" id="search">
  263 + <?php
  264 + /**
  265 + * @var Model $search
  266 + */
  267 + $search = \Yii::createObject(SearchForm::className());
  268 + $searchForm = ActiveForm::begin(
  269 + [
  270 + 'action' => [ '/search/index' ],
  271 + 'id' => 'search-form',
  272 + 'method' => 'get',
  273 + 'options' => [
  274 + 'class' => 'navbar-form',
  275 + 'role' => 'search',
  276 + ],
  277 + ]
  278 + );
  279 + echo Html::beginTag(
  280 + 'div',
  281 + [
  282 + 'class' => 'input-group',
  283 + ]
  284 + );
  285 + echo $searchForm->field(
  286 + $search,
  287 + 'word',
  288 + [
  289 + 'options' => [
  290 + 'tag' => false,
  291 + ],
  292 + ]
  293 + )
  294 + ->label(false)
  295 + ->textInput(
461 296 [
462   - 'class' => 'fa fa-send',
  297 + 'placeholder' => $search->getAttributeLabel('word'),
463 298 ]
464   - ),
465   - [
466   - 'class' => 'btn btn-default',
467   - ]
468   - ),
  299 + );
  300 + echo Html::tag(
  301 + 'span',
  302 + Html::submitButton(
  303 + Html::tag(
  304 + 'i',
  305 + '',
469 306 [
470   - 'class' => 'input-group-btn',
  307 + 'class' => 'fa fa-search',
471 308 ]
472   - );
473   - echo Html::endTag('div');
474   - $newsletterForm::end();
475   - ?>
476   - <hr class="hidden-md hidden-lg hidden-sm">
477   -
478   - </div>
479   - <!-- /.col-md-3 -->
480   -
481   - <div class="col-md-3 col-sm-6">
  309 + ),
  310 + [
  311 + 'class' => 'btn btn-template-main',
  312 + ]
  313 + ),
  314 + [
  315 + 'class' => 'input-group-btn',
  316 + ]
  317 + );
  318 + echo Html::endTag('div');
  319 + $searchForm::end();
  320 + ?>
  321 + </div>
  322 +
  323 +
  324 + <!--/.nav-collapse -->
  325 + </div>
  326 + </div>
  327 + <!-- /#navbar -->
  328 + </div>
  329 + <!-- *** NAVBAR END *** -->
  330 + </header>
482 331  
483   - <h4><?php echo \Yii::t('app', 'Blog'); ?></h4>
  332 + <!-- *** LOGIN MODAL ***
  333 +_________________________________________________________ -->
484 334  
485   - <div class="blog-entries">
486   - <div class="item same-height-row clearfix">
487   - <div class="image same-height-always">
488   - <a href="#">
489   - <img class="img-responsive" src="/img/detailsquare.jpg" alt="">
490   - </a>
491   - </div>
492   - <div class="name same-height-always">
493   - <h5><a href="#">Blog post name</a></h5>
494   - </div>
495   - </div>
496   -
497   - <div class="item same-height-row clearfix">
498   - <div class="image same-height-always">
499   - <a href="#">
500   - <img class="img-responsive" src="/img/detailsquare.jpg" alt="">
501   - </a>
502   - </div>
503   - <div class="name same-height-always">
504   - <h5><a href="#">Blog post name</a></h5>
505   - </div>
506   - </div>
  335 + <div class="modal fade" id="login-modal" tabindex="-1" role="dialog" aria-labelledby="Login" aria-hidden="true">
  336 + <div class="modal-dialog modal-sm">
507 337  
508   - <div class="item same-height-row clearfix">
509   - <div class="image same-height-always">
510   - <a href="#">
511   - <img class="img-responsive" src="/img/detailsquare.jpg" alt="">
512   - </a>
513   - </div>
514   - <div class="name same-height-always">
515   - <h5><a href="#">Very very long blog post name</a></h5>
516   - </div>
517   - </div>
518   - </div>
519   -
520   - <hr class="hidden-md hidden-lg">
521   -
522   - </div>
523   - <!-- /.col-md-3 -->
524   -
525   - <div class="col-md-3 col-sm-6">
  338 + <div class="modal-content">
  339 + <div class="modal-header">
  340 + <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
  341 + <h4 class="modal-title" id="Login">
  342 + <?php echo \Yii::t('app', 'Customer login'); ?>
  343 + </h4>
  344 + </div>
  345 + <div class="modal-body">
  346 + <?php
  347 + $login = ActiveForm::begin(
  348 + [
  349 + 'action' => [ '/site/login' ],
  350 + ]
  351 + );
  352 + echo $login->field($loginForm, 'returnUrl')
  353 + ->label(false)
  354 + ->hiddenInput();
  355 + echo $login->field($loginForm, 'username')
  356 + ->label(false)
  357 + ->textInput(
  358 + [
  359 + 'placeholder' => $loginForm->getAttributeLabel('username'),
  360 + ]
  361 + );
  362 + echo $login->field($loginForm, 'username')
  363 + ->label(false)
  364 + ->passwordInput(
  365 + [
  366 + 'placeholder' => $loginForm->getAttributeLabel('password'),
  367 + ]
  368 + );
  369 + $login::end();
  370 + ?>
  371 + <p class="text-center text-muted">
  372 + <?php echo \Yii::t('app', 'Not registered yet?'); ?></p>
  373 + <p class="text-center text-muted">
  374 + <?php
  375 + echo Html::a(
  376 + Html::tag('strong', \Yii::t('app', 'Register now! ')),
  377 + [
  378 + '/site/signup',
  379 + ]
  380 + );
  381 + echo \Yii::t(
  382 + 'app',
  383 + 'It is easy and done in 1&nbsp;minute and gives you access to special discounts and much more!'
  384 + );
  385 + ?>
  386 + </p>
  387 +
  388 + </div>
  389 + </div>
  390 + </div>
  391 + </div>
526 392  
527   - <h4><?php echo \Yii::t('app', 'Contact'); ?></h4>
528   -
529   - <p>
530   - <?php
531   - echo $settings->name ? Html::tag('strong', $settings->name) : '';
532   - echo $settings->office ? Html::tag('br') . $settings->office : '';
533   - echo $settings->street ? Html::tag(
534   - 'br'
535   - ) . $settings->street . ' ' . $settings->house : '';
536   - echo $settings->city ? Html::tag('br') . $settings->city : '';
537   - echo $settings->country ? Html::tag('br') . Html::tag(
538   - 'strong',
539   - $settings->country
540   - ) : '';
541   - ?>
542   - </p>
  393 + <!-- *** LOGIN MODAL END *** -->
543 394  
544   - <a href="contact.html" class="btn btn-small btn-template-main">Go to contact page</a>
545   -
546   - <hr class="hidden-md hidden-lg hidden-sm">
547   -
548   - </div>
549   - <!-- /.col-md-3 -->
550   -
551   -
552   - <div class="col-md-3 col-sm-6">
  395 + <!-- *** Breadcrumbs *** -->
  396 + <?php
  397 + if (!$isHome) {
  398 + ?>
  399 + <div id="heading-breadcrumbs">
  400 + <div class="container">
  401 + <?= Breadcrumbs::widget(
  402 + [
  403 + 'links' => isset($this->params[ 'breadcrumbs' ]) ? $this->params[ 'breadcrumbs' ] : [],
  404 + 'homeLink' => [
  405 + 'label' => \Yii::t('app', 'Home'),
  406 + 'url' => [ '/site/index' ],
  407 + ],
  408 + ]
  409 + ) ?>
  410 + </div>
  411 + </div>
  412 + <?php
  413 + }
  414 + ?>
  415 + <!-- *** crumbs END *** -->
  416 +
  417 + <?= $content ?>
553 418  
554   - <h4><?php echo \Yii::t('app', 'Photostream'); ?></h4>
  419 + <!-- *** FOOTER ***
  420 +_________________________________________________________ -->
555 421  
556   - <div class="photostream">
557   - <div>
558   - <a href="#">
559   - <img src="/img/detailsquare.jpg" class="img-responsive" alt="#">
560   - </a>
561   - </div>
562   - <div>
563   - <a href="#">
564   - <img src="/img/detailsquare2.jpg" class="img-responsive" alt="#">
565   - </a>
566   - </div>
567   - <div>
568   - <a href="#">
569   - <img src="/img/detailsquare3.jpg" class="img-responsive" alt="#">
570   - </a>
571   - </div>
572   - <div>
573   - <a href="#">
574   - <img src="/img/detailsquare3.jpg" class="img-responsive" alt="#">
575   - </a>
576   - </div>
577   - <div>
578   - <a href="#">
579   - <img src="/img/detailsquare2.jpg" class="img-responsive" alt="#">
580   - </a>
581   - </div>
582   - <div>
583   - <a href="#">
584   - <img src="/img/detailsquare.jpg" class="img-responsive" alt="#">
585   - </a>
586   - </div>
587   - </div>
588   -
589   - </div>
590   - <!-- /.col-md-3 -->
591   - </div>
592   - <!-- /.container -->
593   - </footer>
594   - <!-- /#footer -->
  422 + <footer id="footer">
  423 + <div class="container">
  424 + <div class="col-md-3 col-sm-6">
  425 + <h4><?php echo \Yii::t('app', 'About us'); ?></h4>
  426 +
  427 + <p><?php echo $settings->about; ?></p>
  428 +
  429 + <hr>
  430 +
  431 + <h4>Join our monthly newsletter</h4>
  432 + <?php
  433 + $newsletterForm = ActiveForm::begin(
  434 + [
  435 + 'action' => '/site/subscribe',
  436 + ]
  437 + );
  438 + echo Html::beginTag(
  439 + 'div',
  440 + [
  441 + 'class' => 'input-group',
  442 + ]
  443 + );
  444 + echo $newsletterForm->field(
  445 + $newsletter,
  446 + 'email',
  447 + [
  448 + 'options' => [
  449 + 'tag' => false,
  450 + ],
  451 + ]
  452 + )
  453 + ->label(false)
  454 + ->textInput();
  455 + echo Html::tag(
  456 + 'span',
  457 + Html::button(
  458 + Html::tag(
  459 + 'i',
  460 + '',
  461 + [
  462 + 'class' => 'fa fa-send',
  463 + ]
  464 + ),
  465 + [
  466 + 'class' => 'btn btn-default',
  467 + ]
  468 + ),
  469 + [
  470 + 'class' => 'input-group-btn',
  471 + ]
  472 + );
  473 + echo Html::endTag('div');
  474 + $newsletterForm::end();
  475 + ?>
  476 + <hr class="hidden-md hidden-lg hidden-sm">
  477 +
  478 + </div>
  479 + <!-- /.col-md-3 -->
  480 +
  481 + <div class="col-md-3 col-sm-6">
  482 +
  483 + <h4><?php echo \Yii::t('app', 'Blog'); ?></h4>
  484 +
  485 + <div class="blog-entries">
  486 + <div class="item same-height-row clearfix">
  487 + <div class="image same-height-always">
  488 + <a href="#">
  489 + <img class="img-responsive" src="/img/detailsquare.jpg" alt="">
  490 + </a>
  491 + </div>
  492 + <div class="name same-height-always">
  493 + <h5><a href="#">Blog post name</a></h5>
  494 + </div>
  495 + </div>
  496 +
  497 + <div class="item same-height-row clearfix">
  498 + <div class="image same-height-always">
  499 + <a href="#">
  500 + <img class="img-responsive" src="/img/detailsquare.jpg" alt="">
  501 + </a>
  502 + </div>
  503 + <div class="name same-height-always">
  504 + <h5><a href="#">Blog post name</a></h5>
  505 + </div>
  506 + </div>
595 507  
596   - <!-- *** FOOTER END *** -->
  508 + <div class="item same-height-row clearfix">
  509 + <div class="image same-height-always">
  510 + <a href="#">
  511 + <img class="img-responsive" src="/img/detailsquare.jpg" alt="">
  512 + </a>
  513 + </div>
  514 + <div class="name same-height-always">
  515 + <h5><a href="#">Very very long blog post name</a></h5>
  516 + </div>
  517 + </div>
  518 + </div>
  519 +
  520 + <hr class="hidden-md hidden-lg">
  521 +
  522 + </div>
  523 + <!-- /.col-md-3 -->
  524 +
  525 + <div class="col-md-3 col-sm-6">
  526 +
  527 + <h4><?php echo \Yii::t('app', 'Contact'); ?></h4>
  528 +
  529 + <p>
  530 + <?php
  531 + echo $settings->name ? Html::tag('strong', $settings->name) : '';
  532 + echo $settings->office ? Html::tag('br') . $settings->office : '';
  533 + echo $settings->street ? Html::tag(
  534 + 'br'
  535 + ) . $settings->street . ' ' . $settings->house : '';
  536 + echo $settings->city ? Html::tag('br') . $settings->city : '';
  537 + echo $settings->country ? Html::tag('br') . Html::tag(
  538 + 'strong',
  539 + $settings->country
  540 + ) : '';
  541 + ?>
  542 + </p>
  543 +
  544 + <a href="contact.html" class="btn btn-small btn-template-main">Go to contact page</a>
  545 +
  546 + <hr class="hidden-md hidden-lg hidden-sm">
  547 +
597 548 </div>
598   - <!-- /#all -->
599   - <?php $this->endBody() ?>
600   - </body>
601   - </html>
  549 + <!-- /.col-md-3 -->
  550 +
  551 +
  552 + <div class="col-md-3 col-sm-6">
  553 +
  554 + <h4><?php echo \Yii::t('app', 'Photostream'); ?></h4>
  555 +
  556 + <div class="photostream">
  557 + <div>
  558 + <a href="#">
  559 + <img src="/img/detailsquare.jpg" class="img-responsive" alt="#">
  560 + </a>
  561 + </div>
  562 + <div>
  563 + <a href="#">
  564 + <img src="/img/detailsquare2.jpg" class="img-responsive" alt="#">
  565 + </a>
  566 + </div>
  567 + <div>
  568 + <a href="#">
  569 + <img src="/img/detailsquare3.jpg" class="img-responsive" alt="#">
  570 + </a>
  571 + </div>
  572 + <div>
  573 + <a href="#">
  574 + <img src="/img/detailsquare3.jpg" class="img-responsive" alt="#">
  575 + </a>
  576 + </div>
  577 + <div>
  578 + <a href="#">
  579 + <img src="/img/detailsquare2.jpg" class="img-responsive" alt="#">
  580 + </a>
  581 + </div>
  582 + <div>
  583 + <a href="#">
  584 + <img src="/img/detailsquare.jpg" class="img-responsive" alt="#">
  585 + </a>
  586 + </div>
  587 + </div>
  588 +
  589 + </div>
  590 + <!-- /.col-md-3 -->
  591 + </div>
  592 + <!-- /.container -->
  593 + </footer>
  594 + <!-- /#footer -->
  595 +
  596 + <!-- *** FOOTER END *** -->
  597 + </div>
  598 + <!-- /#all -->
  599 + <?php $this->endBody() ?>
  600 + </body>
  601 + </html>
602 602 <?php $this->endPage() ?>
603 603 \ No newline at end of file
... ...
frontend/views/product/view.php
... ... @@ -75,7 +75,7 @@
75 75 </div>
76 76  
77 77 <?php
78   - if ($model->is(2)) {
  78 + if ($model->is('akcia')) {
79 79 ?>
80 80 <div class="ribbon sale">
81 81 <div class="theribbon">SALE</div>
... ... @@ -84,7 +84,7 @@
84 84 <!-- /.ribbon -->
85 85 <?php
86 86 }
87   - if ($model->is(1)) {
  87 + if ($model->is('new')) {
88 88 ?>
89 89 <div class="ribbon new">
90 90 <div class="theribbon">NEW</div>
... ...
frontend/views/site/_slider_product.php
... ... @@ -47,9 +47,9 @@
47 47 <p class="price">
48 48 <?php
49 49 if ($product->variants[ 0 ]->price_old) {
50   - echo Html::tag('del', $product->variants[ 0 ]->price_old);
  50 + echo Html::tag('del', $product->variants[ 0 ]->price_old . ' грн.');
51 51 }
52   - echo $product->variants[ 0 ]->price;
  52 + echo $product->variants[ 0 ]->price ? : 0 . ' грн.';
53 53 ?></p>
54 54 <p class="buttons">
55 55 <?php
... ... @@ -69,7 +69,7 @@
69 69 </div>
70 70 <!-- /.text -->
71 71 <?php
72   - if ($product->is(1)) {
  72 + if ($product->is('new')) {
73 73 ?>
74 74 <div class="ribbon new">
75 75 <div class="theribbon"><?php echo \Yii::t('app', 'Новое'); ?></div>
... ... @@ -77,7 +77,7 @@
77 77 </div>
78 78 <?php
79 79 }
80   - if ($product->is(2)) {
  80 + if ($product->is('akcia')) {
81 81 ?>
82 82 <div class="ribbon sale">
83 83 <div class="theribbon"><?php echo \Yii::t('app', 'Акция'); ?></div>
... ...
frontend/views/special/category.php 0 → 100644
  1 +<?php
  2 + /**
  3 + * @var \yii\web\View $this
  4 + * @var \artbox\catalog\models\Category $model
  5 + * @var \yii\data\ActiveDataProvider $dataProvider
  6 + */
  7 + use artbox\catalog\models\Product;
  8 + use yii\bootstrap\Html;
  9 + use yii\widgets\LinkPager;
  10 + use yii\widgets\ListView;
  11 +
  12 + $seo = \Yii::$app->get('seo');
  13 + $view = $this;
  14 + $type = \Yii::$app->request->get('type');
  15 + $this->params[ 'breadcrumbs' ][] = [
  16 + 'label' => \Yii::t(
  17 + 'app',
  18 + 'Все {type}',
  19 + [
  20 + 'type' => ( $type === 'new' ) ? \Yii::t('app', 'новинки') : \Yii::t(
  21 + 'app',
  22 + 'акционные'
  23 + ),
  24 + ]
  25 + ),
  26 + 'url' => [
  27 + 'special/index',
  28 + 'type' => $type,
  29 + ],
  30 + ];
  31 + $this->params[ 'breadcrumbs' ][] = $seo->title ? : ( ( $type === 'new' ) ? \Yii::t('app', 'Новинки') : \Yii::t(
  32 + 'app',
  33 + 'Акционные'
  34 + ) ) . ' ' . $model->lang->title;
  35 +?>
  36 +<div id="content">
  37 + <div class="container">
  38 +
  39 + <div class="row">
  40 +
  41 + <div class="col-sm-12">
  42 +
  43 + <?php
  44 + echo ListView::widget(
  45 + [
  46 + 'options' => [
  47 + 'class' => 'row products',
  48 + ],
  49 + 'itemOptions' => [
  50 + 'tag' => false,
  51 + ],
  52 + 'layout' => '{items}',
  53 + 'dataProvider' => $dataProvider,
  54 + 'itemView' => function ($model) use ($view) {
  55 + /**
  56 + * @var Product $model
  57 + */
  58 + return $view->render(
  59 + '@frontend/views/category/_product_item',
  60 + [
  61 + 'product' => $model,
  62 + ]
  63 + );
  64 + },
  65 + ]
  66 + );
  67 + echo Html::tag(
  68 + 'div',
  69 + LinkPager::widget(
  70 + [
  71 + 'pagination' => $dataProvider->pagination,
  72 + ]
  73 + ),
  74 + [
  75 + 'class' => 'pages',
  76 + ]
  77 + );
  78 + ?>
  79 +
  80 + </div>
  81 +
  82 + </div>
  83 +
  84 + </div>
  85 + <!-- /.container -->
  86 +</div>
  87 +<!-- /#content -->
... ...
frontend/views/special/index.php 0 → 100644
  1 +<?php
  2 + /**
  3 + * @var \yii\web\View $this
  4 + * @var \artbox\catalog\models\Category[] $categories
  5 + * @var \yii\data\ActiveDataProvider $dataProvider
  6 + */
  7 + use artbox\catalog\models\Product;
  8 + use yii\bootstrap\Html;
  9 + use yii\widgets\LinkPager;
  10 + use yii\widgets\ListView;
  11 +
  12 + $type = \Yii::$app->request->get('type');
  13 + $seo = \Yii::$app->get('seo');
  14 + $view = $this;
  15 + $this->params[ 'breadcrumbs' ][] = $seo->title ? : \Yii::t(
  16 + 'app',
  17 + 'Все {type}',
  18 + [
  19 + 'type' => ( $type === 'new' ) ? \Yii::t('app', 'новинки') : \Yii::t(
  20 + 'app',
  21 + 'акционные'
  22 + ),
  23 + ]
  24 + );
  25 +?>
  26 +<div id="content">
  27 + <div class="container">
  28 +
  29 + <div class="row">
  30 +
  31 +
  32 + <!-- *** LEFT COLUMN ***
  33 +_________________________________________________________ -->
  34 +
  35 + <div class="col-sm-3">
  36 + <div class="panel panel-default sidebar-menu">
  37 + <div class="panel-body">
  38 + <ul class="nav nav-pills nav-stacked category-menu">
  39 + <li>
  40 + <?php
  41 + foreach ($categories as $category) {
  42 + echo Html::a(
  43 + $category->lang->title,
  44 + [
  45 + 'special/category',
  46 + 'type' => $type,
  47 + 'category' => $category->lang->alias->value,
  48 + ]
  49 + );
  50 + }
  51 + ?>
  52 + </li>
  53 + </ul>
  54 + </div>
  55 + </div>
  56 + </div>
  57 + <!-- /.col-md-3 -->
  58 +
  59 + <!-- *** LEFT COLUMN END *** -->
  60 +
  61 + <!-- *** RIGHT COLUMN ***
  62 +_________________________________________________________ -->
  63 +
  64 + <div class="col-sm-9">
  65 +
  66 + <?php
  67 + echo ListView::widget(
  68 + [
  69 + 'options' => [
  70 + 'class' => 'row products',
  71 + ],
  72 + 'itemOptions' => [
  73 + 'tag' => false,
  74 + ],
  75 + 'layout' => '{items}',
  76 + 'dataProvider' => $dataProvider,
  77 + 'itemView' => function ($model) use ($view) {
  78 + /**
  79 + * @var Product $model
  80 + */
  81 + return $view->render(
  82 + '@frontend/views/category/_product_item',
  83 + [
  84 + 'product' => $model,
  85 + ]
  86 + );
  87 + },
  88 + ]
  89 + );
  90 + echo Html::tag(
  91 + 'div',
  92 + LinkPager::widget(
  93 + [
  94 + 'pagination' => $dataProvider->pagination,
  95 + ]
  96 + ),
  97 + [
  98 + 'class' => 'pages',
  99 + ]
  100 + );
  101 + ?>
  102 +
  103 + </div>
  104 + <!-- /.col-md-9 -->
  105 +
  106 + <!-- *** RIGHT COLUMN END *** -->
  107 +
  108 + </div>
  109 +
  110 + </div>
  111 + <!-- /.container -->
  112 +</div>
  113 +<!-- /#content -->
  114 +
... ...
frontend/widgets/LangLink.php
... ... @@ -68,6 +68,39 @@
68 68 } else {
69 69 $this->links[ $languageId ] = $url;
70 70 }
  71 + } elseif (\Yii::$app->requestedRoute == 'special/category') {
  72 + $aliasValue = \Yii::$app->request->get('category');
  73 + if (!empty($aliasValue)) {
  74 + $aliases = Alias::find()
  75 + ->where(
  76 + [
  77 + 'route' => Alias::find()
  78 + ->select('route')
  79 + ->where([ 'value' => $aliasValue ]),
  80 + ]
  81 + )
  82 + ->andWhere(
  83 + [
  84 + 'language_id' => [
  85 + $languageId,
  86 + Language::getCurrent()->id,
  87 + ],
  88 + ]
  89 + )
  90 + ->asArray()
  91 + ->all();
  92 + $map = $this->mapAliases($aliases);
  93 + $params = $this->replaceParams($map);
  94 + $this->links[ $languageId ] = Html::a(
  95 + $url,
  96 + Url::to(
  97 + [ \Yii::$app->requestedRoute ] + $params + [ 'language_id' => $languageId ],
  98 + true
  99 + )
  100 + );
  101 + } else {
  102 + $this->links[ $languageId ] = $url;
  103 + }
71 104 } else {
72 105 $this->links[ $languageId ] = Html::a(
73 106 $url,
... ... @@ -115,7 +148,9 @@
115 148 protected function replaceParams(array $map): array
116 149 {
117 150 $params = \Yii::$app->request->get();
118   - $filter = explode('_', $params[ 'filter' ]);
  151 + if (isset($params[ 'filter' ])) {
  152 + $filter = explode('_', $params[ 'filter' ]);
  153 + }
119 154 if (array_key_exists($params[ 'category' ], $map)) {
120 155 $params[ 'category' ] = $map[ $params[ 'category' ] ];
121 156 }
... ...