I am trying to list all the categories in alphabetical order in magento but it is not working.
<?php foreach ($this->getStoreCategories() as $_category): ?>
<?php
//arrange by Letter
foreach($_category->getChildren() as $_sub){
$letter = substr(strtolower($_sub->getName()),0,1);
$subCategories[$letter][0]['name'] = $letter; //0 index is the letter
$i = 1;
while(isset($subCategories[$letter][$i])){
$i++;
}
$subCategories[$letter][$i]['name'] = $_sub->getName();
$subCategories[$letter][$i]['url'] = $this->getCategoryUrl($_sub);
}
?>
Did I miss anything here?