Display subcategories on homepage

I'm trying to figure out how to display my subcategories in my category grid on my homepage. I was already able to make it so the root category images show up, but now I want the subcategories to display below the image.



I guess kind of like what is part way down on the page at http://www.newegg.com/



This is the code that I'm trying to use, but it isn't working:


```php

{foreach from=$scats item=“category”}

{if $category}





{foreach from=$category.subcategories item=“subcat” name=“sub”}

$subcat.category_id”|fn_url}”>{$subcat.category}{if !$smarty.foreach.sub.last},{/if}

{/foreach}





{else}

 

{/if}

{/foreach}

```

I'm not sure if something needs to be added to the fn.catalog.php file or not.

I could have sworn that I've seen this on a template that was for sale once, but for the life of me, I can't seem to find it now.

So, anyone have any ideas?

Thanks,

Brandon

Did you manage how it works ?

I got this working eventually, will be making an announcement soon, once I get round to sorting out all the addons I've developed.

Miracles,



This will make it so that the subcategories are listed as text under the main categories on your homepage, but you could remove that part if you wanted.



1.) Create a file called skins/your-skin/customer/blocks/categories/categories_multicolumn_list_home.tpl



2.) In that file, put:


{** block-description:multicolumn_list_home **}

{include file="views/categories/components/categories_multicolumns_home.tpl" categories=$items columns=$block.properties.number_of_columns}




3.) Create a file called skins/your-skin/customer/views/categories/components/categories_multicolumns_home.tpl



4.) In that file, put:


```php {split data=$categories size=$columns|default:“3” assign=“splitted_categories”}

{math equation=“floor(100/x)” x=$columns|default:“3” assign=“cell_width”}



{foreach from=$splitted_categories item="scats"}

{foreach from=$scats item="category"}
{if $category}

{else}

{/if}
{/foreach}


{foreach from=$scats item="category"}
{if $category}

{else}

{/if}
{/foreach}


{foreach from=$scats item="category"}
{if $category}

{else}

{/if}
{/foreach}

{/foreach}

{include file="common_templates/image.tpl" show_detailed_link=false object_type="category" images=$category.main_pair no_ids=true show_thumbnail="Y" image_width=$settings.Thumbnails.category_lists_thumbnail_width image_height=$settings.Thumbnails.category_lists_thumbnail_height hide_if_no_image=true}
 

{$category.category}


 


{foreach from=$category.subcategories item="subcat" name="sub"}
{$subcat.category}{if !$smarty.foreach.sub.last},{/if}
{/foreach}

 


{capture name="mainbox_title"}{$title}{/capture} ```

5.) Go to your admin => design => blocks => homepage and add a new block to the central area. Make it a category block. Call it whatever and then chose this new template as the template.

6.) Edit your styles to make it look like how you want

I hope that helps,

Brandon