Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] get the breacrumb for a category #16

Open
ghost opened this issue Jan 15, 2021 · 2 comments
Open

[Feature] get the breacrumb for a category #16

ghost opened this issue Jan 15, 2021 · 2 comments

Comments

@ghost
Copy link

ghost commented Jan 15, 2021

Hi @griffinqiu ,

Hope you are all well !

I am stuck while trying to get the breadcrumb for a category.
Do you have an idea of how I can do that ?

Thanks for any insights or inputs on that

Cheers,
Luc Michalski

@griffinqiu
Copy link
Member

What is the maximum level of your scene?
Usually there are fewer levels.(Such as less than 5 levels). I will find by parent_id level by level.

@mgsmus
Copy link

mgsmus commented Sep 27, 2021

@lucmichalski Breadcrumb for a category means you have to query the anchestors of the given category

SET @categoryId= 8;

SELECT 
  parent.id
FROM 
  categories AS category, 
  categories AS parent 
WHERE 
  category.lft BETWEEN parent.lft 
  AND parent.rgt 
  AND category.id = @categoryId
ORDER BY 
  parent.lft;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants