I need to automatically list the left nav alphabetically.
I have this code, but the problem is it only does it for category number 4 and I need it to do it for the current category. Any ideas how to get it to load the current category and not a specific number?
<?php
$cats = Mage::getModel('catalog/category')->load(4)->getChildren();
$catIds = explode(',',$cats);
$categories = array();
foreach($catIds as $catId) {
$category = Mage::getModel('catalog/category')->load($catId);
$categories[$category->getName()] = $category->getUrl();
}
ksort($categories, SORT_STRING);
?>
<ul>
<?php foreach($categories as $name => $url): ?>
<li>
<a href="<?php echo $url; ?>"><?php echo $name; ?></a>
</li>
<?php endforeach; ?>
</ul>
Many thanks,
Kirsty