Commit d441cb07f5864de13553691acf3a7d9e74983f5f
1 parent
c3c1539f
Filter fix
Showing
1 changed file
with
6 additions
and
4 deletions
Show diff stats
frontend/controllers/FilterController.php
| @@ -45,8 +45,13 @@ | @@ -45,8 +45,13 @@ | ||
| 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.lang') | 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 | + }]) | ||
| 49 | ->joinWith('products.categories.lang') | 53 | ->joinWith('products.categories.lang') |
| 54 | + ->joinWith('products.lang') | ||
| 50 | ->joinWith('products.brand.lang') | 55 | ->joinWith('products.brand.lang') |
| 51 | ->joinWith('taxGroup') | 56 | ->joinWith('taxGroup') |
| 52 | ->where([ | 57 | ->where([ |
| @@ -54,9 +59,6 @@ | @@ -54,9 +59,6 @@ | ||
| 54 | 'tax_group.tax_group_id' => 5, | 59 | 'tax_group.tax_group_id' => 5, |
| 55 | ]) | 60 | ]) |
| 56 | ->all(); | 61 | ->all(); |
| 57 | -// foreach($purposes as $purpose) { | ||
| 58 | -// var_dump(count($purpose->products)); | ||
| 59 | -// } | ||
| 60 | $brands = []; | 62 | $brands = []; |
| 61 | foreach($purposes as $purpose) { | 63 | foreach($purposes as $purpose) { |
| 62 | /** | 64 | /** |