babolops Posted February 14, 2020 Share Posted February 14, 2020 Hello i check everywhere to find a solution but nothing, i need to have the child category not a link same in pic attached someone can help me??????????? ps prestashop 1.7.6.3 tnx Link to comment Share on other sites More sharing options...
Luis C Posted February 15, 2020 Share Posted February 15, 2020 Is that the ps_mainmenu module? If so, modify the template file. In the beginning of the template depth variable is declared. It iterates through the function and adss 1 each time a subcategory is called. Top links are $depth = 0, so next in line are 1st level subcategories, the ones you need to edit. When building the list element you need to wrap your link tag inside an if statement, something like this: {if $depth != 1}<a href....>{/if} CATEGORY NAME {if $depth != 1}</a>{/if} That way, first level sub items will NOT be wrapped around a link tag (supposing, again, you're using the stock top menu module) Let me know if this helped at all Link to comment Share on other sites More sharing options...
babolops Posted February 15, 2020 Author Share Posted February 15, 2020 This is my tpl: {assign var=_counter value=0} {function name="menu" nodes=[] depth=0 parent=null} {if $nodes|count} <ul class="top-menu" {if $depth == 0}id="top-menu"{/if} data-depth="{$depth}"> {foreach from=$nodes item=node} <li class="{$node.type}{if $node.current} current {/if}" id="{$node.page_identifier}"> {assign var=_counter value=$_counter+1} <a class="{if $depth >= 0}dropdown-item{/if}{if $depth === 1} dropdown-submenu{/if}" href="{$node.url}" data-depth="{$depth}" {if $node.open_in_new_window} target="_blank" {/if} > {if $node.children|count} {* Cannot use page identifier as we can have the same page several times *} {assign var=_expand_id value=10|mt_rand:100000} <span class="float-xs-right hidden-lg-up"> <span data-target="#top_sub_menu_{$_expand_id}" data-toggle="collapse" class="navbar-toggler collapse-icons"> <i class="material-icons add"></i> <i class="material-icons remove"></i> </span> </span> {/if} {$node.label} </a> {if $node.children|count} <div {if $depth === 0} class="popover sub-menu js-sub-menu collapse"{else} class="collapse"{/if} id="top_sub_menu_{$_expand_id}"> {menu nodes=$node.children depth=$node.depth parent=$node} <div class="menu-banners"> {foreach from=$node.image_urls item=image_url} <div class="menu-banner"> <div class="menu-banners-inner"> <img src="{$image_url}" alt="" /> </div> </div> {/foreach} </div> </div> {/if} </li> {/foreach} </ul> {/if} {/function} <div class="menu pst-top-menu col-md-12 col-lg-12 js-top-menu position-static hidden-md-down" id="_desktop_top_menu"> {menu nodes=$menu.children} <div class="clearfix"></div> </div> Link to comment Share on other sites More sharing options...
Luis C Posted February 15, 2020 Share Posted February 15, 2020 Oh, man.. replying from mobile version is a bit of a mess. OK, so, locate this line: {assign var=_counter value=$_counter+1} <a class="{if $depth >= 0}dropdown-item{/if}{if $depth === 1} dropdown-submenu{/if}" href="{$node.url}" data-depth="{$depth}" {if $node.open_in_new_window} target="_blank" {/if} > Then wrap the <a> tag in an if statement: {assign var=_counter value=$_counter+1} {if $depth != 1} <a class="{if $depth >= 0}dropdown-item{/if}{if $depth === 1} dropdown-submenu{/if}" href="{$node.url}" data-depth="{$depth}" {if $node.open_in_new_window} target="_blank" {/if} >{/if} And lastly do the same with the closing tag </a> {if $depth != 1}</a>{/if} Sorry, replying from my (not that much)smart phone. 1 Link to comment Share on other sites More sharing options...
babolops Posted February 15, 2020 Author Share Posted February 15, 2020 maybe I didn't understand, but the tag </a> should I put it immediately after the closing if tag? Link to comment Share on other sites More sharing options...
Luis C Posted February 15, 2020 Share Posted February 15, 2020 (edited) Everything stays right where it is. You just wrap both opening and closing a tags inside if statements (one each). If I manage to get in front of my computer I'll try to explain it better Edited February 15, 2020 by Luis C (see edit history) Link to comment Share on other sites More sharing options...
babolops Posted February 15, 2020 Author Share Posted February 15, 2020 {assign var=_counter value=$_counter+1} {if $depth != 1} <a class="{if $depth >= 0}dropdown-item{/if}{if $depth === 1} dropdown-submenu{/if}" href="{$node.url}" data-depth="{$depth}" {if $node.open_in_new_window} target="_blank" {/if} >{/if} its correct? tnx for ur help Link to comment Share on other sites More sharing options...
babolops Posted February 15, 2020 Author Share Posted February 15, 2020 ok i use ur info and work good tnx for ur help 1 Link to comment Share on other sites More sharing options...
Luis C Posted February 15, 2020 Share Posted February 15, 2020 Great to know. You're welcome 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now