morgana28 Posted June 20, 2016 Share Posted June 20, 2016 Hello, When I display the contents of a category I would like to show all of its subcategories with their products in the same page. How can I do that? For example when I select “Category_1” from the main menu, the landing page would be: Category_1 title Category_1 description SubCategory_1 title SubCategory_1 description SubCategory_1 products SubCategory_2 title SubCategory_2 description SubCategory_2 products . . . SubCategory_n title SubCategory_n description SubCategory_n products Thanks in advance Link to comment Share on other sites More sharing options...
NemoPS Posted June 20, 2016 Share Posted June 20, 2016 It's going to be pretty resource intensive.In any case, you need to override the CategoryController file.There is a method named assignSubcategoriesInside it, once you have the subcategories in a variable, loop through them, instantiate a new Category object for each, using the ID, then user $category->getProducts() to get its products. I'd assign them to smarty afterwards, using the reference as key.It does need some work, I might write a tut about it next week Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now