Commit 1c948efc2c7b88e7b3a6c9ca01d3517d126a1875

Authored by Yarik
1 parent c67585d7

Category path fixes

common/translation/ru/app.php
... ... @@ -183,4 +183,5 @@ return [
183 183 'Результаты поиска для' => 'Результаты поиска для',
184 184 'certs' => 'Сертификаты',
185 185 'All-list ' => 'Весь ',
  186 + 'Return back' => 'Вернуться назад',
186 187 ];
187 188 \ No newline at end of file
... ...
common/translation/ua/app.php
... ... @@ -183,4 +183,5 @@ return [
183 183 'Результаты поиска для' => 'Результати пошуку для',
184 184 'certs' => 'Сертифікати',
185 185 'All-list ' => 'Весь ',
  186 + 'Return back' => 'Повернутись назад',
186 187 ];
187 188 \ No newline at end of file
... ...
frontend/controllers/CollectionController.php
... ... @@ -17,6 +17,7 @@
17 17  
18 18 /**
19 19 * Displays article list.
  20 + *
20 21 * @return string
21 22 */
22 23 public function actionIndex($id)
... ... @@ -46,11 +47,13 @@
46 47 ->with('image')
47 48 ->where([ 'product_to_project.product_variant_id' => $variant->product_variant_id ])
48 49 ->all();
  50 + $referer = $this->checkReferer() ? \Yii::$app->request->referrer : NULL;
49 51 return $this->render('view', [
50 52 'collection' => $collection,
51 53 'variants' => $variants,
52 54 'variant' => $variant,
53 55 'projects' => $projects,
  56 + 'referer' => $referer,
54 57 ]);
55 58 }
56 59  
... ... @@ -75,4 +78,23 @@
75 78 }
76 79 return $model;
77 80 }
  81 +
  82 + /**
  83 + * @param string|NULL $referer
  84 + *
  85 + * @return bool
  86 + */
  87 + private function checkReferer(string $referer = NULL)
  88 + {
  89 + if($referer === NULL) {
  90 + $referer = \Yii::$app->request->referrer;
  91 + }
  92 + if(!empty( $referer )) {
  93 + $host = \Yii::$app->request->hostInfo;
  94 + if(strpos($referer, $host) === 0) {
  95 + return true;
  96 + }
  97 + }
  98 + return false;
  99 + }
78 100 }
... ...
frontend/views/collection/view.php
... ... @@ -5,6 +5,7 @@
5 5 * @var ProductVariant[] $variants
6 6 * @var ProductVariant $variant
7 7 * @var Project[] $projects
  8 + * @var string|null $referer
8 9 */
9 10 use common\components\artboximage\ArtboxImageHelper;
10 11 use common\models\Project;
... ... @@ -16,16 +17,22 @@
16 17 use yii\widgets\Pjax;
17 18  
18 19 $this->title = $collection->brand->lang->name . ' ' . $collection->lang->name;
  20 + if(!empty( $referer )) {
  21 + $this->params[ 'breadcrumbs' ][] = [
  22 + 'url' => $referer,
  23 + 'label' => \Yii::t('app', 'Return back'),
  24 + ];
  25 + }
19 26 $this->params[ 'breadcrumbs' ][] = $this->title;
20 27 $groups = $variant->getProperties();
21 28 ?>
22 29 <div class="section-box box-brand margin_bottom_30">
23 30 <div class="style new_articles-wr">
24 31 <?php
25   - Pjax::begin([
26   - 'id' => 'collection-pjax',
27   - 'timeout' => 5000,
28   - ]);
  32 + Pjax::begin([
  33 + 'id' => 'collection-pjax',
  34 + 'timeout' => 5000,
  35 + ]);
29 36 ?>
30 37 <div class="row">
31 38 <div class="col-xs-12 col-sm-12 articles_data-title uppercase">
... ... @@ -45,7 +52,7 @@
45 52 </div>
46 53 <table>
47 54 <tr>
48   - <td><?php echo Yii::t('app', 'Номер по каталогу');?>:</td>
  55 + <td><?php echo Yii::t('app', 'Номер по каталогу'); ?>:</td>
49 56 <td>
50 57 <?php
51 58 echo $variant->sku;
... ... @@ -78,7 +85,7 @@
78 85 <div class="style">
79 86 <?php
80 87 echo Html::a(\Yii::t('app', 'Заказать образец'), '#', [
81   - 'class' => 'to_order',
  88 + 'class' => 'to_order',
82 89 'data-id' => $variant->product_variant_id,
83 90 ]);
84 91 ?>
... ... @@ -89,7 +96,7 @@
89 96 <ul>
90 97 <?php
91 98 foreach($variants as $variant_item) {
92   - if(empty($variant_item->lang)) {
  99 + if(empty( $variant_item->lang )) {
93 100 continue;
94 101 }
95 102 echo Html::tag('li', Html::a(Html::tag('div', ArtboxImageHelper::getImage($variant_item->getImageUrl(), 'brand_collection_variant')) . Html::tag('p', $variant_item->lang->name), [
... ... @@ -105,7 +112,7 @@
105 112 </div>
106 113 </div>
107 114 <?php
108   - Pjax::end();
  115 + Pjax::end();
109 116 ?>
110 117 <div class="row">
111 118 <div class="col-xs-12 col-sm-12 collect-tabs">
... ... @@ -134,10 +141,10 @@
134 141 echo $collection->productSpec->lang->tech_spec_text;
135 142 }
136 143 if(!empty( $collection->productSpec->getTechSpecUrl() )) {
137   - echo Html::tag('p', \Yii::t('app', 'Документ технической документации').':' . Html::a(\Yii::t('app', 'скачать'), $collection->productSpec->getTechSpecUrl(), [ 'download' => true ]));
  144 + echo Html::tag('p', \Yii::t('app', 'Документ технической документации') . ':' . Html::a(\Yii::t('app', 'скачать'), $collection->productSpec->getTechSpecUrl(), [ 'download' => true ]));
138 145 }
139 146 if(!empty( $collection->productSpec->getTechCharUrl() )) {
140   - echo Html::tag('p', \Yii::t('app', 'Вы также можете скачать таблицу с ' ). Html::a(\Yii::t('app', 'техническими характеристиками'), $collection->productSpec->getTechCharUrl(), [ 'download' => true ]));
  147 + echo Html::tag('p', \Yii::t('app', 'Вы также можете скачать таблицу с ') . Html::a(\Yii::t('app', 'техническими характеристиками'), $collection->productSpec->getTechCharUrl(), [ 'download' => true ]));
141 148 }
142 149 ?>
143 150 </div>
... ... @@ -149,10 +156,10 @@
149 156 <?php
150 157 foreach($collection->productCertificates as $productCertificate) {
151 158 echo Html::tag('div', Html::tag('iframe', '', [
152   - 'class' => 'certificate',
  159 + 'class' => 'certificate',
153 160 'frameborder' => 0,
154   - 'src' => 'http://docs.google.com/gview?url='.Url::to('/storage/certificates/'.$collection->product_id.'/'.$productCertificate->link, true).'&embedded=true',
155   - ]), ['class' => 'col-xs-12 col-sm-6 col-md-4 col-lg-4']);
  161 + 'src' => 'http://docs.google.com/gview?url=' . Url::to('/storage/certificates/' . $collection->product_id . '/' . $productCertificate->link, true) . '&embedded=true',
  162 + ]), [ 'class' => 'col-xs-12 col-sm-6 col-md-4 col-lg-4' ]);
156 163 }
157 164 ?>
158 165 </div>
... ...
frontend/views/filter/brand.php
... ... @@ -14,6 +14,7 @@
14 14 use common\modules\rubrication\models\TaxOption;
15 15 use yii\data\ActiveDataProvider;
16 16 use yii\helpers\Html;
  17 + use yii\helpers\Url;
17 18 use yii\web\View;
18 19 use yii\widgets\ListView;
19 20  
... ... @@ -40,9 +41,10 @@
40 41 'purpose_id' => $purpose->tax_option_id,
41 42 ],
42 43 ];
43   - $this->params[ 'breadcrumbs' ][] = $this->title;
  44 + $this->params[ 'breadcrumbs' ][] = $brand->lang->name;
44 45 ?>
45   -<div class="section-box box-title-1 uppercase"><?= $this->title ?></div>
  46 +<div class="section-box box-title-1 uppercase"><?= $brand->lang->name ?></div>
  47 +<div class="section-box box-title-3 uppercase"><?= $category->lang->name . ' ' . mb_strtolower($purpose->lang->value) ?></div>
46 48 <div class="section-box box-brand margin_bottom_30">
47 49 <div class="row">
48 50 <div class="style" style="position: relative">
... ...
frontend/views/filter/category-brand.php
... ... @@ -2,7 +2,6 @@
2 2 /**
3 3 * @var View $this
4 4 * @var Category $category
5   - * @var TaxOption $purpose
6 5 * @var Brand $brand
7 6 * @var ProductSearch $searchModel
8 7 * @var ActiveDataProvider $dataProvider
... ... @@ -11,12 +10,11 @@
11 10 use common\modules\product\models\Brand;
12 11 use common\modules\product\models\Category;
13 12 use common\modules\product\models\ProductSearch;
14   - use common\modules\rubrication\models\TaxOption;
15 13 use yii\data\ActiveDataProvider;
16 14 use yii\web\View;
17 15 use yii\widgets\ListView;
18 16  
19   - $this->title = $category->lang->name . ' ' . $brand->lang->name . ' ' . mb_strtolower($purpose->lang->value);
  17 + $this->title = $category->lang->name . ' ' . $brand->lang->name;
20 18 $this->params[ 'breadcrumbs' ][] = [
21 19 'label' => $category->lang->name,
22 20 'url' => [
... ... @@ -25,18 +23,10 @@
25 23 ],
26 24 ];
27 25 $this->params[ 'breadcrumbs' ][] = [
28   - 'label' => $purpose->lang->value,
  26 + 'label' => \Yii::t('product', 'Brands').' '.$category->lang->name,
29 27 'url' => [
30   - 'filter/purpose',
31   - 'id' => $purpose->tax_option_id,
32   - ],
33   - ];
34   - $this->params[ 'breadcrumbs' ][] = [
35   - 'label' => $category->lang->name . ' ' . mb_strtolower($purpose->lang->value),
36   - 'url' => [
37   - 'filter/index',
  28 + 'filter/category-brands',
38 29 'category_id' => $category->category_id,
39   - 'purpose_id' => $purpose->tax_option_id,
40 30 ],
41 31 ];
42 32 $this->params[ 'breadcrumbs' ][] = $this->title;
... ...
frontend/views/filter/index.php
... ... @@ -28,7 +28,8 @@
28 28 ];
29 29 $this->params[ 'breadcrumbs' ][] = $this->title;
30 30 ?>
31   -<div class="section-box box-title-1 uppercase"><?= $this->title; ?></div>
  31 +<div class="section-box box-title-1 uppercase"><?= $category->lang->name; ?></div>
  32 +<div class="section-box box-title-3 uppercase"><?= $purpose->lang->value; ?></div>
32 33 <div class="section-box box-brand margin_bottom_30">
33 34 <div class="row">
34 35 <div class="col-xs-12 col-sm-9 col-md-7 col-lg-7">
... ...
frontend/web/css/style.min.css
... ... @@ -420,7 +420,8 @@ ul.main-menu li:hover ul {
420 420  
421 421 ul.main-menu li:hover ul li {
422 422 width: 100%;
423   - height: 44px;
  423 + overflow: hidden;
  424 + height: auto;
424 425 background: #fff;
425 426 border-top: 1px solid #dedfe0
426 427 }
... ... @@ -438,6 +439,12 @@ ul.main-menu li:first-child ul li a:before {
438 439 display: none
439 440 }
440 441  
  442 +ul.main-menu li ul li a {
  443 + line-height: 19px;
  444 + padding: 15px 5px 14px 24px !important;
  445 + white-space: normal;
  446 +}
  447 +
441 448 .lang-wr {
442 449 position: absolute;
443 450 height: 43px;
... ... @@ -1763,6 +1770,7 @@ ul.main-menu li:first-child ul li a:before {
1763 1770 float: left;
1764 1771 margin-top: 15px;
1765 1772 }
  1773 +
1766 1774 ul.breadcrumb {
1767 1775 width: 100%;
1768 1776 float: left;
... ... @@ -1837,7 +1845,7 @@ ul.breadcrumb li a {
1837 1845 }
1838 1846  
1839 1847 .link-cat:before {
1840   - height:75px;
  1848 + height: 75px;
1841 1849 background: #000;
1842 1850 opacity: 0.5;
1843 1851 }
... ... @@ -3082,6 +3090,7 @@ ul.breadcrumb li a {
3082 3090 height: 100%;
3083 3091 }
3084 3092 }
  3093 +
3085 3094 @media (max-width: 850px) {
3086 3095 .link-cat {
3087 3096 height: 136px
... ...