Magento custom module not using the correct include path

Magento custom module not using the correct include path

October 6, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento custom module not using the correct include path

Solving Magento Custom Module Include Path Issues

As a senior developer specializing in e-commerce platforms, I often encounter issues like the one you’re facing while working on Magento custom modules. Let’s dive into your problem and find a solution together.

Understanding Your Configuration

Firstly, it’s important to understand that Magento uses its app/etc/modules directory to determine which modules are enabled or disabled. The CustomerParadigm_NoPay.xml file you’ve created is correctly configured:

<config>
    <modules>
        <CustomerParadigm_NoPay>
            <active>true</active>
            <codePool>local</codePool>
        </CustomerParadigm_NoPay>
    </modules>
</config>

This tells Magento to enable the CustomerParadigm_NoPay module and look for its files in the app/code/local directory.

The Include Path Problem

The error you’re encountering is due to Magento’s autoloader trying to load a file named Mage/Model/Nopay.php. This isn’t the correct path, as it should be looking for your custom module instead.

Let me break down the issue further:

  1. When Magento enables a module, it looks in the corresponding directory (in this case, app/code/local/CustomerParadigm/NoPay) for the main PHP file, usually named after the module (NoPay.php).

  2. If that file isn’t found, it tries to autoload a model file by looking for Mage/Model/NoPay.php. Since you don’t have a Model directory in your custom module, this is causing the “No such file or directory” error.

The Root Cause

The issue lies in how Magento’s autoloader works. By default, it follows a specific naming convention and path structure that may not align with the way you’ve structured your custom module.

The Solution: Correct Module Structure

To resolve this issue, we need to ensure our custom module is structured correctly:

  1. Create the following directory structure for your NoPay module in app/code/local:
- NoPay
  - etc
    - config.xml
  - Model
  - controllers
  1. The controllers folder should contain your payment method controller classes (e.g., PaymentController.php).

  2. The etc/config.xml file defines the configuration for your module:

<config>
    <modules>
        <Customer_Paradigm_NoPay>
            <version>1.0.0</version>
        </Customer_Paradigm_NoPay>
    </modules>

    <!-- Define your payment method configuration here -->
</config>
  1. Ensure the Model directory is empty or contains any necessary model classes for your custom payment module.

  2. Clean and recompile Magento after making these changes:

php -f Mage.php clean:cache
php -f Mage.php clean:static
php -f Mage.php compile

Incorporating Best Practices

In addition to the above solution, it’s essential to follow some best practices when working with custom Magento modules:

  1. Use a consistent naming convention: Always use the Customer_Paradigm prefix for your module names, as recommended by Magento.

  2. Separate configuration files: Keep your config.xml and other XML files in an etc directory within your module to maintain better organization.

  3. Clean and compile regularly: While working on custom modules, it’s crucial to clean and recompile Magento frequently to ensure that changes take effect correctly.

Conclusion

In summary, the issue you’re facing is due to a mismatch between how you’ve structured your custom payment module and Magento’s default autoloading behavior.

By following the correct directory structure for your NoPay module and ensuring it follows the recommended naming conventions, you should be able to resolve the “include path” error.

Remember that proper organization and adherence to best practices are key when working with Magento custom modules. If you have any further questions or need assistance with other aspects of Magento development, feel free to explore our comprehensive guides for more in-depth insights into the platform.

Happy coding!

Extensions Configuration Customers Import/Export

Our network