Commit d16773b73f7e0f78601d41262a1ea6a671ea07ff
Merge remote-tracking branch 'origin/master'
Showing
3 changed files
with
43 additions
and
11 deletions
Show diff stats
models/Product.php
@@ -14,6 +14,7 @@ | @@ -14,6 +14,7 @@ | ||
14 | use yii\base\InvalidParamException; | 14 | use yii\base\InvalidParamException; |
15 | use yii\db\ActiveQuery; | 15 | use yii\db\ActiveQuery; |
16 | use yii\db\ActiveRecord; | 16 | use yii\db\ActiveRecord; |
17 | + use yii\db\Query; | ||
17 | use yii\helpers\ArrayHelper; | 18 | use yii\helpers\ArrayHelper; |
18 | use yii\web\NotFoundHttpException; | 19 | use yii\web\NotFoundHttpException; |
19 | use yii\web\Request; | 20 | use yii\web\Request; |
@@ -371,10 +372,27 @@ | @@ -371,10 +372,27 @@ | ||
371 | public function getFullName():string | 372 | public function getFullName():string |
372 | { | 373 | { |
373 | $name = ''; | 374 | $name = ''; |
375 | + | ||
376 | + $groupName = (new Query())->select(['tax_option.*','tax_option_lang.*']) | ||
377 | + ->from([ 'tax_option' ]) | ||
378 | + ->innerJoin('tax_group', 'tax_group.id = tax_option.tax_group_id') | ||
379 | + ->innerJoin('tax_option_lang', 'tax_option.id = tax_option_lang.tax_option_id') | ||
380 | + ->innerJoin('tax_group_to_category', 'tax_group.id = tax_group_to_category.tax_group_id') | ||
381 | + ->where(['tax_group_to_category.category_id' => $this->category->id, 'tax_group.use_in_name'=>1, 'tax_option.id' => ArrayHelper::getColumn($this->options,'id')]) | ||
382 | + ->one(); | ||
383 | + | ||
384 | + | ||
385 | + if($groupName != null ){ | ||
386 | + $groupName = $groupName['value']; | ||
387 | + } else { | ||
388 | + $groupName = ''; | ||
389 | + } | ||
390 | + | ||
391 | + | ||
374 | if (!empty( $this->category->lang->category_synonym )) { | 392 | if (!empty( $this->category->lang->category_synonym )) { |
375 | - $name = $name . $this->category->lang->category_synonym . ' '; | 393 | + $name = $name . ($groupName ? $groupName : $this->category->lang->category_synonym) . ' '; |
376 | } else { | 394 | } else { |
377 | - $name = $name . $this->category->lang->title . ' '; | 395 | + $name = $name . ($groupName ? $groupName : $this->category->lang->title) . ' '; |
378 | } | 396 | } |
379 | 397 | ||
380 | if (!empty( $this->brand )) { | 398 | if (!empty( $this->brand )) { |
models/TaxGroup.php
@@ -16,6 +16,8 @@ | @@ -16,6 +16,8 @@ | ||
16 | * @property boolean $is_filter | 16 | * @property boolean $is_filter |
17 | * @property integer $level | 17 | * @property integer $level |
18 | * @property integer $sort | 18 | * @property integer $sort |
19 | + * @property integer $use_in_name | ||
20 | + * @property string $meta_robots | ||
19 | * @property boolean $display | 21 | * @property boolean $display |
20 | * @property boolean $is_menu | 22 | * @property boolean $is_menu |
21 | * @property string $remote_id | 23 | * @property string $remote_id |
@@ -97,10 +99,15 @@ | @@ -97,10 +99,15 @@ | ||
97 | 'level', | 99 | 'level', |
98 | 'sort', | 100 | 'sort', |
99 | 'position', | 101 | 'position', |
102 | + 'use_in_name', | ||
100 | ], | 103 | ], |
101 | 'integer', | 104 | 'integer', |
102 | ], | 105 | ], |
103 | [ | 106 | [ |
107 | + ['meta_robots'], | ||
108 | + 'string' | ||
109 | + ], | ||
110 | + [ | ||
104 | [ 'categories' ], | 111 | [ 'categories' ], |
105 | 'safe', | 112 | 'safe', |
106 | ], | 113 | ], |
@@ -113,13 +120,15 @@ | @@ -113,13 +120,15 @@ | ||
113 | public function attributeLabels() | 120 | public function attributeLabels() |
114 | { | 121 | { |
115 | return [ | 122 | return [ |
116 | - 'id' => 'Tax Group ID', | ||
117 | - 'is_filter' => 'Use in filter', | ||
118 | - 'sort' => 'Sort', | ||
119 | - 'display' => 'Display', | ||
120 | - 'is_menu' => 'Отображать в характеристиках', | ||
121 | - 'level' => 'уровень', | ||
122 | - 'ppsition' => 'Позиция', | 123 | + 'id' => 'Tax Group ID', |
124 | + 'is_filter' => 'Use in filter', | ||
125 | + 'sort' => 'Sort', | ||
126 | + 'display' => 'Display', | ||
127 | + 'is_menu' => 'Отображать в характеристиках', | ||
128 | + 'level' => 'уровень', | ||
129 | + 'position' => 'Позиция', | ||
130 | + 'meta_robots' => 'Meta Robots', | ||
131 | + 'use_in_name' => 'Использовать в названии', | ||
123 | ]; | 132 | ]; |
124 | } | 133 | } |
125 | 134 |
views/tax-group/_form.php
@@ -55,10 +55,15 @@ | @@ -55,10 +55,15 @@ | ||
55 | 55 | ||
56 | <?= $form->field($model, 'is_menu') | 56 | <?= $form->field($model, 'is_menu') |
57 | ->checkbox() ?> | 57 | ->checkbox() ?> |
58 | - | 58 | + |
59 | + <?= $form->field($model, 'use_in_name') | ||
60 | + ->checkbox() ?> | ||
61 | + | ||
59 | <?= $form->field($model, 'sort') | 62 | <?= $form->field($model, 'sort') |
60 | ->textInput() ?> | 63 | ->textInput() ?> |
61 | - | 64 | + |
65 | + <?= $form->field($model, 'meta_robots') | ||
66 | + ->textInput() ?> | ||
62 | <?php | 67 | <?php |
63 | echo LanguageForm::widget( | 68 | echo LanguageForm::widget( |
64 | [ | 69 | [ |