I have a multidimensional array that I use to build a navigation menu. It may consist of any number of submenus (or children). The menu works just fine. When someone clicks on a menu link, the product category with id "menuid" opens. However, I also need to know the menuid of all the children of the current menuid (but not it's grandchildren and so forth).
This is an example of the array:
Array
(
[0] => Array
(
[menutype] => url
[menuid] => 46
)
[1] => Array
(
[menutype] => product_category
[menuid] => 55
[children] => Array
(
[0] => Array
(
[menutype] => product_category
[menuid] => 69
[children] => Array
(
[0] => Array
(
[menutype] => product_category
[menuid] => 211
)
[1] => Array
(
[menutype] => product_category
[menuid] => 57
)
[2] => Array
(
[menutype] => product_category
[menuid] => 166
)
)
)
[1] => Array
(
[menutype] => product_category
[menuid] => 57
)
[2] => Array
(
[menutype] => product_category
[menuid] => 94
)
)
)
[2] => Array
(
[menutype] => posts_category
[menuid] => 45
)
)
For example, I would like to know how to get the menuid value of the elements in children for the element with menuid 69. (Should return an array with 211, 57 and 166).