tempomania Posted April 8, 2010 Share Posted April 8, 2010 Hello Folks!I wonder if it possible (and how) to display subcategories of a parent category like the list of products in a category (of course without price info etc) and with the related text set for the subcategory.Any help is really appreciated.Paolo Link to comment Share on other sites More sharing options...
tempomania Posted April 18, 2010 Author Share Posted April 18, 2010 ok, I did it myself. Link to comment Share on other sites More sharing options...
rocky Posted April 18, 2010 Share Posted April 18, 2010 Can you please share the code you used to do it? Link to comment Share on other sites More sharing options...
tempomania Posted April 18, 2010 Author Share Posted April 18, 2010 I opened the file mytheme/category.tpl and modified the HMTL content of the foreach loop this way: > {foreach from=$subcategories item=subcategory} </pre> <table width="500" style="margin-left:20px;margin-bottom:10px;border:1px solid;" border="0" cellspacing="2" cellpadding="2"> getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'htmlall':'UTF-8'}" title="{$subcategory.name|escape:'htmlall':'UTF-8'}"> {if $subcategory.id_image} getCatImageLink($subcategory.link_rewrite, $subcategory.id_image, 'medium')}" alt="" /> {else} {/if} <!-- COLLEGAMENTO SOTTOCATEGORIA --> getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'htmlall':'UTF-8'}">{$subcategory.name|escape:'htmlall':'UTF-8'} {$subcategory.description} </table> <br><br> {/foreach It's just what I did for my site but can be done in 1000 different ways provided someone know a bit of coding.The result is attached. Link to comment Share on other sites More sharing options...
Sanis Posted August 25, 2010 Share Posted August 25, 2010 I was looking for the same thing and stumbled across this post. The code provided by tempomania grabs subcat descriptions and displays it in parent category. Shouldnt this result in duplicate content?Is there a module which adds category short description, same as products?To answer my question:i simply added extra field in 'ps_category_lang' named 'shortdescription'added few lines to classes/category.phpput this in category.tpl {$subcategory.shortdescription} and it works!Prestashop is way too easy to modify for someone with 0 coding experience! Link to comment Share on other sites More sharing options...
bijububu Posted September 16, 2010 Share Posted September 16, 2010 >{foreach from=$subcategories item=subcategory} </pre> <table width="510" style="margin-left:10px;margin-bottom:10px;border:1px solid;" border="0" cellspacing="2" cellpadding="2"> 0}class="no-bg"{/if}> {if $subcategory.id_image>0} getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'htmlall':'UTF-8'}" title="{$subcategory.name|escape:'htmlall':'UTF-8'}">getCatImageLink($subcategory.link_rewrite, $subcategory.id_image, 'medium')}" alt="" /> {/if} getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'htmlall':'UTF-8'}"></table> <br> {/fo Link to comment Share on other sites More sharing options...
Todor Posted February 18, 2011 Share Posted February 18, 2011 Folks I desperately try to modify my 1.3.6 subcategories and I only managed to sort them by changing the lenght of the text wrapping to subcategory level - this helps a bit but it is still far away from the nice sort that tempomania achieved in his image shown above.When I try to make the changes mentioned here I get the table right but instead of a subcategory picture I get this "getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'htmlall':'UTF-8'}"> followed by the Subcategory name!Do you know what can be the problem? Link to comment Share on other sites More sharing options...
rocky Posted February 18, 2011 Share Posted February 18, 2011 It's because the forums deleted part of the code. Try adding just the new lines and leave the existing PrestaShop lines the same. Link to comment Share on other sites More sharing options...
Todor Posted February 25, 2011 Share Posted February 25, 2011 Ok this is the code for 1.3.6Change the whole code from {foreach .... till {/foreach} >{foreach from=$subcategories item=subcategory} </pre> <table width="510" style="margin-left:10px;margin-bottom:10px;border:1px solid;" border="0" cellspacing="2" cellpadding="2"> 0}class="no-bg"{/if}> getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'htmlall':'UTF-8'}" title="{$subcategory.name|escape:'htmlall':'UTF-8'}"> {if $subcategory.id_image} getCatImageLink($subcategory.link_rewrite, $subcategory.id_image, 'medium')}" alt="" /> {else} {/if} </table> <a rel="">getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'htmlall':'UTF-8'}" title="{$subcategory.name|escape:'htmlall':'UTF-8'}"> {$subcategory.name|escape:'htmlall':'UTF-8'}</a><br><br><div>{$subcategory.description}</div> <br><br><br><br><br><br><br><br><br><br><br> {/fo Link to comment Share on other sites More sharing options...
Tronic Extreme Posted March 14, 2011 Share Posted March 14, 2011 Hello,Do you know how to change the background colour of the subcategory box? or in which part to add the code? Also does anyone know how to align the text 'subcategories' into the centre?Sorry I am new to all this.Omair 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