jpryce Posted August 24, 2012 Share Posted August 24, 2012 Hi all Any one know how to modify code to show sub categories of a parent category when that parent has no products in it. All my products are neatly filed in their respective sub cats. When you click on the main category in tha catgory block on the left though you obviously get a blank page. I want it to show it's sub cats. Thanks James Link to comment Share on other sites More sharing options...
benjamin utterback Posted August 24, 2012 Share Posted August 24, 2012 Hello jpryce, Thank you for the message! I will go ahead and move this thread to the correct Discussion. This should be under Development. Thank you for choosing PrestaShop! _Benjamin Link to comment Share on other sites More sharing options...
tdr170 Posted August 24, 2012 Share Posted August 24, 2012 When you enter your products check both the parent and sub categories check boxes under Default category. Link to comment Share on other sites More sharing options...
jpryce Posted August 27, 2012 Author Share Posted August 27, 2012 sorry, that's not what i meant. i only want the products to show in the sub cats. therefore they can't be in the parent cat. the problem then is that when you navigate to the parent cat you get a blank page. i want it to show the parents sub category images and descriptions that would then click through to the respective product lists. Link to comment Share on other sites More sharing options...
tdr170 Posted August 28, 2012 Share Posted August 28, 2012 This may also depend on the version and theme of your prestashop but start here. Try this look to your category.tpl file located in themes/yourrheme and see if you have this: <!-- Subcategories --> <div id="subcategories" style="display:none"> <h3>{l s='Subcategories'}</h3> <ul class="inline_list"> {foreach from=$subcategories item=subcategory} If you do change <div id="subcategories" style="display:none"> to <div id="subcategories" > Link to comment Share on other sites More sharing options...
jmthd Posted September 26, 2012 Share Posted September 26, 2012 Ok but what if my theme's category.tpl file doesn't have that Subcategories div? There's more to it than just adding the above code where we want it right? Thanks Link to comment Share on other sites More sharing options...
jmthd Posted September 26, 2012 Share Posted September 26, 2012 Nevermind. I found the code for displaying Subcategories in another theme's category.tpl. I added the following and it worked: {if isset($subcategories)} <!-- Subcategories --> <div id="subcategories"> <h3>{l s='Subcategories'}</h3> <ul class="inline_list"> {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} </ul> <br class="clear"/> </div> {/if} Link to comment Share on other sites More sharing options...
supervalters Posted October 11, 2012 Share Posted October 11, 2012 I tried to use this snippet, but it didn't work for me, Prestashop 1.5. Is there any other possibility to show subcategories when clicked on category? 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