Search code examples
phpmagentomagento-1.8mageadminhtml

Magento Fatal error: Call to a member function addData()


I am using Magento v1.8 CE and I am having an issue when trying to access any exportation/importation functionality from the Dataflow - Profiles section within System > Export/Import. The error reads:

Fatal error: Call to a member function addData() on a non-object in /httpdocs/app/code/core/Mage/Adminhtml/Block/System/Convert/Gui/Edit/Tabs.php on line 49

I have found related issues here but I would prefer not to mess with core Mage code. According to this article: the most probable cause for this kind of error may appear as a result of an out-dated Mage_Core_Adminhtml package, or package is upgraded but old code is cached by compiler.

I have not upgraded any packages, however I do have a local version of the site on another server which works fine. It could be slight differences between the 2 servers but I can't be sure. Can someone help me out? Or explain the purpose of the Mage "Adminhtml" module so I can gain a better understanding of where it is going wrong.

Many thanks


Solution

  • Look at line 48 of app/code/core/Mage/Adminhtml/Block/System/Convert/Gui/Edit/Tabs.php. There you should see

    $wizardBlock = $this->getLayout()->createBlock('adminhtml/system_convert_gui_edit_tab_wizard');
    

    You should check if you have that file app/code/core/Mage/Adminhtml/Block/System/Convert/Gui/Edit/Tab/Wizard.php. If you have the file above, verify what's $this->getLayout() by using the methods is_object and get_class. Also check for any modules from app/code/local or app/code/community that override the class from the second file above.

    As a last resort go into the app/code/core/Mage/Core/Model/Config.php file and edit the getGroupedClassName method around line 1213 and before return $className add a new row with Mage::log($className, null, 'block_classes.log');. Now you should have a log in var/log/block_classes.log and see what class Magento is trying to initialize before it throws that error.