Magento模块致命错误:类';Mage_Cashondelivery_Helper_Data';在第516行的\xampp\htdocs\magento\app\Mage.php中找不到

Magento模块致命错误:类';Mage_Cashondelivery_Helper_Data';在第516行的\xampp\htdocs\magento\app\Mage.php中找不到,php,zend-framework,magento,Php,Zend Framework,Magento,我正在为Magento开发一个支付模块。我是用这个教程做的 我已经创建了一个文件夹 app/local/Companyname/Cashondelivery/Block app/local/Companyname/Cashondelivery/Model app/local/Companyname/Cashondelivery/controller app/local/Companyname/Cashondelivery/etc app/local/Companyname/Cashondeli

我正在为Magento开发一个支付模块。我是用这个教程做的

我已经创建了一个文件夹

app/local/Companyname/Cashondelivery/Block
app/local/Companyname/Cashondelivery/Model
app/local/Companyname/Cashondelivery/controller
app/local/Companyname/Cashondelivery/etc
app/local/Companyname/Cashondelivery/helpers
etc/config.xml

    <?xml version="1.0"?>
    <config>
        <modules>
           <Companyname_Cashondelivery>
    <!-- declare module's version information for database updates -->
              <version>0.1.0</version>
           </Companyname_Cashondelivery>
        </modules>

        <global>


    <!-- declare model group for new module -->
            <models>
    <!-- model group alias to be used in Mage::getModel('newmodule/...') -->
                <createorder>
    <!-- base class name for the model group -->
                    <class>Companyname_Cashondelivery_createorder</class>
                </createorder>
            </models>

    <!-- declare resource setup for new module -->
            <resources>
    <!-- resource identifier -->
                <cashondelivery_setup>
    <!-- specify that this resource is a setup resource and used for upgrades -->
                    <setup>
    <!-- which module to look for install/upgrade files in -->
                        <module>Companyname_Cashondelivery</module>
                    </setup>
    <!-- specify database connection for this resource -->
                    <connection>
    <!-- do not create new connection, use predefined core setup connection -->
                        <use>core_setup</use>
                    </connection>
                </cashondelivery_setup>
                <cashondelivery_write>
                    <connection>
                      <use>core_write</use>
                    </connection>
                </cashondelivery_write>
                <cashondelivery_read>
                   <connection>
                    <use>core_read</use>
                  </connection>
                </cashondelivery_read>
            </resources>
        </global>

    <!-- declare default configuration values for this module -->
        <default>
    <!-- 'payment' configuration section (tab) -->
            <payment>
    <!-- 'newmodule' configuration group (fieldset) -->
                <cashondelivery>
    <!-- by default this payment method is inactive -->
                    <active>0</active>
    <!-- model to handle logic for this payment method -->
                    <model>cashondelivery/createorder</model>
    <!-- order status for new orders paid by this payment method -->
                    <order_status>pending</order_status>
    <!-- default title for payment checkout page and order view page -->
                    <title>Companyname</title>                
                </cashondelivery>
             </payment>
        </default>
</config>

0.1.0
公司名称\u现金交付\u创建订单
公司名称\现金交付
核心单元设置
核心写入
核心读取
]]>-->
启用
选择
adminhtml/system\u config\u source\u yesno
1.
1.
1.
0
电子邮件客户
选择
adminhtml/system\u config\u source\u yesno
10
1.
1.
0
API登录ID
模糊的
adminhtml/system\u config\u backend\u加密
2.
1.
1.
0
商户电子邮件
文本
11
1.
1.
0
新订单状态
选择
adminhtml/system\u config\u source\u order\u status\u processing
4.
1.
1.
0
排序顺序
文本
100
1.
1.
0
测试模式
选择
adminhtml/system\u config\u source\u yesno
5.
1.
1.
0
调试
选择
adminhtml/system\u config\u source\u yesno
6.
1.
1.
0
标题
文本
2.
1.
1.
1.
付款行为
选择
现金交付/创建订单
2.
1.
1.
0
网关URL
文本
5.
1.
1.
0
最低订单总数
文本
98
1.
1.
0
最大订单总数
文本
99
1.
1.
0
允许部分授权
选择
adminhtml/system\u config\u source\u yesno
110
1.
1.
0
然后我创建了一个模型类

<?php 
/**
* Our test CC module adapter
*/
class Companyname_Cashondelivery_Model_createorder extends Mage_Payment_Model_Method_Cc
{
    /**
    * unique internal payment method identifier
    *
    * @var string [a-z0-9_]
    */
    protected $_code = 'newmodule';

    /**
     * Here are examples of flags that will determine functionality availability
     * of this module to be used by frontend and backend.
     *
     * @see all flags and their defaults in Mage_Payment_Model_Method_Abstract
     *
     * It is possible to have a custom dynamic logic by overloading
     * public function can* for each flag respectively
     */

    /**
     * Is this payment method a gateway (online auth/charge) ?
     */
    protected $_isGateway               = true;

    /**
     * Can authorize online?
     */
    protected $_canAuthorize            = true;

    /**
     * Can capture funds online?
     */
    protected $_canCapture              = false;

    /**
     * Can capture partial amounts online?
     */
    protected $_canCapturePartial       = false;

    /**
     * Can refund online?
     */
    protected $_canRefund               = false;

    /**
     * Can void transactions online?
     */
    protected $_canVoid                 = true;

    /**
     * Can use this payment method in administration panel?
     */
    protected $_canUseInternal          = true;

    /**
     * Can show this payment method as an option on checkout payment page?
     */
    protected $_canUseCheckout          = true;

    /**
     * Is this payment method suitable for multi-shipping checkout?
     */
    protected $_canUseForMultishipping  = true;

    /**
     * Can save credit card information for future processing?
     */
    protected $_canSaveCc = false;

    /**
     * Here you will need to implement authorize, capture and void public methods
     *
     * @see examples of transaction specific public methods such as
     * authorize, capture and void in Mage_Paygate_Model_Authorizenet
     */        
}
?>

我甚至在app/local/Companyname/Cashondelivery/Helper/Data.php中创建了一个文件

<?php
class Companyname_Cashondelivery_Helper_Data extends Mage_Core_Helper_Abstract
{
}
?>

但是当我打开“配置”>“付款方式”时出错

致命错误:在第516行的C:\xampp\htdocs\magento\app\Mage.php中找不到类“Mage\u Cashondelivery\u Helper\u Data”


是否需要有一个助手类。我不知道helpers和Data。php

模块需要helper类的原因是system.xml文件中的
module
参数:

现在,Magento通过查找缺少的节点
global/helpers/cashondelivery/class
来检查要使用的类前缀

到目前为止相当简单,但这里我
<?php
class Companyname_Cashondelivery_Helper_Data extends Mage_Core_Helper_Abstract
{
}
?>
<cashondelivery translate="label" module="cashondelivery">
Mage::helper('cashondelivery');
// identical to Mage::helper('cashondelivery/data');
<global>
  <helpers>
    <cashondelivery>
      <class>Companyname_Cashondelivery_Helper</class>
    </cashondelivery>
  </helpers>
</global>