I'm getting from a service one array as the following:
0:
category_id: 21
parent_id: 17
name: Parent
url_key: parent
is_active: 1
position: 4
level: 3
children:
0:
category_id: 25
parent_id: 21
name: child1
url_key: child1
is_active: 1
position: 1
level: 4
children:
0:
category_id: 52
parent_id: 25
name: child1child1
url_key: child1child1
is_active: 1
position: 1
level: 5
children:
1:
category_id: 26
parent_id: 21
name: child2
url_key: child2
is_active: 1
position: 2
level: 4
children:
0:
category_id: 54
parent_id: 26
name: child2child1
url_key: child2child1
is_active: 1
position: 1
level: 5
children:
1:
category_id: 55
parent_id: 26
name: child2child2
url_key: child2child2
is_active: 1
position: 2
level: 5
children:
I need to go through this array which I don't know how deep could it get and generate the url paths with them using the url_key variable like:
parent
parent/child1
parent/child1/child1
parent/child2/child1
I was trying to do it with array_walk_recursive but I can figure it out.
Any help would be appreciated.
Thanks