Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7712729
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T01:42:18+00:00 2026-06-01T01:42:18+00:00

Im working on a custom admin module for magento, and trying to learn the

  • 0

Im working on a custom admin module for magento, and trying to learn the magento approach at the same time =). Im currently on version CE 1.6.

I’ve followed a couple of tutorials and articles and managed to setup an custom db table and I think I managed the make collection class to work. (I should say Im new to Zend Framework/Magento and a beginner skilled programmer). At least the following code get’s me the right result:

$department_collection = Mage::getModel('custom/systemconfig')->getCollection()
                            ->addFilter('name','departments');

When I var_dump this with $department_collection->getData() I get an array with the filtered rows from my DB.

Now, when I try to do this:

foreach ($department_collection as $department) {
        $department->delete();
    }

I get an exception from Magento:

-Warning: include(Mage\Upperfield\Model\Systemconfig.php) [function.include]: failed to open stream: No such file or directory in D:\wamp\www\magento\lib\Varien\Autoload.php on line 93

The problem is that I guess I setup my directory structure wrong, but just don’t understand what it is. And the trace isn’t much help as it is concatenated and only shows inrelevant info.

My directory structure looks like this:

+app
  +code
     +local
       +Namespace
         +Module
           +Model
             +Mysql4
                +Systemconfig
                   Collection.php
                Systemconfig.php
             Systemconfig.php

I’ve loaded my models with:

//file: ../Mysql4/Systemconfig.php
class Namespace_Module_Model_Mysql4_Systemconfig extends Mage_Core_Model_Mysql4_Abstract{
    protected function _construct()
    {
        $this->_init('module/systemconfig', 'systemconfig_id');
    }
}



// file: ../Mysql4/Systemconfig/Collection.php
class Namespace_Module_Model_Mysql4_Systemconfig_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract {
    protected function _construct()
    {
        $this->_init('namespace/systemconfig');
    }
}

My config.xml looks currently like this (excerpt):

<models>
  <module>
        <class>Namespace_Module_Model</class>
    <resourceModel>module_mysql4</resourceModel>
</module>

<module_mysql4>
    <class>Namespace_Module_Model_Mysql4</class>
    <entities>
        <systemconfig>
            <table>module_systemconfig</table>
        </systemconfig>
    </entities>
</module_mysql4>

My guess is either:
I setup the collection class with wrong structure, or
I missunderstand how to use the collection object.

Any wiz out there that could explain to me what happens here?
Gratefull for any help.

Best regards
Adde

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T01:42:19+00:00Added an answer on June 1, 2026 at 1:42 am

    The error you got was from improper xml definitions OR class naming/file structure – which should be identical. When the Autoloader read your config.xml and looked where you told it to in said config.xml, it did not find the file(s) it was looking for.

    A little info on collections and their parent models, if it helps:

    If you are working directly with a collection, you should use:

    $_collection = Mage::getResourceModel('namespace/model_collection');
    

    If you are working with a Model that takes a collection’s data, and modifies the data (e.g. sums things up, adds additional data, removes things etc.) you should call the model like so:

    $_collection = Mage::getModel('namespace/model')->getCollection();
    

    Either way, in your config.xml, you need to define that you are using a resource model and which tables (if you have custom tables) it should be working with. You should never have to write a new collection to interact with default Magento tables, as there are already collections that you can call OR extend (not recommended, you should use Observers).

    Here is an example of a proper collection definition in config.xml:

    <models>
        <modulename>
            <resourceModel>modulename_mysql4</resourceModel>
        </modulename>
        <modulename_mysql4>
            <class>Namespace_ModuleName_Model_Mysql4</class>
            <entities>
                <modulename>
                    <table>modulename_custom</table>
                </modulename>
            </entities>
        </modulename_mysql4>
    </models>
    <resources>
        <modulename_setup>
            <setup>
                <module>Namespace_ModuleName</module>
            </setup>
            <connection>
                <use>core_setup</use>
            </connection>
        </modulename_setup>
        <modulename_write>
            <connection>
                <use>core_write</use>
            </connection>
        </modulename_write>
        <modulename_read>
            <connection>
                <use>core_read</use>
            </connection>
        </modulename_read>
    </resources>
    

    In this file, the inline definitions and nodes that I’ve written MUST be written like that, you cannot have a return, it must be the same line. This is a small drawback to how the Magento autoloader works.

    Hope this helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on a custom module in magento admin that uses the ‘sales/order_grid_collection’
I am working on a custom admin module where I show a list of
I've been working on a custom module that has a backend for admin. Until
I'm working on a custom version of a GNU/Linux live distribution. I need to
I'm working on a Django project, and I've created some custom admin views using
I'm working on a custom wordpress theme with a little bit of backend admin
I created a module that used a custom widget/grid/column for my admin grid to
I have a custom post_type created in wordpress admin control panel. all is working
I'm working on a custom admin interface for managing sfGuardGroupPermission records, basically allowing the
I have developed a new custom extension for magento admin section. Main menu option

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.