The template file loops through the product classifications and assigns a URL attribute to the large category. Then in JS to determine whether there are sub-categories. There are categories to click the drop-down effect, no sub-classification to jump to the URL property link.
Themes/**/library/category_tree.lbi:
<Divclass= "NavBar"> <DivID= "Cate"> <!--{foreach from= $categories _pro item=cat Name=categories_pro} - <H1class= "H1"> <DT> <ahref= "javascript:;"URL= "{$cat. URL}">{$cat. name|escape:html}<spanclass= "Searchleft"></span></a> </DT> </H1> <ul{if $cat. ID eq $parent _id_show}style= "Display:block"{/if}> <!--{foreach from= $cat. cat_id Item=child} - <Li><ahref= "{$child. URL}"{if $child. ID eq $category}class= "Current"{/if}>{$child. name|escape:html}</a></Li> <!--{/foreach} - </ul> <Divstyle= "Clear:both"></Div> <!--{/foreach} - </Div></Div>
/js/common.js:
//List page product category left navigation click Toggle$ ("#cate H1"). Click (function(){ if($( This). Next ("UL"). Find ("Li"). Length = = 0) {Location.href= $( This). Find ("a"). attr ("url");//Location.href Implementing a jump to a client page } Else { if($( This). Next ("UL"). Is (": Visible")) { $( This). Next ("UL"). Hide (); } Else { $("#cate ul"). Hide (); $( This). Next ("UL"). Show (); } } })
Ecshop Commodity Sub-categories Click Dropdown, sub-category empty, direct jump function