Following this question: Show ALL categories the Magento product belongs to
Is there a way to show the full path to the category (with links at each stage), and not just display the final category to which the product belongs?
I have this code so far ...
<?php
$currentCatIds = $_product->getCategoryIds();
$categoryCollection = Mage::getResourceModel('catalog/category_collection')
->addAttributeToSelect('name')
->addAttributeToSelect('url')
->addAttributeToFilter('entity_id', $currentCatIds)
->addIsActiveFilter();
foreach($categoryCollection as $cat){
?>
<a href="<?php echo $cat->getUrl(); ?>">
<?php echo $cat->getName() ?>
</a>
<?php } ?>
Which correctly binds the category name that is displayed on the page. I would like to show the full Cat> Sub Cat> Sub Sub Cat trail and link each item in this track.
source
share