0

I am changing in app/code/core/mage/page/block/html/Topmenu.php in my magento but I cannot see result. but when i change in topmenu.phtml file then it displays changes. what is the issue? I am sure the Topmenu.php is the block file but menu still display. I don't know how is it possible. I am also trying in Navigation.php in Mage/catalog/block/navigation.php. it's also now working. how is it possible?

Means when I change code in Topmenu.php file's _gethtml() function, for example I write echo "hello"; then doesn't show. But when I am changing in topmenu. phtml file and write any code it displays in the navigation.

In header.phtml I call top menu using

<

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



 topphml.phtml file code



 <?php echo "hello"; ?>
    <?php $_menu = $this->getHtml('level-top') ?>
    <?php if($_menu): ?>
    <div class="nav-container">

        <ul id="nav">
            <?php echo $_menu ?>
        </ul>
    </div>
    <?php endif ?>

3 Answers 3

1

In Magento 1.9.0.1 the Topmenu _gethtml() function is deprecated in favour of using a renderer.phtml

If your editing _getHtml() and the changes are not being show I think your theme is probably using this renderer.phtml file - rather than editing _getHtml() in Topmenu you probably need to edit /page/html/topmenu/renderer.phtml.

0

you need to copy the file

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

and place it in

app/code/local/Mage/Catalog/Navigation.php

and find the function renderCategoriesMenuHtml, this one is directly called from topmenu.phtml file so you need to start work from here. However, almost all the functions in Navigation.php are involved in creating the Menu so you need to work in them accordingly.

9
  • Hello MTM, My file is topmenu.php. i am delete topmenu.php file and navigation.php file and menu still display. how it possible.
    – coder
    Commented Sep 13, 2014 at 6:08
  • what do u want to do? do you want to remove the menu?
    – MTM
    Commented Sep 13, 2014 at 6:10
  • i want change topmenu strucute of navvigation(menu).
    – coder
    Commented Sep 13, 2014 at 6:12
  • enable template and block hints, and you will get the correct file names that are involved.
    – MTM
    Commented Sep 13, 2014 at 6:16
  • it diplay Mage_Page_Block_Html_Topmenu
    – coder
    Commented Sep 13, 2014 at 6:21
0

AS you are saying that your topmenu.php changes is not showing changes. For that you have to check that from which block its calling if its overridden by other module than it can't show your changes You can check which block is called from topmenu.phtml:

<?php echo get_class($this); ?>

Above line print the block class.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.