I am working on magento 1.9 using luxury theme

I am loading left navigation using mega menu inside static block. like this

{{block type="megamenu/vertical" menu_id="3" template="megamenu/vertical.phtml"}}

and calling this static block inside 2columns-left.phtml like this echo $this->getLayout()->createBlock('cms/block')->setBlockId('about-us-1')->toHtml();

for this i am checking which cms page is loading in if condition

$cmsPageUrlKey = Mage::getSingleton('cms/page')->getIdentifier();
if ($cmsPageUrlKey == "corporate-overview" || $cmsPageUrlKey == "history" || $cmsPageUrlKey == "vision-mission" || $cmsPageUrlKey == "awards" || $cmsPageUrlKey == "certifications") {
    echo $this->getLayout()->createBlock('cms/block')->setBlockId('about-us-1')->toHtml();

} else if ($cmsPageUrlKey == "ffs-policy" || $cmsPageUrlKey == "emergency-service-policy" || $cmsPageUrlKey == "warranty-details" || $cmsPageUrlKey == "spare-key-requirment" || $cmsPageUrlKey == "security-tips" || $cmsPageUrlKey == "lock-care" || $cmsPageUrlKey == "master-key" || $cmsPageUrlKey == "access-control-systems" || $cmsPageUrlKey == "common-key") {
    echo $this->getLayout()->createBlock('cms/block')->setBlockId('services1')->toHtml();
} else if ($cmsPageUrlKey == "overview" || $cmsPageUrlKey == "join-us") {
    echo $this->getLayout()->createBlock('cms/block')->setBlockId('career-page')->toHtml();
}

This code works but after opening 3-4 cms pages It is loading random menu on each pages.

what will be the issue ?

有帮助吗?

解决方案

It seems you have cache issue. Your mega menu is loading from cache. So need to remove that block from cache. If you are using any custom cache extension then you can make hole punch in cache for make that mega menu force loading each time.

You need to remove your block from cache as below: You need to pass argument when call block "cache_lifetime=0" to remove it from cache.

{{block type="megamenu/vertical" cache_lifetime=0 menu_id="3" template="megamenu/vertical.phtml"}}
许可以下: CC-BY-SA归因
scroll top