Jump to content

[SOLVED] Question about categories tree


Recommended Posts

Hi there,

I have a question about the category tree block which I'm hoping someone can answer for me.

I have a simple requirement, which is that the top level categories are not clickable. For the particular implementation of prestashop, I am building a clothing store. The top level categories consist of "Mens", "Womens", and "Accessories". Each of these contains sub-categories, which contain all of the products. The top level categories do not contain any items what-so-ever. I therefore do not want users to be able to click on these categories.

It would be very nice if Prestashop added a feature which allowed you to make certain categories as "structural only" or something along those lines. That is, they exist in the category structure, but never contain products.

If anyone knows of a simple way to implement this, I would be most grateful.

Thanks

Link to comment
Share on other sites

Try changing 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 depth=1 last='true'}
{else}
           {include file=$branche_tpl_path node=$child depth=1}
{/if}



then change line 2 of modules/blockcategories/category-tree-branch.tpl from:

<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 $depth > 1}{/if}



to:

{if $depth > 1}<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 $depth > 1}{/if}



and lines 6-10 of modules/category-tree-branch.tpl 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 depth=$depth+1 last='true'}
{else}
           {include file=$branche_tpl_path node=$child depth=$depth+1 last='false'}
{/if}

Link to comment
Share on other sites

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...