Jump to content

Recommended Posts

I am new to presta and i am learning ....

 

I saw that post and it is almost what i wanted to do.

 

http://www.prestasho...post__p__807424

 

The problem for me is when i navigate to deeper level categories.

When i navigate at deeper levels then the menu disappears can you please help me with the tpl file to fix this ??

 

Any help on this last problem will be appreciated !!

 

Thanks

Edited by builders (see edit history)
Link to comment
Share on other sites

ANY help on this ???

 

What I wanted for this shop:

 

When you go to Cat1 it would show: sub1, sub11, sub111

And when you go to sub11 it would show only the categories inside sub11 for example only sub2 and when i go to sub2 it would show only sub3

 

 

I have those categories

-cat1:
  sub1
  sub2
	  sub3
  sub11
   sub2
	  sub3
  sub111
   sub2
......

 

That code works but only for first level category ... What shall i change to work for deeper levels ????

/themes/theme-name/modules/blockcategories/category-tree-branch.tpl

 

{assign var="show_child" value="false"}
{if !isset($currentCategoryId)}
    <li {if isset($last) && $last == 'true'}class="last"{/if}>
		    <a href="{$node.link}" title="{$node.desc|escape:html:'UTF-8'}">{$node.name|escape:html:'UTF-8'}</a>
    </li>
{/if}
{if isset($currentCategoryId) && ($node.id == $currentCategoryId)}
    {assign var="show_child" value="true"}
{/if}
{if $node.children|@count > 0}
    {foreach from=$node.children item=child name=categoryTreeBranch}
		    {if isset($currentCategoryId) && ($child.id == $currentCategoryId)}
				    {assign var="show_child" value="true"}
		    {/if}
    {/foreach}
{/if}
{if $show_child == 'true'}
    {if $node.children|@count > 0}
		    {foreach from=$node.children item=child name=categoryTreeBranch}
				    {if isset($smarty.foreach.categoryTreeBranch) && $smarty.foreach.categoryTreeBranch.last}
						    {include file="$branche_tpl_path" node=$child show='true' last='true'}
				    {else}
						    {include file="$branche_tpl_path" node=$child show='true' last='false'}
				    {/if}
		    {/foreach}
	   {if $child.children|@count > 0}
	    {foreach from=$child.children item=child2 name=categoryTreeBranch2}
		    {if isset($currentCategoryId) && ($child2.id == $currentCategoryId)}
			    {assign var="show_child" value="true"}
		    {/if}
	    {/foreach}
    {/if}
    {/if}
{/if}

{if isset($show)}
<li {if isset($last) && $last == 'true'}class="last"{/if}>
    <a href="{$node.link}" {if isset($currentCategoryId) && ($node.id == $currentCategoryId)}class="selected"{/if} title="{$node.desc|escape:html:'UTF-8'}">{$node.name|escape:html:'UTF-8'}</a>
    {if $node.children|@count > 0}
		    <ul>
		    {foreach from=$node.children item=child name=categoryTreeBranch}
				    {if isset($smarty.foreach.categoryTreeBranch) && $smarty.foreach.categoryTreeBranch.last}
						    {include file="$branche_tpl_path" node=$child show='true' last='true'}
				    {else}
						    {include file="$branche_tpl_path" node=$child show='true' last='false'}
				    {/if}
		    {/foreach}
		    </ul>
    {/if}
</li>
{/if}

 

That code works but only for first level category ... What shall i change to work for deeper levels ????

Link to comment
Share on other sites

×
×
  • Create New...