Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6139439
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:59:23+00:00 2026-05-23T17:59:23+00:00

I have a main category and some sub-categories for this category and I wanted

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T17:59:23+00:00Added an answer on May 23, 2026 at 5:59 pm

    Got the solution:-

    In order to get the description of sub-categories you have to make them current category.

    so this code should be placed inside the foreach loop

    Set the category as current category

    $cur_category=Mage::getModel('catalog/category')->load($_category->getId());
    $layer = Mage::getSingleton('catalog/layer');
    $layer->setCurrentCategory($cur_category);
    

    and this is how then retrieve description

    <?php echo $this->getCurrentCategory()->getDescription() ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have list of categories , some have sub-category and some have sub-sub-category which
I have main categories and sub categories. I want to be able to sort
I have some post categorized under projects and have a link to that category
I have a structure where the main table is USER, other tables include CATEGORY
i have main activity in which i have Four menus. and i have one
I have main.cpp (including main function) and func1.cpp, and I want to link these
i have created a list_home.phtml that i call from {{block type=catalog/product_list category_id=6 template=catalog/product/list_home.phtml}} The
So I have a category table set up. Within this table there is a
i have this html code: <select name=category id=category> <option value=0>&laquo;Seleziona la categoria&raquo;</option> <option value='1'
I wish to list some Categories name on my layout main.php page. Since the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.