<?foreach ($this->getStoreCategories() as $_category):?>
.. will display all categories.
However, I want a function to just display the Main categories (IE no sub-categories). This is because I want a top-menu to display only the main categories (dont like dropdowns).
Actually, that call only pulls the main categories. The $this->drawItem($_category) inside the for loop then writes the category and sub categories. Instead, you can just do something like this:
I did try to use your code, dear Anders,
but nothing much happened there at the top where the categories are,
a part some dis-alignement of the text.
My point was to add categories (and sub-cats and sub-cats, etc.) to the home page CMS area,
but your suggested code actually belongs to the top.html area…
unless I am really missing something !
That’s right, my code belongs to the top menu, and it prints only the main categories instead of main + sub categories as aFFi asked for. In the default template, when you float your mouse over a main category in the top menu, a drop down menu will show sub menus (if you have any). With my code, it won’t.
I don’t know how to display categories in the CMS area.
That’s right, my code belongs to the top menu, and it prints only the main categories instead of main + sub categories as aFFi asked for. In the default template, when you float your mouse over a main category in the top menu, a drop down menu will show sub menus (if you have any). With my code, it won’t.
Oh! I can see, now… Sorry, I did not get it, at first.
Thank you: this code may be really useful
to those who need only main categories in their menu.
don’t know how to display categories in the CMS area.
OK. Thank you in any case.
Anybody else has a possible solution in mind for this?
I wanted just one Category (aptly named ‘Products’) to return its Subcategories. sounds trivial but as of right now i’m a bit stuck by ‘Varien_Data_Tree_Node_Collection’ as return type what s this and how do i get the name of my beloved Category? any suggestions?
Actually, that call only pulls the main categories. The $this->drawItem($_category) inside the for loop then writes the category and sub categories. Instead, you can just do something like this:
Thanks for the code. One thing you might want to add is the <li> tags before and after each item. Unless of course you meant to remove the items from the nav list.
I’m having a similar, but inverse problem with the menu on my homepage - On the homepage only, the menu only shows the top level categories. The menu won’t drop-down to show the sub-categories. This only happens on the homepage. The drop-down works fine once you browse to the category page. You can see what I’m talking about here: