Commit 1c948efc2c7b88e7b3a6c9ca01d3517d126a1875

Authored by Yarik
1 parent c67585d7

Category path fixes

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