2

I cannot seem to find an answer for this anywhere! I am trying to make a custom theme based on the bootstrapped theme, and I cannot find anywhere how to simply list the categories!

I've tried basing it off the modern theme with topmenu.phtml which has this line:

$this->getHtml('level-top')

But I cannot find level-top anywhere?

How can I just list the categories with their sub-categories in my theme?

<ul class="navigation">
    <li><a href="#"><img src="images/icons/mainnav/form-elements.png" alt="">Category<strong>2</strong></a>
        <ul>
            <li><a href="http://127.0.0.1/">Sub-Category</a></li>
            <li><a href="http://127.0.0.1/">Sub-Category</a></li>
        </ul>
    </li>
</ul>

On a side note, why is the magento theme system designed in the way it is? It's vile! What is with including CSS and JS and pages via an XML file? Magento is slow as hell already why on earth use XML?

Marius
  • 197,939
  • 53
  • 422
  • 830
Adam
  • 161
  • 7

1 Answers1

2

The menu is rendered by Mage_Page_Block_Html_Topmenu::getHtml() (that calls Mage_Page_Block_Html_Topmenu::_getHtml()).
level-top is just a class name passed as a parameter to the method.
The block Mage_Page_Block_Html_Topmenu is just a container where you can add different links. By default the product categories are added but you can what you want there using the event page_block_html_topmenu_gethtml_before.
As for What is with including CSS and JS and pages via an XML file? I can say that the Magento layout system is very extensible that way. It allows you to include js, css and other files for specific pages, or specific group of pages, or even globally.
In my opinion is a very nice system, although it's hell to debug...not to mention the learning curve. once you get the hang of it, you will see the upsides of it.

Marius
  • 197,939
  • 53
  • 422
  • 830
  • i still can't figure out how to get anything to display! I even tried using this: http://stackoverflow.com/questions/6960444/display-all-children-categories-and-their-children-in-magento – Adam Jun 27 '13 at 12:17
  • This code has worked for me: http://fishpig.co.uk/blog/display-categories-and-subcategories-in-magento.html – Adam Jun 27 '13 at 12:20
  • But I'm sure this isn't the correct way to do things... – Adam Jun 27 '13 at 12:21