Topmenu not functioning after upgrade magento 1.8 fatal error addCacheTag()

As we seen with my previous blog upgrade community edition magento 1.7 to magento 1.8,  we know how to upgrade magento with latest version.

When I was doing the same with one my project, I come across the error something like,

Fatal error: Call to a member function addCacheTag() on a non-object in (Base Path)/app/code/core/Mage/Catalog/Model/Observer.php on line 215

For quick fix, initially I have comment out two lines from file app/code/core/Mage/Catalog/Model/Observer.php

Line # 241 ($menuBlock->addModelTags($categoryModel);) 
Line # 215 ($block->addCacheTag(Mage_Catalog_Model_Category::CACHE_TAG);)

But after spending some time, I come to know that I have used one of the menu extension which is exptending the “Mage_Page_Block_Html_Topmenu” and there is some problem with Mage::dispatchEvent.

With my extended code it was just something like

Mage::dispatchEvent('page_block_html_topmenu_gethtml_before', array(
          'menu' => $this->_menu

Updated code is,

Mage::dispatchEvent('page_block_html_topmenu_gethtml_before', array(
        'menu' => $this->_menu,
        'block' => $this         //add this line

Most probebly this would resolve your issue.


6 thoughts on “Topmenu not functioning after upgrade magento 1.8 fatal error addCacheTag()

  1. Pingback: Magento – Onepage checkout not working after upgrade/update Magento 1.8 | Tech Bandhu

  2. in what exact file do you update this code?

    Mage::dispatchEvent(‘page_block_html_topmenu_gethtml_before’, array(
    ‘menu’ => $this->_menu,
    ‘block’ => $this //add this line

    • It must be a syntax error, Or it could be wrong with code. Please enable error reporting or check error log to know more about error. If you need any help you can provide more info about the error so I can help in that..

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s