我使用Magento的开发人员指南创建了一个自定义模块,但安装程序脚本无效。我收到这个错误:
致命错误:在第234行的C:\ xampp \ htdocs \ magento \ includes \ src \ Mage_Core_Model_Resource_Setup.php中找不到类'Mdg_Giftregistry_Model_Resource_Setup'
我的config.xml:
@Component
这是安装程序脚本
<?xml version="1.0"?>
<config>
<modules>
<Mdg_Giftregistry>
<version>0.1.0</version>
</Mdg_Giftregistry>
</modules>
<frontend>
<routers>
<mdg_giftregistry>
<use>standard</use>
<args>
<module>Mdg_Giftregistry</module>
<frontName>giftregistry</frontName>
</args>
</mdg_giftregistry>
</routers>
</frontend>
<global>
<models>
<mdg_giftregistry>
<class>Mdg_Giftregistry_Model</class>
<resourceModel>mdg_giftregistry_mysql4</resourceModel>
</mdg_giftregistry>
<mdg_giftregistry_mysql4>
<class>Mdg_Giftregistry_Model_Mysql4</class>
<entities>
<entity>
<table>mdg_giftregistry_entity</table>
</entity>
<item>
<table>mdg_giftregistry_item</table>
</item>
<type>
<table>mdg_giftregistry_type</table>
</type>
</entities>
</mdg_giftregistry_mysql4>
</models>
<resources>
<mdg_giftregistry_setup>
<setup>
<module>Mdg_Giftregistry</module>
<class>Mage_Core_Model_Resource_Setup</class>
</setup>
<connection>
<use>core_setup</use>
</connection>
</mdg_giftregistry_setup>
<mdg_giftregistry_write>
<connection>
<use>core_write</use>
</connection>
</mdg_giftregistry_write>
<mdg_giftregistry_read>
<connection>
<use>core_read</use>
</connection>
</mdg_giftregistry_read>
</resources>
<blocks>
<mdg_giftregistry>
<class>Mdg_Giftregistry_Block</class>
</mdg_giftregistry>
</blocks>
<helpers>
<mdg_giftregistry>
<class>Mdg_Giftregistry_Helper</class>
</mdg_giftregistry>
</helpers>
</global>
</config>
答案 0 :(得分:1)
致命错误:未找到类'Mdg_Giftregistry_Model_Resource_Setup'
这是因为您在config.xml中引用了自定义安装类:
<setup>
<module>Mdg_Giftregistry</module>
<class>Mdg_Giftregistry_Model_Resource_Setup</class>
</setup>
我假设你还没有创建这个类,所以你有两个选择:
创建将Mdg_Giftregistry_Model_Resource_Setup
扩展的类Mage_Core_Model_Resource_Setup
:
# File: app/code/local/Mdg/Giftregistry/Model/Resource/Setup.php
class Mdg_Giftregistry_Model_Resource_Setup extends Mage_Core_Model_Resource_Setup
{
}
更改config.xml条目,使其使用核心类:
<class>Mage_Core_Model_Resource_Setup</class>
您的安装人员可能仍会遇到更多问题,但如果不共享您的代码,则很难知道/预测。
祝你好运!