Jump to content

[SOLVED] Custom Category menu


wonky

Recommended Posts

Hi,

I've been trying really hard to find an answer to my problem but to no avail as its a subject that is hard to search and seems that little is written about it. :(

I'm trying to have 2 different category menus in the left column.
one will have all the categories I want to use for "men" and the other for "women".

I know I can make "men" + "women" subcategories then put each additional categories I need in the relevant parent category.

But I want each menu to show all the "men" subcategories and I would hard code the word "men" at the top then the same for women.
Any help would be very appreciated and I'm sure others would benefit from this info.

I've attached a picture so you can get a better idea of what I'm talking about.

Thanks in advance

36956_kOvBUnUuno8sKiXeNNjY_t

  • Like 1
Link to comment
Share on other sites

Hi Rocky,

that would be fine, but I dont want to have the men + women be clickable I only want to show its children and their children, so 3 levels deep but only show the last 2 levels!

Also how would I go about sorting out the order of these? on the pic attach "bags" wants to be first, I could easily HTML the whole menu but then the structure would be too rigid and not good if menu tittles needed changing etc.

Thanks for the advice so far :)

36991_8EIc20i5xKz5psIRCXZ5_t

Link to comment
Share on other sites

Change lines 9-13 of modules/blockcategories/blockcategories.tpl from:

{if $smarty.foreach.blockCategTree.last}
   {include file=$branche_tpl_path node=$child last='true'}
{else}
   {include file=$branche_tpl_path node=$child}
{/if}



to:

{if $smarty.foreach.blockCategTree.last}
   {include file=$branche_tpl_path node=$child first='true' last='true'}
{else}
   {include file=$branche_tpl_path node=$child first='true'}
{/if}



and line 2 of modules/blockcategories/blockcategories.tpl from:

<a href="{$node.link|escape:html:'UTF-8'}" {if $node.id == $currentCategoryId}class="selected"{/if} title="{$node.desc|escape:html:'UTF-8'}">{$node.name|escape:html:'UTF-8'}



to:

{if !$first}<a href="{$node.link|escape:html:'UTF-8'}" {if $node.id == $currentCategoryId}class="selected"{/if} title="{$node.desc|escape:html:'UTF-8'}">{/if}{$node.name|escape:html:'UTF-8'}{if !$first}{/if}



and lines 6-10 from:

{if $smarty.foreach.categoryTreeBranch.last}
   {include file=$branche_tpl_path node=$child last='true'}
{else}
   {include file=$branche_tpl_path node=$child last='false'}
{/if}



to:

{if $smarty.foreach.categoryTreeBranch.last}
   {include file=$branche_tpl_path node=$child first='false' last='true'}
{else}
   {include file=$branche_tpl_path node=$child first='false' last='false'}
{/if}

Link to comment
Share on other sites

Thanks so Much Rocky that's great and works a treat hides the 1st depth great.

I also worked out how to put the categories in a custom order for those that would like to know:
http://www.prestashop.com/wiki/Sorting_categories

But now I'm unable to have a tittle "Men" between the two (shown in image attached)

Here is what I have on blockcategories.tpl :

[removed][removed]

<!-- Block categories module -->


WOMEN

       {foreach from=$blockCategTree.children item=child name=blockCategTree}
           {if $smarty.foreach.blockCategTree.last}
                       {include file=$branche_tpl_path node=$child first='true' last='true'}
           {else}
                       {include file=$branche_tpl_path first='true' node=$child}
           {/if}
       {/foreach}



<!-- /Block categories module -->



and for category-tree-branch.tpl:

>
   {if !$first}{$node.name|escape:htmlall:'UTF-8'}{/if}
   {if $node.children|@count > 0}
</pre>
<ul>
       {foreach from=$node.children item=child name=categoryTreeBranch}
           {if $smarty.foreach.categoryTreeBranch.last}
           {include file=$tpl_dir./category-tree-branch.tpl node=$child first='false' last='true'}
           {else}
           {include file=$tpl_dir./category-tree-branch.tpl node=$child first='false' last='false'}
           {/if}
       {/foreach}
</ul>
<br>   {/if



as you can see in blockcategories.tpl I have a <.h4>WOMEN but I need another as marked in image attached. :(

Thank you so much for your help it has been very help full.

37023_uDtu993sj2wf9LYIXfwO_t

Link to comment
Share on other sites

You copied my code wrong. There should be two if statements, not one. Use:

{if !$first}<a href="{$node.link|escape:html:'UTF-8'}" {if $node.id == $currentCategoryId}class="selected"{/if} title="{$node.desc|escape:html:'UTF-8'}">{/if}{$node.name|escape:html:'UTF-8'}{if !$first}{/if} 



not:

{if !$first}<a href="{$node.link|escape:html:'UTF-8'}" {if $node.id == $currentCategoryId}class="selected"{/if} title="{$node.desc|escape:html:'UTF-8'}">{$node.name|escape:html:'UTF-8'}{/if} 

Link to comment
Share on other sites

  • 9 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...