Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Well, as I have suggested in <a href="https://stackoverflow.com/a/14586422/653867">https://stackoverflow.com/a/14586422/653867</a> you have to load a category object for your second level categories:</p> <pre><code>$cat = Mage::getModel('catalog/category')-&gt;load($category-&gt;getEntityId()); </code></pre> <p>then you can access its children by executing</p> <pre><code>$children = $cat-&gt;getChildrenCategories(); </code></pre> <p>The $<code>children</code> variable is a collection of type <code>Mage_Catalog_Model_Resource_Category_Collection</code>, and you can iterate through it to output the next level categories</p> <p>I think, your code can be improved a bit if you called getChildrenCategories() on your $main in the first place. You wouldn't have to load every child in a loop, which can be performance punishing. Instead use this (and it can actually be improved even further with recursive calls, but such setup would include creating extra blocks, which might be too much hassle for this particular case):</p> <pre><code> &lt;?php $main = Mage::getModel('catalog/category')-&gt;load(355) ?&gt; &lt;li class="eight"&gt;&lt;a href="&lt;?php echo $main-&gt;getUrl() ?&gt;"&gt;&lt;?php echo $main-&gt;getName(); ?&gt;&lt;/a&gt; &lt;?php $children = $main-&gt;getChildrenCategories(); ?&gt; &lt;ul class="nav_static"&gt; &lt;?php foreach ($children as $category): ?&gt; &lt;li&gt; &lt;a href="&lt;?php echo $category-&gt;getUrl(); ?&gt;"&gt; &lt;?php echo $category-&gt;getName(); $subCategories = $category-&gt;getChildrenCategories(); foreach ($subCategories as $subCat) { /** *your code to output the next level categories */ } ?&gt; &lt;/a&gt; &lt;/li&gt; &lt;?php endforeach; ?&gt; &lt;/ul&gt; &lt;/li&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload