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; ?> (责任编辑:好模板) |