<ul  class="category-list clearfix">
	{* define the function *} 
	{function name=categories level=0}
		{foreach from=$data item="productCategory"} 
			<li>
			
				{if $level==1}
					{html->anchor href="{$productCategory.productCategoryID|sef_path:'catalog'}" content="<strong>{$productCategory.productCategoryName}</strong>"}
				{else}
					{html->anchor href="/{$productCategory.productCategoryID|sef_path:'catalog'}" content="{$productCategory.productCategoryName}"}
				{/if}
			{if isset($productCategory['children']) && is_array($productCategory['children']) && !empty($productCategory['children'])}
				{assign var="elementCount" value=$productCategory['children']|count/3}
				{assign var="elementCount" value=$elementCount|ceil}
				{if $elementCount>0}
					{if $level<1}
					<div class="grand_sub_menu  clearfix">
					{/if}
						{assign var="productCategoryChildren" value=array_chunk($productCategory['children'], 3)}
						{for $counter=0; $counter<$elementCount ; $counter++}
						<ul class="clearfix"> 
						{call name=categories data=$productCategoryChildren[$counter] level=$level+1} 
						</ul>
						{/for}
					{if $level<1}
					</div>
					{/if}
					
				{else}
					<ul class="clearfix"> 
					{call name=categories data=$productCategory['children'] level=$level+1} 
					</ul>
				{/if}
			{else}
				{if (is_array($productCategory)) && (isset($productCategory['menuItemID'])) && (is_numeric($productCategory['menuItemID']))}
				</li>	
				{/if}
			{/if}
		{/foreach}  
	{/function}
	{call categories data=$CategoryMenus} 
	<li>{html->anchor href="categories" content={$language.lblViewMoreNew}}</li>
	</ul>


		
