Magento分类页获取当前分类的子分类

这个只是一个小模块 可以在当前分类页面任何地方调用

<?php
//获取当前分类下子分类
$useblock=Mage::getBlockSingleton('catalog/category_view');
$category = $useblock->getCurrentCategory();
?>
<?php if($category->hasChildren()):?>
<?php $subcates = $category->getChildrenCategories();?>
<div class="suncate_list">
    <ul>
        <?php foreach ($subcates as $subcate): ?>
        <li><a href="<?php echo Mage::helper('catalog/category')->getCategoryUrl($subcate) ?>" title="<?php echo $subcate->getName() ?>"><?php echo $subcate->getName() ?></a></li>
        <?php endforeach; ?>
    </ul>
</div>
<?php endif; ?>

 

posted @ 2014-01-28 09:47  狂热的猴子  阅读(299)  评论(0编辑  收藏  举报