forked from galaxyEverybody/galaxyCode
/
category.php
75 lines (54 loc) · 1.83 KB
/
category.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
/*
*
* _/_/_/ _/ _/_/_/_/_/
* _/ _/_/ _/_/ _/ _/ _/ _/_/ _/_/
* _/ _/_/ _/_/_/_/ _/_/_/_/ _/_/ _/ _/ _/ _/ _/
* _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/
* _/_/_/ _/_/_/ _/_/_/ _/ _/ _/_/_/_/_/ _/_/ _/_/
*
*
* Copyright 2013-2014, Geek Zoo Studio
* http://www.ecmobile.cn/license.html
*
* HQ China:
* 2319 Est.Tower Van Palace
* No.2 Guandongdian South Street
* Beijing , China
*
* U.S. Office:
* One Park Place, Elmira College, NY, 14901, USA
*
* QQ Group: 329673575
* BBS: bbs.ecmobile.cn
* Fax: +86-10-6561-5510
* Mail: info@geek-zoo.com
*/
require(EC_PATH . '/includes/init.php');
include_once(EC_PATH . '/includes/lib_transaction.php');
$categoryGoods = array();
$category = get_categories_tree();
$category = array_merge($category);
//print_r($category);exit;
if (!empty($category)) {
foreach($category as $key=>$val) {
//$categoryGoods[$key][] = array(
$categoryGoods[$key]['id'] = $val['id'];
$categoryGoods[$key]['name'] = $val['name'];
//);
if(!empty($val['cat_id'])){
foreach($val['cat_id'] as $k=>$v){
$categoryGoods[$key]['children'][] = array(
'id'=>$v['id'],
'name'=>$v['name'],
//$val[$k]['id'] = $v['id'],
//$val[$k]['name'] = $v['name']
);
}
} else {
$categoryGoods[$key]['children'] = array();
}
}
}
// print_r($categoryGoods);exit;
GZ_Api::outPut($categoryGoods);