0

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 ?

2

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"}}
  • yes that is the issue, I checked it now. each time I clear cache menu works fine... how to remove mega menu from the cache? – parish Apr 26 '18 at 5:16
  • which cache extention you are using? – Chirag Rajput Apr 26 '18 at 5:17
  • i guess it is default cache extension of Magento or Luxury theme extension. I dont know here is Screenshot : i.stack.imgur.com/W88eX.jpg – parish Apr 26 '18 at 5:28
  • You can disable "Blocks HTML output" cache for now and test menu. – Chirag Rajput Apr 26 '18 at 5:31
  • Enjoy. Happy Coding :) – Chirag Rajput Apr 26 '18 at 5:42

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.