LIsting sub categories

Hi there,

I would like to list sub categories of specific category, how can i pass some id of it to foreach?

[{foreach from=$oxcmp_categories item=ocat }]


Any category?

Or is this the currently active category?

I need any, but would be also nice to know active too :slight_smile:

from mailinglist dev-general yesterday regarding a similar request, postet by leofonic:

you could extend oxcategorylist with a module to build a flat table:

class my_oxcategorylist  extends my_oxcategorylist_parent{
    protected $_aFlatCategoryList;
    protected function _ppBuildTree(){
        foreach ($this->_aArray as $oCat) {
            $this->_aFlatCategoryList[$oCat->getId()] = $oCat;
    public function getCatById($sOxid){
        return $this->_aFlatCategoryList[$sOxid];

And then get the category with:

[{assign var="oCat" value=$oxcmp_categories->getCatById('c27031374e82bc8667f13abf6392317c')}]

Thank you Ray.

Solved my issue with currently active category ( needed it in homepage :slight_smile: ) but thanks for your answer, it made more clear for me. Noticed that you use ‘c27031374e82bc8667f13abf6392317c’ id, as i understand it is category from CMS pages not from Categories. Right?

Thanks again

nope - this is an automatic generated OXID from an article-category, but similar to the generated id´s for CMS-pages

got it.

I should close this thread or moderators do?

no need to close - so others have the chance to answer later