Ecshop calling the classification under the Development classification

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.