Mage::getStoreConfig('Section/Group/Field') path not in core_config_data
-
29-09-2020 - |
Pregunta
The error after turning developer mode back on is:
Fatal error: Call to a member function toOptionArray() on a non-object in /home/vimarket/public_html/app/code/core/Mage/Adminhtml/Block/System/Config/Form.php on line 463
Within the system.xml of the extension, these fields are causing the issue:
<pixenable translate="label">
<label>Enable</label>
<frontend_type>select</frontend_type>
<source_model>adminhtml/system_config_source_yesno</source_model>
<sort_order>0</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
<comment>Activate this plugin</comment>
</pixenable>
<tipe translate="label">
<label>Tracking Type</label>
<frontend_type>select</frontend_type>
<source_model>adminhtml/system_config_source_tracktype</source_model>
<sort_order>1</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</tipe>
They're within the tags. So, the paths of these must not be there, but I can't figure out exactly where the paths should be.
Config.xml:
<?xml version="1.0"?>
<config>
<modules>
<PixelMarket_Pixel>
<version>1.0.0</version>
</PixelMarket_Pixel>
</modules>
<frontend>
<routers>
<pixel>
<use>standard</use>
<args>
<module>PixelMarket_Pixel</module>
<frontName>pixel</frontName>
</args>
</pixel>
</routers>
<layout>
<updates>
<pixel>
<file>pixel.xml</file>
</pixel>
</updates>
</layout>
</frontend>
<global>
<helpers>
<pixel>
<class>PixelMarket_Pixel_Helper</class>
</pixel>
</helpers>
<blocks>
<pixel>
<class>PixelMarket_Pixel_Block</class>
</pixel>
</blocks>
<models>
<pixel>
<class>PixelMarket_Pixel_Model</class>
<resourceModel>pixel_mysql4</resourceModel>
</pixel>
<pixel_mysql4>
<class>PixelMarket_Pixel_Model_Mysql4</class>
<entities>
<reftable>
<table>reftable</table>
</reftable>
</entities>
</pixel_mysql4>
</models>
<resources>
<pixel_setup>
<setup>
<module>PixelMarket_Pixel</module>
</setup>
<connection>
<use>core_setup</use>
</connection>
</pixel_setup>
<pixel_write>
<connection>
<use>core_write</use>
</connection>
</pixel_write>
<pixel_read>
<connection>
<use>core_read</use>
</connection>
</pixel_read>
</resources>
</global>
<admin>
<routers>
<pixel>
<use>admin</use>
<args>
<module>PixelMarket_Pixel</module>
<frontName>pixel</frontName>
</args>
</pixel>
</routers>
</admin>
<adminhtml>
<menu>
<pixel module="pixel">
<title>Pixel</title>
<sort_order>100</sort_order>
<children>
<reftable module="pixel">
<title>Manage Reftable</title>
<sort_order>0</sort_order>
<action>pixel/adminhtml_reftable</action>
</reftable>
</children>
</pixel>
</menu>
<acl>
<resources>
<all>
<title>Allow Everything</title>
</all>
<admin>
<children>
<pixel translate="title" module="pixel">
<title>Track Customer</title>
<sort_order>1000</sort_order>
<children>
<reftable translate="title">
<title>Manage Tracker</title>
<sort_order>0</sort_order>
</reftable>
</children>
</pixel>
</children>
</admin>
</resources>
</acl>
<layout>
<updates>
<pixel>
<file>pixel.xml</file>
</pixel>
</updates>
</layout>
</adminhtml>
</config>
Solución
The problem comes from:
<source_model>adminhtml/system_config_source_tracktype</source_model>
This source model does not exist. There is also no other source model in the core, called "tracktype", so it's unclear to me what they are trying to do here. A custom source model should not be added to the Mage_Adminhtml
namespace but to the extension namespace.
Conclusion: It's a bug in the extension, their system.xml
is wrong.
Otros consejos
You need to create Tracktype.php file into this file path Block/Adminhtml/System/Config/Tracktype.php
Add below code into system.xml file
<tipe translate="label">
<label>Tracking Type</label>
<frontend_type>select</frontend_type>
<frontend_model>YOURMODULENAME/adminhtml_system_config_source_tracktype</frontend_model>
<sort_order>1</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</tipe>