Magento – Fatal Error in Admin Pages

catalogimportmagento-1.7

I have magento 1.7 installed and it worked fine till now.

I import products on daily basis. If there is any new manufacturer, I add it in drop down based Manufacturer attribute.

Today, I have added new Manufacturer option in attribute back-end and gone to import products it successfully imported products.

But after that I try to open any page in Magento admin site, It ends up with below error message

Fatal error: Cannot override final method
Mage_Core_Model_Abstract::clearInstance() in
/var/www/html/app/code/core/Mage/Catalog/Model/Category.php on line 36

Line 36 has just starting curly { for this class

class Mage_Catalog_Model_Category extends Mage_Catalog_Model_Abstract
{ <-- this is line 36

And I have checked Mage_Catalog_Model_Category but there is no method defined with name clearInstance. It is really annoying.

FYI: I did not touch a single character of code I'm just using ADMIN site to import products and adding some required attributes

Best Answer

This behaviour wouldn't normally happen unless you have modified Magento's code in some way - be it via 3rd party extensions, core code edits or general customisations.

The fact it occurs in the admin, prior to any data models actually being loaded (product grid etc.) would imply its being caused by an extension - not imported data.

It it were occurring on the product grid - then it could be the product model at fault as a result of a failed import.

But after a quick search, there is a lot of indexed google search results of Magento stores with the same error. So it could be in the core (albeit, we've never come across it) - but I am doubtful.

Looking at the core in 1.7

+34 abstract class Mage_Catalog_Model_Abstract extends Mage_Core_Model_Abstract
+35 {
+36     /**
+37      * Identifuer of default store

You shouldn't have any override of the clearInstance() method. In fact, this method is only declared once, in app/code/core/Mage/Core/Model/Abstract.php

final public function clearInstance()

I've seen errors of this nature occur when people have mistakenly used include for an overridden class (resulting in it being loaded twice).


Your best options are to follow the standard debug procedure

  1. Restore a clean core
  2. Restore a clean adminhtml dir
  3. Rename ./app/code/local directory
  4. Rename ./app/code/community directory

And see if the issue persists.