From 839d26cf11c10d522f242ec60c9bed087d9e2fc0 Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Wed, 30 Nov 2016 20:34:04 +0200 Subject: [PATCH] add variantSku --- models/Product.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/models/Product.php b/models/Product.php index de8bf22..570eae8 100755 --- a/models/Product.php +++ b/models/Product.php @@ -14,6 +14,7 @@ use yii\base\InvalidParamException; use yii\db\ActiveQuery; use yii\db\ActiveRecord; + use yii\db\Query; use yii\helpers\ArrayHelper; use yii\web\NotFoundHttpException; use yii\web\Request; @@ -371,10 +372,20 @@ public function getFullName():string { $name = ''; - $groupName = $this->category->getTaxGroups()->where(['use_in_name'=>1])->joinWith('lang')->one(); + + $groupName = (new Query())->select(['tax_option.*','tax_option_lang.*']) + ->from([ 'tax_option' ]) + ->innerJoin('tax_group', 'tax_group.id = tax_option.tax_group_id') + ->innerJoin('tax_option_lang', 'tax_option.id = tax_option_lang.tax_option_id') + ->innerJoin('tax_group_to_category', 'tax_group.id = tax_group_to_category.tax_group_id') + ->where(['tax_group_to_category.category_id' => $this->category->id, 'tax_group.use_in_name'=>1, 'tax_option.id' => ArrayHelper::getColumn($this->options,'id')]) + ->one(); + if($groupName != null ){ - $groupName->lang->title; + $groupName = $groupName['value']; + } else { + $groupName = ''; } -- libgit2 0.21.4