e-sh0p Posted January 16, 2012 Share Posted January 16, 2012 Hello, When browsing a category, I want to display the subcategories of the browsed category and the next level of subcategories in unordered list. Browsing category A will give Subcategory A.1 - Subcategory A.1.1 - Subcategory A.1.2 - Subcategory A.1.3 Subcategory A.2 - Subcategory A.2.1 - Subcategory A.2.2 - Subcategory A.2.3 I was trying to make a loop in the existing loop of the file category.tpl but it doesn't work, I need the syntaxe or the variable which contains the subcategories. I don't know if this exists or not? I don't find any documentation on that topic. In category.tpl we have: {foreach from=$subcategories item=subcategory} <li> <a href="{$link->getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'htmlall':'UTF-8'}" title="{$subcategory.name|escape:'htmlall':'UTF-8'}"> {if $subcategory.id_image} <img src="{$link->getCatImageLink($subcategory.link_rewrite, $subcategory.id_image, 'medium')}" alt="" width="{$mediumSize.width}" height="{$mediumSize.height}" /> {else} <img src="{$img_cat_dir}default-medium.jpg" alt="" width="{$mediumSize.width}" height="{$mediumSize.height}" /> {/if} </a><br /> <a href="{$link->getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'htmlall':'UTF-8'}">{$subcategory.name|escape:'htmlall':'UTF-8'}</a> </li> {/foreach} I need the variable, like $subcategories, which contains the subsubcategories or maybe I'm looking in the wrong direction? And after with the same logic I want to show all the categories and subcategories in the footer.. Any help is appreciated Link to comment Share on other sites More sharing options...
Mike Kranzler Posted January 16, 2012 Share Posted January 16, 2012 Hi e-sh0p, Have you already tried PrestaShop's built-in Layered Navigation Module? -Mike Link to comment Share on other sites More sharing options...
e-sh0p Posted January 16, 2012 Author Share Posted January 16, 2012 Hello Mike, Thanks for your suggestion, I have already tried this Module, but it's not really what I want. Basicly I just want to modify the category.tpl to display the subcategories of the subcategories displayed in the category. Thanks. Link to comment Share on other sites More sharing options...
e-sh0p Posted January 16, 2012 Author Share Posted January 16, 2012 I've tried with the loop found in the sitemap.tpl (because it's almost the same) but variables are missing from the sitemap.php so I added the line of sitemap.php in category.php but doesn't work too Link to comment Share on other sites More sharing options...
e-sh0p Posted February 15, 2012 Author Share Posted February 15, 2012 Still nobody? I've tried a lot of different loop with what I found in different tpl files, but it doesn't work Link to comment Share on other sites More sharing options...
e-sh0p Posted February 21, 2012 Author Share Posted February 21, 2012 I don't think it's impossible Is it? Link to comment Share on other sites More sharing options...
Martin89 Posted November 23, 2012 Share Posted November 23, 2012 I would like also display subcategories of a categorie on categorie.tpl, do you have find a solution? Link to comment Share on other sites More sharing options...
klubas Posted October 15, 2013 Share Posted October 15, 2013 (edited) Hello, I'm also interested in solution to show subcategories together with categories like in the first post. Added photo to show sample. Edited October 17, 2013 by klubas (see edit history) Link to comment Share on other sites More sharing options...
dformica Posted November 22, 2015 Share Posted November 22, 2015 Did anybody manage to list all subcategories in the category.tpl ? I also need this. 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