Magento module Fatal error: Class 'Mage_Cashondelivery_Helper_Data' not found in \xampp\htdocs\magento\app\Mage.php on line 516

Magento module Fatal error: Class 'Mage_Cashondelivery_Helper_Data' not found in \xampp\htdocs\magento\app\Mage.php on line 516

July 1, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento module Fatal error: Class 'Mage_Cashondelivery_Helper_Data' not found in \xampp\htdocs\magento\app\Mage.php on line 516

Creating a payment module for Magento involves several steps, including the creation of necessary directories, XML configuration files, model classes, and helper classes. In your case, you have followed the official Magento tutorial to create a Cash on Delivery (COD) payment method module.

Let’s break down the issue you’re facing and provide a step-by-step solution:

Directory Structure You have correctly created the necessary directories for your module:

  • app/local/Companyname/Cashondelivery
    • Block: Contains block classes that handle the display of information on the frontend.
    • Controller: Controllers handle the logic behind actions like creating or updating a payment method.
    • etc: Configuration files, including the module’s main configuration file (config.xml).
    • Helper: Contains helper classes for handling common tasks in your module.
    • Model: Contains model classes that perform the core business logic of your payment method.

Configuration Files You have created two essential XML configuration files:

  1. config.xml: This is the primary configuration file where you define basic information about your Magento extension, including its unique identifier, version number, and dependencies on other extensions.
<config>
  <modules>
    <Companyname_Cashondelivery>
      <active>true</active>
      <codepool>local</codepool>
      <depends><Companyname_Allinone_Payment/></depends>
    </Companyname_Cashondelivery>
  </modules>
</config>

In this configuration, we assume that your module depends on another payment method called “Companyname_Allinone_Payment.” Make sure to replace it with the actual dependency if needed.

  1. system.xml: This file is used for the configuration of Magento’s global settings such as payment methods and currency settings.
<config>
  <global>
    <!-- Define your new payment method -->
    <payment>
      <cashondelivery active="true" model="cashondelivery/createorder">
        <title>Cash on Delivery</title>
        </cashondelivery>
    </payment>

    <!-- Define the helper class for your module -->
    <helpers>
      <companyname_cashondelivery>
        <class>Companyname_Cashondelivery_Helper_Data</class>
      </companyname_cashondelivery>
    </helpers>
  </global>
</config>

In the above configuration, you have defined your new “Cash on Delivery” payment method with its title and corresponding model class. Additionally, you have registered the “Companyname_Cashondelivery_Helper_Data” helper class for your module.

Model Class You have created a model class named Companyname_Cashondelivery_Model_createorder that extends Mage_Payment_Model_Method_Cc.

class Companyname_Cashondelivery_Model_createorder extends Mage_Payment_Model_Method_Abstract
{
    // Define your payment method details...
}

In this model, you need to implement the necessary methods for authorizing, capturing, and voiding transactions based on your payment method’s requirements. For a COD payment method, these methods may not need to perform any actual transaction processing.

Helper Class You have created a helper class named Companyname_Cashondelivery_Helper_Data that extends Mage_Core_Help_Abstract. This class can be used in your module to handle common tasks and share data between different components of your payment method.

class Companyname_Cashondelivery_Helper_Data extends Mage_Core_Helper_Abstract
{
    // Implement any helper methods or properties required for your module...
}

Issue Analysis The error you’re encountering, “Class ‘Mage_Cashondelivery_Helper_Data’ not found in Mage.php on line 516,” suggests that the system is trying to locate and load a class named “Mage_Cashondelivery_Helper_Data” which does not exist.

Upon reviewing your configuration files, we can see that you have registered the helper class for your module as “companyname_cashondelivery.” However, in the payment method definition inside “system.xml,” you are attempting to use a different namespace (“cashondelivery”) for the helper class lookup.

Solution To resolve this issue, update your configuration files accordingly:

  1. Update the helper registration inside “system.xml” to match the actual namespace of your helper class:
<config>
  <global>
    <!-- ... -->
    <helpers>
      <companyname_cashondelivery>
        <class>Companyname_Cashondelivery_Helper_Data</class>
      </companyname_cashondelivery>
    </helpers>
  </global>
</config>
  1. Update the payment method definition inside “system.xml” to use the correct namespace for your helper class lookup:
<config>
  <global>
    <!-- ... -->
    <payment>
      <cashondelivery active="true" model="companyname_cashondelivery/createorder">
        <title>Cash on Delivery</title>
        </cashondelivery>
    </payment>

    <!-- Define the helper class for your module -->
    <helpers>
      <companyname_cashondelivery>
        <class>Companyname_Cashondelivery_Helper_Data</class>
      </companyname_cashondelivery>
    </helpers>
  </global>
</config>
  1. Make sure your configuration files are correctly located and loaded by Magento:
    • config.xml should be placed inside the “etc” directory of your module.
    • system.xml should be placed inside the “etc/config” sub-directory of your module.

After resolving these issues, you should be able to open Configuration > Payment Methods without encountering any errors related to missing helper classes. Ensure that all files are correctly configured and named according to Magento’s naming conventions for proper loading and execution.

Extensions Configuration Errors

Our network