Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Fatal error: addCacheTag() and addModelTags()
 
thomasdehli
Jr. Member
 
Total Posts:  6
Joined:  2011-03-15
 

I just upgraded from Magento CE v1.7 to v1.8, the top menu won’t load, and the errors are:

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

This thread:

Suggests modifying Observer.php and commenting out:

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

This works, but I don’t know what it affects? Also, I’d rather not have to modify the core.

Another suggestion was to add, “ ‘block’ => $this “ in /app/code/core/Mage/Page/Block/Html/Topmenu.php

But, I already have this line… so I’m at a loss.

Can someone help with with what changed in v1.8 that this doesn’t work, and perhaps a way to fix it? Is it because the site uses custom code?

 
Magento Community Magento Community
Magento Community
Magento Community
 
webzunft
Jr. Member
 
Avatar
Total Posts:  14
Joined:  2011-08-12
Germany
 

Is there some class overriding your /app/code/core/Mage/Page/Block/Html/Topmenu.php ?

In my case there was a /app/code/LOCAL/Mage/Page/Block/Html/Topmenu.php that didn’t update, of course. I added the changes from the core file to this one and was one step further. Still having issues with a blank page after that, but this might not be due to Topmenu.php.

 
Magento Community Magento Community
Magento Community
Magento Community
 
thomasdehli
Jr. Member
 
Total Posts:  6
Joined:  2011-03-15
 

You are absolutely correct. I just discovered this myself.

Our code was overriding the original file, and the correct place to make the change was in…

/app/code/Local/Mage/Page/Block/Html/Topmenu.php

Thanks for taking the time.

 
Magento Community Magento Community
Magento Community
Magento Community
 
GoMageTeam
Guru
 
Avatar
Total Posts:  356
Joined:  2013-01-13
Warsaw, Poland
 

Hello,

It seems the best solution is

Our code was overriding the original file, and the correct place to make the change was in…

/app/code/Local/Mage/Page/Block/Html/Topmenu.php

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top