Jump to content

Disable clicking on parent categories in category block in left hand side bar


Recommended Posts

If it's the blockcategories module, you should be able to target them like this:

 

In category-tree-branch.tpl

 

Find:

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

Change it to:

	<a 
	href="{$node.link|escape:'html':'UTF-8'}"{if isset($currentCategoryId) && $node.id == $currentCategoryId} class="selected"{/if} title="{$node.desc|strip_tags|trim|escape:'html':'UTF-8'}"{if $node.children|@count > 0} onclick="javascript: return false;"{/if}>

Is a nice and simple solution. There are other ways of disabling links which you could look into, such as setting disabled="disabled" or disabling pointer events via css, but I find that to be the easiest way generally, plus it doesn't break the links if javascript isn't enabled (less and less of a thing these days, admittedly)

  • Like 1
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...