4

The top navigation template file at /catalogue/navigation/top.phtml contains just this short function:

<?php $_menu = $this->renderCategoriesMenuHtml(0,'level-top') ?>
<?php if($_menu): ?>
<div class="nav-container">
    <ul id="nav">
        <?php echo $_menu ?>   
        </ul>
</div>
<?php endif ?>

I'm trying to find the renderCategoriesMenuHtml function so that I can get in and edit the structure of the $_menu result that is called in top.phtml.

The purpose is that I want to slightly edit the structure the menu. It currently comes out in a ul > li > a > ul > li > a > span in HTML and I want to edit this slightly.

James
  • 3,233
  • 3
  • 40
  • 57

2 Answers2

13

The command

$ grep -i -r 'function renderCategoriesMenuHtml' *

returns

app/code/core/Mage/Catalog/Block/Navigation.php

which contains

public function renderCategoriesMenuHtml($level = 0, $outermostItemClass = '', $childrenWrapClass = '')
...
Alana Storm
  • 164,128
  • 91
  • 395
  • 599
8

as an alternative, for those who aren't so familiar with grep, this file also have a PHPDoc comment:

<?php
/**
 * Top menu for store
 *
 * @see Mage_Catalog_Block_Navigation
 */
?>

As you can see, it says which class $this is refering to in this file, in which you'll find the method you're looking for.

HTH

OSdave
  • 8,538
  • 7
  • 45
  • 60