Commit bac5886caeb477849874f4566101096d32541bb3
1 parent
fba5bd03
-
Showing
5 changed files
with
24 additions
and
10 deletions
Show diff stats
common/translation/ru/product.php
| @@ -8,4 +8,8 @@ return [ | @@ -8,4 +8,8 @@ return [ | ||
| 8 | 'Remote ID' => 'ID в 1С', | 8 | 'Remote ID' => 'ID в 1С', |
| 9 | 'Search for "{keywords}"' => 'Поиск по "{keywords}"', | 9 | 'Search for "{keywords}"' => 'Поиск по "{keywords}"', |
| 10 | 'Search for "{keywords}" in category "{category}"' => 'Поиск по "{keywords}" в категории "{category}"', | 10 | 'Search for "{keywords}" in category "{category}"' => 'Поиск по "{keywords}" в категории "{category}"', |
| 11 | + 'Promo products' => 'Акционные товары', | ||
| 12 | + 'New products' => 'Новинки', | ||
| 13 | + 'Top products' => 'Популярные', | ||
| 14 | + '' => '', | ||
| 11 | ]; | 15 | ]; |
| 12 | \ No newline at end of file | 16 | \ No newline at end of file |
frontend/views/site/index.php
| @@ -29,7 +29,7 @@ echo BannerWidget::widget(['title' => 'HOME_UNDER_SLIDER_3']); | @@ -29,7 +29,7 @@ echo BannerWidget::widget(['title' => 'HOME_UNDER_SLIDER_3']); | ||
| 29 | echo '</div>'; | 29 | echo '</div>'; |
| 30 | ?> | 30 | ?> |
| 31 | 31 | ||
| 32 | -<?= \frontend\widgets\Rubrics::widget(['wrapper' => 'rubrics'])?> | 32 | +<?= \frontend\widgets\Rubrics::widget(['wrapper' => 'rubrics', 'includes' => [117,118,119,120,121]])?> |
| 33 | 33 | ||
| 34 | <?= \common\modules\product\widgets\specialProducts::widget(['type' => 'promo'])?> | 34 | <?= \common\modules\product\widgets\specialProducts::widget(['type' => 'promo'])?> |
| 35 | <?= \common\modules\product\widgets\specialProducts::widget(['type' => 'new'])?> | 35 | <?= \common\modules\product\widgets\specialProducts::widget(['type' => 'new'])?> |
frontend/web/css/style.css
| @@ -90,11 +90,11 @@ a.myorders{color:#f75d50} | @@ -90,11 +90,11 @@ a.myorders{color:#f75d50} | ||
| 90 | .rubrics ul{list-style:none;margin:0px;padding:0px;} | 90 | .rubrics ul{list-style:none;margin:0px;padding:0px;} |
| 91 | .rubrics ul li{float:left;margin:0px 35px;} | 91 | .rubrics ul li{float:left;margin:0px 35px;} |
| 92 | .rubrics ul li a{float:left;width:120px;padding-top:130px;text-align:center;text-transform: uppercase;color:#494949;text-decoration:none;font-weight:bold;} | 92 | .rubrics ul li a{float:left;width:120px;padding-top:130px;text-align:center;text-transform: uppercase;color:#494949;text-decoration:none;font-weight:bold;} |
| 93 | -.rubrics ul li.item1 a{background:url('../img/ico1.png') no-repeat;} | ||
| 94 | -.rubrics ul li.item2 a{background:url('../img/ico2.png') no-repeat;} | ||
| 95 | -.rubrics ul li.item3 a{background:url('../img/ico3.png') no-repeat;} | ||
| 96 | -.rubrics ul li.item4 a{background:url('../img/ico4.png') no-repeat;} | ||
| 97 | -.rubrics ul li.item5 a{background:url('../img/ico5.png') no-repeat;} | 93 | +.rubrics ul li.item_ryukzaki a{background:url('../img/ico1.png') no-repeat;} |
| 94 | +.rubrics ul li.item_sumki a{background:url('../img/ico2.png') no-repeat;} | ||
| 95 | +.rubrics ul li.item_chehly a{background:url('../img/ico3.png') no-repeat;} | ||
| 96 | +.rubrics ul li.item_nesessery a{background:url('../img/ico4.png') no-repeat;} | ||
| 97 | +.rubrics ul li.item_koshelki a{background:url('../img/ico5.png') no-repeat;} | ||
| 98 | 98 | ||
| 99 | 99 | ||
| 100 | .products{border-top:1px solid #d2d2d2;padding-bottom:30px;padding-top:20px;} | 100 | .products{border-top:1px solid #d2d2d2;padding-bottom:30px;padding-top:20px;} |
frontend/widgets/Rubrics.php
| @@ -14,9 +14,13 @@ class Rubrics extends Widget { | @@ -14,9 +14,13 @@ class Rubrics extends Widget { | ||
| 14 | 14 | ||
| 15 | public $wrapper = ''; | 15 | public $wrapper = ''; |
| 16 | 16 | ||
| 17 | + public $includes = []; | ||
| 18 | + | ||
| 19 | + private $categories = []; | ||
| 20 | + | ||
| 17 | public function run() | 21 | public function run() |
| 18 | { | 22 | { |
| 19 | - if (!empty($this->active)) { | 23 | + if (empty($this->active)) { |
| 20 | $this->active = Yii::$app->request->get('category'); | 24 | $this->active = Yii::$app->request->get('category'); |
| 21 | } | 25 | } |
| 22 | if (!is_object($this->active)) { | 26 | if (!is_object($this->active)) { |
| @@ -26,7 +30,14 @@ class Rubrics extends Widget { | @@ -26,7 +30,14 @@ class Rubrics extends Widget { | ||
| 26 | $this->active = $this->active->category_id; | 30 | $this->active = $this->active->category_id; |
| 27 | } | 31 | } |
| 28 | $items = []; | 32 | $items = []; |
| 29 | - foreach (Category::find ()->all () as $category) { | 33 | + |
| 34 | + if (empty($this->categories)) { | ||
| 35 | + $this->categories = Category::find ()->all(); | ||
| 36 | + } | ||
| 37 | + foreach ($this->categories as $category) { | ||
| 38 | + if (!empty($this->includes) && !in_array($category->category_id, $this->includes)) { | ||
| 39 | + continue; | ||
| 40 | + } | ||
| 30 | $items[] = $category;[ | 41 | $items[] = $category;[ |
| 31 | 'label' => $category->name , | 42 | 'label' => $category->name , |
| 32 | 'url' => Url::to(['catalog/category', 'category' => $category]), | 43 | 'url' => Url::to(['catalog/category', 'category' => $category]), |
frontend/widgets/views/rubrics.php
| @@ -5,9 +5,8 @@ use yii\widgets\Menu; | @@ -5,9 +5,8 @@ use yii\widgets\Menu; | ||
| 5 | <div class="<?= $wrapper?>"> | 5 | <div class="<?= $wrapper?>"> |
| 6 | <?php endif?> | 6 | <?php endif?> |
| 7 | <ul> | 7 | <ul> |
| 8 | - <?= $active?> | ||
| 9 | <?php foreach($items as $i => $category) :?> | 8 | <?php foreach($items as $i => $category) :?> |
| 10 | - <li class="item<?= $category->alias?><?= ($active == $category->category_id ? ' active' : '')?>"><?= \yii\helpers\Html::a($category->name, ['catalog/category', 'category' => $category])?></li> | 9 | + <li class="item_<?= $category->alias?><?= ($active == $category->category_id ? ' active' : '')?>"><?= \yii\helpers\Html::a($category->name, ['catalog/category', 'category' => $category])?></li> |
| 11 | <?php endforeach;?> | 10 | <?php endforeach;?> |
| 12 | </ul> | 11 | </ul> |
| 13 | <?php if(!empty($wrapper)) :?> | 12 | <?php if(!empty($wrapper)) :?> |