Commit 887985c7841e1a30d952a02537d8d40dcc33e5bc
1 parent
21aedefe
Filter fix
Showing
2 changed files
with
19 additions
and
12 deletions
Show diff stats
frontend/controllers/FilterController.php
| @@ -45,13 +45,17 @@ | @@ -45,13 +45,17 @@ | ||
| 45 | $category = $this->findCategory($id); | 45 | $category = $this->findCategory($id); |
| 46 | $purposes = TaxOption::find() | 46 | $purposes = TaxOption::find() |
| 47 | ->joinWith('lang', true, 'INNER JOIN') | 47 | ->joinWith('lang', true, 'INNER JOIN') |
| 48 | - ->joinWith(['products' => function($query)use($category) { | ||
| 49 | - $query->joinWith(['categories' => function($query)use($category) { | ||
| 50 | - $query->andWhere(['category.category_id' => $category->category_id]); | ||
| 51 | - }]); | ||
| 52 | - }]) | 48 | + ->joinWith([ |
| 49 | + 'products' => function($query) use ($category) { | ||
| 50 | + $query->joinWith([ | ||
| 51 | + 'categories' => function($query) use ($category) { | ||
| 52 | + $query->andWhere([ 'category.category_id' => $category->category_id ]); | ||
| 53 | + }, | ||
| 54 | + ]); | ||
| 55 | + }, | ||
| 56 | + ]) | ||
| 53 | ->joinWith('products.categories.lang') | 57 | ->joinWith('products.categories.lang') |
| 54 | - ->joinWith('products.lang') | 58 | + ->joinWith('products.lang') |
| 55 | ->joinWith('products.brand.lang') | 59 | ->joinWith('products.brand.lang') |
| 56 | ->joinWith('taxGroup') | 60 | ->joinWith('taxGroup') |
| 57 | ->where([ | 61 | ->where([ |
| @@ -92,6 +96,15 @@ | @@ -92,6 +96,15 @@ | ||
| 92 | $categories = Category::find() | 96 | $categories = Category::find() |
| 93 | ->joinWith('products.lang') | 97 | ->joinWith('products.lang') |
| 94 | ->joinWith('products.brand.lang') | 98 | ->joinWith('products.brand.lang') |
| 99 | + ->joinWith([ | ||
| 100 | + 'products' => function($query) use ($purpose) { | ||
| 101 | + $query->joinWith([ | ||
| 102 | + 'options' => function($query) use ($purpose) { | ||
| 103 | + $query->andWhere([ 'tax_option.tax_option_id' => $purpose->tax_option_id ]); | ||
| 104 | + }, | ||
| 105 | + ]); | ||
| 106 | + }, | ||
| 107 | + ]) | ||
| 95 | ->joinWith('products.options.lang') | 108 | ->joinWith('products.options.lang') |
| 96 | ->where([ 'tax_option.tax_option_id' => $purpose->tax_option_id ]) | 109 | ->where([ 'tax_option.tax_option_id' => $purpose->tax_option_id ]) |
| 97 | ->all(); | 110 | ->all(); |
frontend/controllers/SiteController.php
| @@ -7,17 +7,11 @@ | @@ -7,17 +7,11 @@ | ||
| 7 | use common\models\Slider; | 7 | use common\models\Slider; |
| 8 | use common\modules\product\models\Category; | 8 | use common\modules\product\models\Category; |
| 9 | use common\modules\rubrication\models\TaxGroup; | 9 | use common\modules\rubrication\models\TaxGroup; |
| 10 | - use Yii; | ||
| 11 | - use yii\base\InvalidParamException; | ||
| 12 | use yii\data\ActiveDataProvider; | 10 | use yii\data\ActiveDataProvider; |
| 13 | use yii\web\BadRequestHttpException; | 11 | use yii\web\BadRequestHttpException; |
| 14 | use yii\web\Controller; | 12 | use yii\web\Controller; |
| 15 | use yii\filters\VerbFilter; | 13 | use yii\filters\VerbFilter; |
| 16 | use yii\filters\AccessControl; | 14 | use yii\filters\AccessControl; |
| 17 | - use common\models\LoginForm; | ||
| 18 | - use frontend\models\PasswordResetRequestForm; | ||
| 19 | - use frontend\models\ResetPasswordForm; | ||
| 20 | - use frontend\models\SignupForm; | ||
| 21 | use yii\web\NotFoundHttpException; | 15 | use yii\web\NotFoundHttpException; |
| 22 | 16 | ||
| 23 | /** | 17 | /** |