Commit 839d26cf11c10d522f242ec60c9bed087d9e2fc0
1 parent
31fa2641
add variantSku
Showing
1 changed file
with
13 additions
and
2 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,20 @@ |
| 371 | 372 | public function getFullName():string |
| 372 | 373 | { |
| 373 | 374 | $name = ''; |
| 374 | - $groupName = $this->category->getTaxGroups()->where(['use_in_name'=>1])->joinWith('lang')->one(); | |
| 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 | + | |
| 375 | 384 | |
| 376 | 385 | if($groupName != null ){ |
| 377 | - $groupName->lang->title; | |
| 386 | + $groupName = $groupName['value']; | |
| 387 | + } else { | |
| 388 | + $groupName = ''; | |
| 378 | 389 | } |
| 379 | 390 | |
| 380 | 391 | ... | ... |