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 | 14 | use yii\base\InvalidParamException; |
| 15 | 15 | use yii\db\ActiveQuery; |
| 16 | 16 | use yii\db\ActiveRecord; |
| 17 | + use yii\db\Query; | |
| 17 | 18 | use yii\helpers\ArrayHelper; |
| 18 | 19 | use yii\web\NotFoundHttpException; |
| 19 | 20 | use yii\web\Request; |
| ... | ... | @@ -371,10 +372,27 @@ |
| 371 | 372 | public function getFullName():string |
| 372 | 373 | { |
| 373 | 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 | 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 | 394 | } else { |
| 377 | - $name = $name . $this->category->lang->title . ' '; | |
| 395 | + $name = $name . ($groupName ? $groupName : $this->category->lang->title) . ' '; | |
| 378 | 396 | } |
| 379 | 397 | |
| 380 | 398 | if (!empty( $this->brand )) { | ... | ... |
models/TaxGroup.php
| ... | ... | @@ -16,6 +16,8 @@ |
| 16 | 16 | * @property boolean $is_filter |
| 17 | 17 | * @property integer $level |
| 18 | 18 | * @property integer $sort |
| 19 | + * @property integer $use_in_name | |
| 20 | + * @property string $meta_robots | |
| 19 | 21 | * @property boolean $display |
| 20 | 22 | * @property boolean $is_menu |
| 21 | 23 | * @property string $remote_id |
| ... | ... | @@ -97,10 +99,15 @@ |
| 97 | 99 | 'level', |
| 98 | 100 | 'sort', |
| 99 | 101 | 'position', |
| 102 | + 'use_in_name', | |
| 100 | 103 | ], |
| 101 | 104 | 'integer', |
| 102 | 105 | ], |
| 103 | 106 | [ |
| 107 | + ['meta_robots'], | |
| 108 | + 'string' | |
| 109 | + ], | |
| 110 | + [ | |
| 104 | 111 | [ 'categories' ], |
| 105 | 112 | 'safe', |
| 106 | 113 | ], |
| ... | ... | @@ -113,13 +120,15 @@ |
| 113 | 120 | public function attributeLabels() |
| 114 | 121 | { |
| 115 | 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 | 55 | |
| 56 | 56 | <?= $form->field($model, 'is_menu') |
| 57 | 57 | ->checkbox() ?> |
| 58 | - | |
| 58 | + | |
| 59 | + <?= $form->field($model, 'use_in_name') | |
| 60 | + ->checkbox() ?> | |
| 61 | + | |
| 59 | 62 | <?= $form->field($model, 'sort') |
| 60 | 63 | ->textInput() ?> |
| 61 | - | |
| 64 | + | |
| 65 | + <?= $form->field($model, 'meta_robots') | |
| 66 | + ->textInput() ?> | |
| 62 | 67 | <?php |
| 63 | 68 | echo LanguageForm::widget( |
| 64 | 69 | [ | ... | ... |