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 | 45 | $category = $this->findCategory($id); |
46 | 46 | $purposes = TaxOption::find() |
47 | 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 | 57 | ->joinWith('products.categories.lang') |
54 | - ->joinWith('products.lang') | |
58 | + ->joinWith('products.lang') | |
55 | 59 | ->joinWith('products.brand.lang') |
56 | 60 | ->joinWith('taxGroup') |
57 | 61 | ->where([ |
... | ... | @@ -92,6 +96,15 @@ |
92 | 96 | $categories = Category::find() |
93 | 97 | ->joinWith('products.lang') |
94 | 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 | 108 | ->joinWith('products.options.lang') |
96 | 109 | ->where([ 'tax_option.tax_option_id' => $purpose->tax_option_id ]) |
97 | 110 | ->all(); | ... | ... |
frontend/controllers/SiteController.php
... | ... | @@ -7,17 +7,11 @@ |
7 | 7 | use common\models\Slider; |
8 | 8 | use common\modules\product\models\Category; |
9 | 9 | use common\modules\rubrication\models\TaxGroup; |
10 | - use Yii; | |
11 | - use yii\base\InvalidParamException; | |
12 | 10 | use yii\data\ActiveDataProvider; |
13 | 11 | use yii\web\BadRequestHttpException; |
14 | 12 | use yii\web\Controller; |
15 | 13 | use yii\filters\VerbFilter; |
16 | 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 | 15 | use yii\web\NotFoundHttpException; |
22 | 16 | |
23 | 17 | /** | ... | ... |