Skip to main content

Category path

Category path loop provides the path through the catalog to a given category. For example if we have an "alpha" category standing in an "alpha_father" category which itseflf belong to "root" category. Category path loop for category "alpha" will return "root" then "alpha_father" then "alpha".
{loop type="category-path" name="the-loop-name" [argument="value"], [...]}

Arguments

ArgumentDescriptionDefaultExample
category *A single category id.category="2"
depthThe max depthdepth="5"
visibleWhatever we consider hidden category or not.truevisible="false"

Plus the global arguments

Outputs

VariableValue
$IDthe category id
$PARENTthe parent category
$TITLEthe category title
$URLthe category URL

Plus the global outputs

Examples

I want to display a breadcrumb with parent categories.

<ul class="breadcrumb">
{loop name="category_path" type="category-path" category="{category attr="id"}"}
<li>
{if $LOOP_COUNT == $LOOP_TOTAL}
<span class="current">{$TITLE}</span>
{else}
<a href="{$URL}">{$TITLE}</a>
{/if}
</li>
{/loop}
</ul>