async-postgres
async-postgres copied to clipboard
Getting all categories as a tree.
Possible to do this with graphql.
Ok not strictly rest api? But wonder if it is of use?
https://magentorooturl/graphql
{
category(id: 2) {
products {
total_count
page_info {
current_page
page_size
}
}
children_count
children {
id
level
name
path
children {
id
level
name
path
children {
id
level
name
path
children {
id
level
name
path
}
}
}
}
}
}
{
category(id: ${categoryId}) {
id
name
children {
id
name
children {
id
name
children {
id
name
}
}
}
}
}
Note: Does not return deactivated categorys!
Can try it in Altair GraphQL Client browser extension. chrome-extension://flnheeellpciglgpaodhkhmapeljopja/index.html
Vue Storefront seems to do it a different way. https://github.com/DivanteLtd/vue-storefront/blob/master/core/pages/Category.js