M
M
Maxim Volkov2021-12-01 09:49:11
nested set
Maxim Volkov, 2021-12-01 09:49:11

How to make menu items of Nested Set nested categories active?

On the website of an online store, a tree of product categories is built using the kalnoy/nestedset library .

Catalog menu displays only categories of the first level of nesting. Request in View Composers:

View::composer(['front.layouts.footer', 'front.layouts.menu_left'], function($view) {
            $view->with(['menu' => Category::where()->select('name', 'slug')->orderBy('sort')->get()]);
        });

  • How to make active menu items of the first parent product category if a child, nested category is open, for example, the 3rd nesting level?
  • What approaches exist to solve this problem?

I would be grateful for any idea or advice on how to solve the problem.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Ukolov, 2021-12-01
@alexey-m-ukolov

Well, the nested set is just perfect for this task - you check that the current open category lies within the boundaries of the parent one, and that's it. It's not very clear what the problem is.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question