title: How to determine which top level category is active
body: <p><strong>On my catalog page I want to get the currently active top level category.</strong></p>
  
  <p>Example:</p>
  
  <pre><code>1. Top Level Category
    1.1 Sub Category
      1.1.1 Sub sub Category
      1.1.2 Sub sub Category
    1.2 Sub Category
  2. Top Level Category
    2.1 Sub Category
    2.2 Sub Category
  </code></pre>
  
  <p>Let's say I am in sub sub category 1.1.1. How do I get to know that '1. Top Level Category' is the current top level category?</p>
  
  <p>I tried the following but it didn't work for me:</p>
  
  <pre><code>            &lt;?php $_cat_helper = Mage::helper('catalog/category') ?&gt;
              &lt;?php $_categories = $_cat_helper-&gt;getStoreCategories() ?&gt;
  
              &lt;?php foreach ($_categories as $_category): ?&gt;
                  &lt;?php if ($this-&gt;isCategoryActive($_category)): ?&gt;
                  &lt;?php echo $_category-&gt;getName() ?&gt; &lt;br&gt;
                  &lt;?php endif; ?&gt;
              &lt;?php endforeach; ?&gt;
  </code></pre>
  
  <p>Please help :-)</p>
  
  <hr>
  
  <h2>Update</h2>
  
  <p>If I put <code>$this-&gt;isCategoryActive($_category)</code> into catalog/product/list.phtml I get the following error:</p>
  
  <pre><code>Invalid method Mage_Catalog_Block_Product_List::isCategoryActive(Array
  (
      [0] =&gt; 
  )
  )
  
  
  Trace:
  #0 .../default/template/catalog/product/list.phtml(53): Varien_Object-&gt;__call('isCategoryActiv...', Array)
  #1 .../default/template/catalog/product/list.phtml(53): Mage_Catalog_Block_Product_List-&gt;isCategoryActive(NULL)
  </code></pre>