I am retrieving all category IDs that a product belongs to like so in a helper:
$productCategories = $this->getProduct()->getCategoryIds();
This gives me an array of category IDs. In my case, each product will only be in one sub-category. From the IDs I need to figure out the logical order based on which categories are children of which.
The aim is to create a method which I can call and specify the level of category I want for a product and it will return the path to that category.
I know I can load a category like so:
Mage::getModel('catalog/category')->load($categoryId)
and I know what I'm doing in PHP, but just a little stuck on the logic (and methods) to use here to achieve what I want.