Skip to content

Instantly share code, notes, and snippets.

@fourroses666
Created February 26, 2015 13:33
Show Gist options
  • Save fourroses666/5c45a4bd9db40276216c to your computer and use it in GitHub Desktop.
Save fourroses666/5c45a4bd9db40276216c to your computer and use it in GitHub Desktop.
<div class="block left-categorys">
<?php
$currentCat = Mage::registry('current_category');
echo '<div class="block-title"><h2>'.$currentCat->getName().'</h2></div>';
$collection = Mage::getResourceModel('catalog/category_collection')
->addAttributeToFilter('parent_id', $currentCat->getId())
->addAttributeToFilter('is_active', 1)
->addAttributeToSort('position', 'asc')
->addAttributeToSelect('name')
->addUrlRewriteToResult();
if($collection->getSize()){
echo '<div class="block-content left-categorys-container">';
foreach ($collection as $category ){
echo '<a href="'.$category->getUrl($category).'">'.$category->getName().'</a>';
}
echo '</div>';
}
?>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment