Pure SSML Category Tree using Nested UL's

When you have several levels of categories, you want flexibility with your code. By default, Prostores only indents any child categories. Dynamic has taken it a step further providing Pure SSML code that will nest all child categories using the UL-LI HTML tag structure.

Generates a nested UL of Prostore Categories using Pure SSML

Generates a nested UL of Prostore Categories using Pure SSML
By: Hoang Tran <ht@dynamic.com>
Date: 2010-05-20
<!-- beginning of categories -->

<ul>
<ss:foreach item="category" within="$catalog.categoriesToDepth(1)">
<ss:sortby item="categorypriority" direction="asc"/>

<li>

<ss:value source="$category.name" />

<ss:if test="$category.hasChildCategoriesInUse()">
<ul>
</ss:if>

<ss:set name="prev" value="$category" />

<ss:foreach item="sub" within="$category.childCategoriesInUse()">

<ss:if test="$prev.treeLevel > $sub.treeLevel">
<ss:foreach item="partialString" within="$string.split($prev.parentChaindisplay, ':')">
<ss:if test="$counter.currentRow > $sub.treeLevel">
</ul></li>
</ss:if>
</ss:foreach>
</ss:if>

<li>

<ss:value source="$sub.name" />

<ss:if test="$sub.hasChildCategoriesInUse()">
<ul>
<ss:else />
</li>
</ss:if>

<ss:set name="prev" value="$sub" />
</ss:foreach>

<ss:if test="$prev.treeLevel > $category.treeLevel">
    <ss:foreach item="partialString" within="$string.split($prev.parentChainDisplay, ':')">
  <ss:comment>
  levels 1 and 2 are will be accounted for later
  </ss:comment>
  <ss:if test="$counter.currentRow > 2">
  </ul></li>
  </ss:if>
</ss:foreach>
</ss:if>

<ss:if test="$category.hasChildCategoriesInUse()">
</ul>
</ss:if>

</li>
</ss:foreach>
</ul>