6

Is there any reason why Mage_Page_Block_Html_Topmenu block has its cache lifetime set to 0 (also holepunched in EE) ?

Adding a "active" class for "base/default" theme menu items is definitely not one as it has to be done on the theme level.

  • What do you mean it has the lifetime 0. It is set to false. This means it is always cached. The problem is that the block is not used for the navigation starting ce-1.7. Mage_Page_Block_Html_Topmenu is used instead. That one is not cached. – Marius Jul 25 '14 at 14:31
  • Yes, sorry. Mixed the block name because in app/code/core/Enterprise/PageCache/etc/cache.xml it resides in <catalog_navigation> node (why?). Updated. – Foo Bar Jul 25 '14 at 14:54
3

I could quote what Ivan Chepurnyi says in here (slide 29) and say "they moved the menu to another blockbut forgot to add caching to it".

Or I could express my opinion.
The menu is just a placeholder now, and it could be modified by observers and look different from page to page.
To cache it, you will need to know the selected menu item that might not be a category. In the current implementation, you still have to go through the menu tree to see what node is selected.
If you know you will only have categories in that menu you can add the caching and a javascript solution for marking the selected menu. See solution in next slides of Ivan's slideshow.
I'm sure there is a way to extend and make it general, not just category dependent.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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