How can I get the ids and the names of a group of parent categories? I got an array of ids that belong to a product but I want to show their parent id names too.
With this code I get all current ids:
$currentCatIds = $_product->getCategoryIds();
This returns an array:
Array ( [0] => 15 [1] => 25 [2] => 66 [3] => 78 [4] => 79 [5] => 80 [6] => 81 [7] => 82 [8] => 83 [9] => 84 [10] => 85 [11] => 86 [12] => 87 [13] => 88 [14] => 89 [15] => 90 [16] => 91 [17] => 100 [18] => 179 )
I need the parentids of the above categories and their names.
For example:
Topcategory 1
- Subcat 1
- Subcat 2
- Subcat 3
- Subcat 4
- Subcat 5
Topcategory 2
- Subcat 6
- Subcat 7
- Subcat 8
All subcats are in the above array and shown on the product page, but I need the ids of Topcategory 1 and 2 and their names.