在我的商店中,我想在侧边栏中显示所有类别和子类别。
我得到了类别,但它没有显示子类别产品。
这是我的代码:
<?php $_helper = Mage::helper('catalog/category') ?>
<?php $_categories = $_helper->getStoreCategories() ?>
<?php $currentCategory = Mage::registry('current_category') ?>
<?php if (count($_categories) > 0): ?></p>
<ul>
<?php foreach($_categories as $_category): ?></p>
<li>
<a href="<?php echo $_helper->getCategoryUrl($_category) ?>"><br />
<?php echo $_category->getName() ?><br />
</a>
<?php $_category = Mage::getModel('catalog/category')->load($_category->getId()) ?><br />
<?php $_subcategories = $_category->getChildrenCategories() ?><br />
<?php if (count($_subcategories) > 0): ?>
<ul>
<?php foreach($_subcategories as $_subcategory): ?>
<li>
<a href="<?php echo $_helper->getCategoryUrl($_subcategory) ?>"><br />
<?php echo $_subcategory->getName() ?><br />
</a>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</li>
<?php endforeach; ?>
/ul>
<?php endif; ?>
任何人都可以提出解决这个问题的建议....
谢谢