get the Url of category from its SKU and Name in Magento

Firstly get category ID then with the help of foreach loop load this id.
And get url in ancher tag and category name.


Here is code...
<?php
$catIds = $product->getCategoryIds();
foreach($catIds as $catId) {
    $category = Mage::getModel('catalog/category')->load($catId);
?>
    <a href="<?php echo $category->getCategoryUrl() ?>"><?php echo $category->getName() ?></a> <br/>
<?php
}
?>

Labels: