Amazzing Posted June 18, 2013 Share Posted June 18, 2013 Hello, By default, category.tpl displays list of subcategories and then the whole list of products, belonging to parent category. So the page layout is like that: Subcat1 Subcat2 Subcat3 list of products belonging to parent category... How can I display products, belonging to subcategories, under subcategory name?? What I need is: Subcat1 prod-1-1 prod-2-1 prod-3-1 prod-4-1 Subcat2 prod-1-2 prod-2-2 prod-3-2 prod-4-2 Subcat3 prod-1-3 prod-2-3 prod-3-3 prod-4-3 list of products belonging to parent category... What I found so far: Obviously we have to add product list inside this loop: {foreach from=$subcategories item=subcategory}...{/foreach} I tried adding {include file="./product-list.tpl" products=$products}, but it displays all products from parent category under each category. Is it possible to display ./product-list.tpl only for products related to particular subcategory only? Any answers or advices are appreciated. Link to comment Share on other sites More sharing options...
presta4you.com Posted June 18, 2013 Share Posted June 18, 2013 You can edit controllers/front/CategoryController.php. Inside this file is supported category page. Find $subcategories variable and add product to subcategory. After that modification you can edit file category.tpl. Link to comment Share on other sites More sharing options...
Amazzing Posted June 19, 2013 Author Share Posted June 19, 2013 You can edit controllers/front/CategoryController.php. Inside this file is supported category page. Find $subcategories variable and add product to subcategory. After that modification you can edit file category.tpl. Thank you for the advice, but I am not so good at PHP. Ok, I found protected function assignSubcategories() in CategoryController.php What exactly should I do to "and add product to subcategory"? Link to comment Share on other sites More sharing options...
Amazzing Posted September 15, 2013 Author Share Posted September 15, 2013 solution is posted here: http://www.prestashop.com/forums/topic/61907-displaying-all-products-from-subcategories-on-the-category-page/page-3?do=findComment&comment=1278016 Link to comment Share on other sites More sharing options...
PascalVG Posted September 17, 2013 Share Posted September 17, 2013 Then I mark the topic as solved. pascal Link to comment Share on other sites More sharing options...
HMagdy Posted April 22, 2015 Share Posted April 22, 2015 Is there any way for non technical users without coding .... just like a plugin or add on ? I found this solution https://www.prestashop.com/forums/topic/274914-stop-parent-category-displaying-all-sub-category-products/ by using "layered navigation block module" But still not working with me :@ 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