magento-turpentine
magento-turpentine copied to clipboard
Duplicate navigation with Megamenu
The navigation block from CSmart's Megamenu is duplicated when Turpentine ESI-injects the header.
It appears to be seen twice for some reason;
2017-03-24T13:22:15+00:00 INFO (6): TURPENTINE: Checking ESI block candidate: catalog.topnav.megamenu
2017-03-24T13:22:15+00:00 INFO (6): TURPENTINE: -- block testing: shouldResponseUseEsi = 1
2017-03-24T13:22:15+00:00 INFO (6): TURPENTINE: -- block testing: instanceof Mage_Core_Block_Template = 1
2017-03-24T13:22:15+00:00 INFO (6): TURPENTINE: -- block testing: Esi Options =
2017-03-24T13:22:16+00:00 INFO (6): TURPENTINE: Checking ESI block candidate: catalog.topnav.megamenu
2017-03-24T13:22:16+00:00 INFO (6): TURPENTINE: -- block testing: shouldResponseUseEsi = 1
2017-03-24T13:22:16+00:00 INFO (6): TURPENTINE: -- block testing: instanceof Mage_Core_Block_Template = 1
2017-03-24T13:22:16+00:00 INFO (6): TURPENTINE: -- block testing: Esi Options =
Here's the default block definition:
<reference name="header">
<reference name="top.menu">
<reference name="catalog.topnav">
<action method="setTemplate" ifconfig="megamenu/mainmenu/enabled"><template>page/html/topmenu_2.phtml</template></action>
</reference>
<!-- -->
<block type="megamenu/navigation" name="catalog.topnav.megamenu">
<action method="unsetData"><key>cache_lifetime</key></action>
<action method="unsetData"><key>cache_tags</key></action>
</block>
<!-- -->
</reference>
</reference>
If I change this to the following, it works as expected:
<reference name="header">
<reference name="top.menu">
<reference name="catalog.topnav">
<action method="setTemplate" ifconfig="megamenu/mainmenu/enabled"><template>page/html/topmenu_2.phtml</template></action>
</reference>
</reference>
<block type="megamenu/navigation" name="catalog.topnav.megamenu" as="topMenu">
<action method="unsetData"><key>cache_lifetime</key></action>
<action method="unsetData"><key>cache_tags</key></action>
</block>
</reference>
Any idea of why this is the case?
In issue #982 there's a user describing the exact same problem with a different theme (I'm using one from Templatemonster) and menu module. Their module uses similar structure/nesting and naming as above (difference being that in their case it's catalog.topnav.menu and not catalog.topnav.megamenu).
This seems to be just a coincidence. You removed the unsetData from this block when you changed the XML, my guess is that you will have the same effect just by removing the unsetData instead of moving it someplace else. Which caches have you enabled in your install?
Well, I didn't remove the unsetData from the block in question? As you can see by the above XML, I kept the block XML identical apart from moving it and adding as="topMenu"
(otherwise it wouldn't show). After your comment I've tried moving it back and just commenting out the unsetData elements - at which point the duplication problem returns. (Clearing the caches in between, of course.)
By default I currently have all caches enabled. Should any of them (e.g. Blocks HTML output
) be disabled when using Turpentine? That would seem less than ideal for the first page load, where the request goes directly to the webserver (due to the "VCL fix").
Even disabling all of them apart from Varnish Pages
and Varnish ESI Blocks
and clearing the cache yields the same result / duplication with the original block definition (with or without the unsetDatas).