Please we need some help with magento 1.8 On custom template we have categories list menu on left side. If we activate Flat catalog categories we have memory error by getting category list.
Here the code works for 1.7 and not for 1.8
<div class="block-content">
<?php
$rootcatId= Mage::app()->getStore()->getRootCategoryId();
$categories = Mage::getModel('catalog/category')->getCategories($rootcatId);
function get_categories($categories) {
$array= '<ul>';
foreach($categories as $category) {
$cat = Mage::getModel('catalog/category')->load($category->getId());
$array .= '<li>'.
'<a href="' . Mage::helper('core/url')->getHomeUrl().$cat->getUrlPath(). '">' .
$category->getName() . "</a>\n";
if($category->hasChildren()) {
$children = Mage::getModel('catalog/category')->getCategories($category->getId());
$array .= get_categories($children);
}
$array .= '</li>';
}
return $array . '</ul>';
}
echo get_categories($categories); ?>
</div>