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 | 45 | $category = $this->findCategory($id); |
46 | 46 | $purposes = TaxOption::find() |
47 | 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 | 53 | ->joinWith('products.categories.lang') |
54 | + ->joinWith('products.lang') | |
50 | 55 | ->joinWith('products.brand.lang') |
51 | 56 | ->joinWith('taxGroup') |
52 | 57 | ->where([ |
... | ... | @@ -54,9 +59,6 @@ |
54 | 59 | 'tax_group.tax_group_id' => 5, |
55 | 60 | ]) |
56 | 61 | ->all(); |
57 | -// foreach($purposes as $purpose) { | |
58 | -// var_dump(count($purpose->products)); | |
59 | -// } | |
60 | 62 | $brands = []; |
61 | 63 | foreach($purposes as $purpose) { |
62 | 64 | /** | ... | ... |