/home/mjc1/public_html/j3demo/shop/ajax.sub_cate_get.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
    
include_once("./_common.php");

    
$sql "select * from product_category_s where 1=1 and lv = 0 and pc_use = '1' ";
    
$res mysql_query($sql,$connect_j3);
    while(
$cate1=mysql_fetch_array($res)){
        
$cate2_array null;
        
$sql "select * from product_category_s where 1=1 and lv = 1 and pc_use = '1' and parent_code = '{$cate1['code']}' ";    
        
$res2 mysql_query($sql,$connect_j3);
        while(
$cate2=mysql_fetch_array($res2)){
            
$cate3_array null;
            
$sql "select * from product_category_s where 1=1 and lv = 2 and pc_use = '1' and parent_code = '{$cate2['code']}' ";    
            
$res3 mysql_query($sql,$connect_j3);
            while(
$cate3=mysql_fetch_array($res3)){
                
$cate3_array[] = $cate3;
            }
            
$cate2['cate3_info'] = $cate3_array;
            
$cate2_array[] = $cate2;
        }
        if(
count($cate2_array)>0){
?>
            <div class='sub1_cates'>
                <input type='hidden' name='cate_code' value='<?php echo $cate1['code2'];?>'>
                <ul>
<?php
            
foreach($cate2_array as $key=>$cate2){
                if(
count($cate2['cate3_info'])>0){ $more_ico "<span class='cate_more_ico'>◀</span>"; }    else { $more_ico "";    }
                echo 
"<li class='cate2_menu'>
                            <input type='hidden' name='cate_code' value='
{$cate2['code2']}'>
                            <a href='list.php?code=
{$cate2['code2']}'>{$cate2['name']}</a>

                            
{$more_ico}
                        </li>"
;
            }
?>
                </ul>
<?php
            
foreach($cate2_array as $key=>$cate2){
                if(
count($cate2['cate3_info'])>0){
                    echo 
"<div class='cate3_menu' style='display:none;'>";
                    echo 
"<input type='hidden' name='cate_code'  value='{$cate2['code2']}'>";
                    echo 
"<ul>";
                    foreach(
$cate2['cate3_info'] as $k=>$cate3){
                        echo 
"<li><a href='list.php?code={$cate3['code2']}'>{$cate3['name']}</a></li>";
                    }
                    echo 
"</ul>";
                    echo 
"</div>";
                }
            }
?>
            </div>
<?php
        
}
    }

?>