我在Magento中获得了子类别列表的类别页面。该列表具有图像和名称,但我也想显示这些子类别的描述。我试图简单地添加Magento在类别list.phtml上显示子类别描述
<strong><?php echo $this->htmlEscape($_category->getDescription()) ?></strong>
但它不工作。
编辑:我得到了一个传统的方式小类:
<?php if (!$_categoryCollection->count()): ?>
<p class="note-msg"><?php echo $this->__('There are no subcategories matching the selection.') ?></p>
<?php else: ?>
<div class="category-products">
<?php $_collectionSize = $_categoryCollection->count() ?>
<?php $_columnCount = $this->getColumnCount(); ?>
<?php $i=0; foreach ($_categoryCollection as $_category): ?>
<?php if ($i++%$_columnCount==0): ?>
<ul class="products-grid">
<?php endif ?>
<li class="item<?php if(($i-1)%$_columnCount==0): ?> first<?php elseif($i%$_columnCount==0): ?> last<?php endif; ?>">
<a href="<?php echo $_category->getUrl() ?>" class="product-image"><img class="photo" src="<?php echo $this->getCategoryImage($_category, 214, 184); ?>" width="214" height="184" alt="<?php echo $_category->getName() ?>" />
<strong><?php echo $this->htmlEscape($_category->getName()) ?></strong>
<strong><?php echo $_category->getDescription() ?></strong>
</a>
</li>
<?php if ($i%$_columnCount==0 || $i==$_collectionSize): ?>
</ul>
<?php endif ?>
<?php endforeach ?>
</div>
我已经尝试通过增加->addAttributeToSelect(’description’)
以更新category.php
文件中的公共职能getChildrenCategories($category)
,但它不工作。
你如何得到子类?请添加更多代码... – Simon