Magento에 하위 카테고리 목록이있는 카테고리 페이지가 있습니다. 목록에는 이미지와 이름이 있지만 그 하위 카테고리의 설명도 표시하려고합니다. 간단히 추가하려고 시도했습니다.Magento는 카테고리 list.phtml에 하위 카테고리 설명을 표시합니다.
<strong><?php echo $this->htmlEscape($_category->getDescription()) ?></strong>
하지만 작동하지 않습니다.
편집 : 나는 전통적인 방법으로 하위 범주 얻을 : 나는 ->addAttributeToSelect(’description’)
을 추가하여 category.php
파일의 공공 기능 getChildrenCategories($category)
를 업데이트하려고했습니다
<?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>
을했으나 제대로 동작하지 않습니다.
하위 카테고리는 어떻게 구합니까? 코드를 더 추가하십시오 ... – Simon