Commit 55371b6cb506f378abeb5c255b3fb2cbaea09027
1 parent
391c98b4
-Get all children fix
Showing
4 changed files
with
18 additions
and
6 deletions
Show diff stats
common/components/artboxtree/ArtboxTreeBehavior.php
common/modules/product/models/Category.php
| ... | ... | @@ -297,9 +297,21 @@ class Category extends \yii\db\ActiveRecord |
| 297 | 297 | |
| 298 | 298 | public function getChildrenByDepth($depth) |
| 299 | 299 | { |
| 300 | - return $this->getAllChildren($depth)->where([ | |
| 301 | - 'depth' => $depth, | |
| 302 | - ])->asArray()->select(['category_id']); | |
| 300 | +// VarDumper::dump($this->getAllChildren($depth) | |
| 301 | +// | |
| 302 | +// ->where([ | |
| 303 | +// 'depth' => $depth, | |
| 304 | +// 'parent_id' => $this->getChildrenAL() | |
| 305 | +// ])->asArray()->select(['category_id'])->createCommand()->rawSql, 10, true); | |
| 306 | +// | |
| 307 | + | |
| 308 | + | |
| 309 | + return $this->getAllChildren($depth) | |
| 310 | + | |
| 311 | + ->where([ | |
| 312 | + 'depth' => $depth, | |
| 313 | + 'parent_id' => $this->getChildrenAL()->select('category_id')->column() | |
| 314 | + ])->asArray()->select(['category_id']); | |
| 303 | 315 | } |
| 304 | 316 | |
| 305 | 317 | public function setTaxGroup($value) | ... | ... |
frontend/controllers/CatalogController.php
frontend/views/layouts/main.php
| ... | ... | @@ -86,8 +86,8 @@ $brands = Category::find() |
| 86 | 86 | </div> |
| 87 | 87 | </li> |
| 88 | 88 | <li><a href="<?php echo Url::to([ |
| 89 | - 'product/index', | |
| 90 | - 'id' => 19, | |
| 89 | + 'catalog/category', | |
| 90 | + 'category' => 'brendy-oboev', | |
| 91 | 91 | ]); ?>">Обои</a></li> |
| 92 | 92 | <li><a href=" <?= Url::to(['catalog/category','category' => 'brendy-tekstilya']) ?>">Текстиль</a></li> |
| 93 | 93 | <?php foreach ($main_menu as $page) { ?> | ... | ... |