我使用以下块在我的Magento CMS产品网站:Magento 1.9:如何获取特定类别的子类别?
{{block type="catalog/product_list" name="catalog_list" category_id="1420" template="catalog/product/listStart.phtml"}}
如何为(在这种情况下编号1420)在块中指定我能不能得到CATEGORY_ID的所有子类别的输出。
到目前为止,我有以下代码:
<?php
$_category = $this->getCurrentCategory();
$collection = Mage::getModel('catalog/category')->getCategories($_category->entity_id);
$helper = Mage::helper('catalog/category');
?>
<div class="category-products">
<div id="carousel">
<ul class="products-in-row">
<?php $i=0; foreach ($collection as $cat): ?>
<li class="item">
<?php echo $cat->getName();?>
</li>
<?php endforeach ?>
</ul>
</div>
我只得到了主要类别的所有子类别。
的可能的复制[Magento的 - 得到一个父类和所有子子类别](http://stackoverflow.com/questions/5564647/magento-get-a-parent-category-and-all-sub-sub-categories) –
@DouglasRadburn - 不同的问题。就我所知,这个问题中的这个问题无法将从'category_id'中的值'1420'应用到集合中,而不是一般如何执行。对于您所链接的问题来说,这也是一个不同的场景。 –