Upgrading Magento 1.6.1 to 1.7.0 to Save a Custom Module

When I updated Magento, the AheadWorks module was disabled.

When saving to admin, System → Configuration → Advanced →, then click Save Config

An error occurred while saving this configuration: Note: attempt to get non-object property in MAGENTO_ROOT / application / code / kernel /Mage/Adminhtml/Model/Config/Data.php on line 135

I searched for a solution many times, but received nothing.

http://www.magentocommerce.com/bug-tracking/issue/?issue=13819

How to fix it?

+4
source share
3 answers

Locate the following lines of code around line 135 app/code/core/Mage/Adminhtml/Model/Config/Data.php :

 $backendClass = $fieldConfig->backend_model; if (!$backendClass) { $backendClass = 'core/config_data'; } 

and replace it with:

 if (isset($fieldConfig->backend_model)) { $backendClass = $fieldConfig->backend_model; } if (!isset($backendClass)) { $backendClass = 'core/config_data'; } 

Hope this helps.

+12
source

MagePsyco is right, the problem is with the code on line 135 app/code/core/Mage/Adminhtml/Model/Config/Data.php :

 $backendClass = $fieldConfig->backend_model; if (!$backendClass) { $backendClass = 'core/config_data'; } 

The problem with fixing MagePsyco suggests in his answer that the code runs in a loop. After it encounters an attribute with a backend model, the $ backlendModel variable does not return reset back to core/config_data again. So, for example, on the System page of the System Configuration screen, the Installed Currencies attribute has a certain basic model, but this is not found in subsequent attributes. This leads to the launch of the _afterSave method from Mage_Adminhtml_Model_System_Config_Backend_Locale in all subsequent attributes (which will fail).

The best solution is the version of this code that can be found in the 1.8 alpha versions:

 $backendClass = (isset($fieldConfig->backend_model))? $fieldConfig->backend_model : false; if (!$backendClass) { $backendClass = 'core/config_data'; } 

This applies to all null / false / empty errors and ensures that the $ backendModel variable always contains a valid value. This also suggests that the problem should be resolved, and a fix is ​​not required after release 1.8.

+5
source

You can also disable Magento developer mode. I am not a big fan of modifying the kernel (or its extension), so for the lazy, just disabling / enabling MAGE_IS_DEVELOPER_MODE as needed is the easiest solution until it is fixed.

+2
source

Source: https://habr.com/ru/post/1437128/


All Articles