In this post I am going to explain how to get full sub-categories tree from root category id in PrestaShop 1.7.
1 2 3 4 5 6 7 8 9 10 11 12 13 | // Set your root category id $root_category_id = 2; // Set language id $language_id = $this->context->language->id; // Get category tree for given root category $category_tree = Category::getNestedCategories($root_category_id, $language_id); // Print category array and find the "children" element in each category echo "<pre>"; print_r($category_tree); echo "</pre>"; |
Thats it!
Write an article about ecommerce that help people to grow their ecommerce business. You’ll find best ecommerce guide, news, tips & more!
May 6, 2020 at 11:27 am
Perfectly described. Thanks for sharing such a useful article.