rafaelstz
6/15/2015 - 1:31 AM

Categorias dinâmicas

Categorias dinâmicas

    $parentCategoryId = 4;
    $cat = Mage::getModel('catalog/category')->load($parentCategoryId);
    $subcats = $cat->getChildren();

// Get 1 Level sub category of Parent category
    foreach(explode(',',$subcats) as $subCatid)
    {
        $_category = Mage::getModel('catalog/category')->load($subCatid);
        if($_category->getIsActive()) {
            echo '<ul>
                    <li>
                        <a href="'.$_category->getURL().'" title="'.$_category->getName().'"'.$_category->getName().'" category"><img src="'.$_category->getImageUrl().'" alt="'.$_category->getName().'"/></a>
                    </li>';
            echo '</ul>';
        }
    }