Magento News

 

how to show the description of sub-categories magento

I have a main category and some sub-categories for this category and I wanted to show the sub categories of this category when main category link is accessed.

For this I have created a static block and one phtml file and able to show the sub-categories on main category page with sub-cat name and image but I also needs to show the description of category but failed to get the description of sub categories.

This is what I have in phtml file

<?php $_categories=$this->getCurrentChildCategories()?>
<?php if($_categories->count()): ?>
<table style="width:80%">
<?php foreach ($_categories as $_category): ?>
<?php if($_category->getIsActive()): ?>

<tr class="<?php echo $this->htmlEscape($_category->getUrlKey()) ?>">
<?php
 if ($_imgUrl = $_category->getImageUrl()) {
        $_imgHtml = '<img src="'.$_imgUrl.'" alt="'.$this->htmlEscape($_category->getName()).'" title="'.$this->htmlEscape($_category->getName()).'" />';

    }
?>
<td valign="middle" align="left" style="padding-bottom:40px">
    <a href="<?php echo $this->getCategoryUrl($_category) ?>">
        <?php echo $_imgHtml; ?>
    </a>
</td>
<td valign="top" align="left" >
    <a valign="bottom" href="<?php echo $this->getCategoryUrl($_category) ?>">
        <?php echo $this->htmlEscape($_category->getName()) ?>
    </a>
    <?php echo $this->htmlEscape($_category->getDescription()) ?>
</td>

</tr>
<?php endif; ?>
<?php endforeach ?>
</table>
<? endif; ?>

But it is not showing description for the sub categories as you can see I used

$_category->getDescription() to get the description.

Please help to resolve this.

how to show the description of sub-categories magento

Possibly Related Posts:


 

Leave a Reply