1,//In the document includes/lib_goods.php finally add
1 //* * * Call commodity category Specify classification sub-category2 functionGet_parentid_tree ($parent _id)3 {4 $get _parentid_arr=Array();5 $sql= ' SELECT count (*) from '.$GLOBALS[' ECS ']->table (' category '). "WHERE parent_id = '$parent _id' and is_show = 1 ';6 if($GLOBALS[' DB ']->getone ($sql))7 {8 $child _sql= ' SELECT cat_id, Cat_name, parent_id, Is_show '.9' From '.$GLOBALS[' ECS ']->table (' category ').Ten"WHERE parent_id = '$parent _id' And is_show = 1 ORDER by sort_order ASC, cat_id ASC '; One $res=$GLOBALS[' DB ']->getall ($child _sql); A foreach($res as $row) - { - if($row[' Is_show ']) the $get _parentid_arr[$row[' cat_id '] [' id '] =$row[' cat_id ']; - $get _parentid_arr[$row[' cat_id '] [' name '] =$row[' Cat_name ']; - $get _parentid_arr[$row[' cat_id '] [' url '] = Build_uri (' category ',Array(' cid ' =$row[' cat_id ']),$row[' Cat_name ']); - } + } - return $get _parentid_arr; +}
, in index.php call: $smarty->assign (' Get_parentid_tree1 ', Get_parentid_tree (1));//Call sub-category with parent classified as 1
3. Finally add the code in INDEX.DWT:
{foreach from= $get _parentid_tree1 Item=loop}
{$loop. name|truncate:20:true}|
{/foreach}
Ecshop calling the classification under the Development classification