3

I'm updating an old magento install and I just upgraded it from

1.4.1 (to 1.4.2 first) to 1.9. 

Now the top navigation menu doesn't show anymore. The category structure is still intact. I've tried several tutorials online on how to display the top navigation menu, but none worked so far.

I'm following this tutorial..http://www.magentocommerce.com/wiki/4_-_themes_and_template_customization/navigation/add_home_link_to_menu_bar

I'm looking inside

app/design/frontend/default/yourtheme/template/catalog/navigation/top.phtml 

But the file isn't being parsed, I can put nonsense php statements inside it and don't get any error messages on the site. I've disabled compilation and all cache on the site.

How can I get this working? Or normally where is this file called from?

Edit1: I see now that in

app/design/frontend/default/yourtheme/template/page/html/header.phtml 

the top menu is called..

<?php echo $this->getChildHtml('topMenu') ?> 

But this string is empty. I've added topmenu.phtml to

app/design/frontend/default/yourtheme/template/page/html/ 

This file isn't called as well. I don't know why this isn't working, any advice is welcome.

Edit2

The content of top.menu is empty, I'd like to get this fixed first. I've tried to call it in several ways..

$this->getLayout()->getBlock('top.menu')->toHtml() 

or

$layout = Mage::app()->getLayout(); $layout->getUpdate() ->addHandle('default') ->load(); $layout->generateXml() ->generateBlocks(); var_dump( $layout->getBlock('top.menu')->toHtml()); 

Edit3

I wanted to know where the top.menu is filled, I've found two files

 app/code/core/Mage/Page/Block/Html/Topmenu.php app/code/core/Mage/Page/Block/Html/TopMenu/Renderer.php 

The functions in both classes aren't called, even though I'm using

<?php echo $this->getChildHtml('topMenu') ?> 

in a file that gets parsed. So I'm wondering am I calling the right method to display the top menu? Or am I looking at the wrong files?

6
  • Try checking out app/design/frontend/default/yourtheme/template/page/html/topmenu.phtml instead. Is your theme using that one instead? Commented Jun 18, 2014 at 8:23
  • That file isn't present in the template, is there any other file I could check? Commented Jun 19, 2014 at 10:54
  • Move it from the base (app/design/frontend/base/default/template/page/html/topmenu.phtml) into your theme (app/design/frontend/default/yourtheme/template/page/html/topmenu.phtml) and then see if it is using it. Commented Jun 19, 2014 at 12:22
  • Also see my edited main response. I've deleted the topmenu.phtml from base and added a topmenu.phtml to the template. But this file isn't parsed. Commented Jun 19, 2014 at 12:36
  • Turn on template path hints in your admin to see what file is being loaded to display your navigation menu. Commented Jun 19, 2014 at 12:52

1 Answer 1

3

After a lot of searching I found out that my template missed the reference to top.menu. So I copied catalog.xml from app/design/frontend/default/default/layout to design/frontend/default/mytemplate/layout

 <reference name="top.menu"> <block type="catalog/navigation" name="catalog.topnav" template="catalog/navigation/top.phtml"/> </reference> 

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.