1

I'm having some trouble understanding why magento is throwing this exception when I attempt to access my backend. This appears, at least to my eyes, to be configured correctly. Any ideas?

Below is my modules config.xml (located at ProjectName/etc/config.xml):

<global>
    ....       
    <models>
        <projectname>
            <class>NameSpace_ProjectName_Model</class>
            <resourceModel>projectname_mysql4</resourceModel>
        </projectname>
        <projectname_mysql4>
            <class>NameSpace_ProjectName_Model_Mysql4</class>
            <entities>
                <projectname>
                    <table>project_name_table</table>
                </projectname>
            </entities>
        </projectname_mysql4>
    </models>
    ....
</global>

Below is my system.xml (located at ProjectName/etc/system.xml):

<config>
    <sections>
        <cataloginventory>
            <groups>
                <options>
                    <fields>
                        <namespace_projectname_import translate="label">
                            <label>Import project</label>
                            <frontend_type>import</frontend_type>
                            <backend_model>projectname/csv</backend_model>
                            <sort_order>60</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                        </namespace_projectname_import>
                    </fields>
                </options>
            </groups>
        </cataloginventory>
    </sections>
</config>

Below is my model (located at ProjectName/Model/CSV.php):

class NameSpace_ProjectName_Model_CSV extends Mage_Core_Model_Config_Data
{
    public function save()
    {
        Mage::log("this is configured correctly");
        Mage::getResourceModel('projectname/projectname')->uploadData();
    }
}
2

try to rename your file Csv.php and your class NameSpace_ProjectName_Model_Csv.

It should work :)

EDIT

Magento use the uc_words() methods (can be found in app/code/core/Mage/Core/Functions.php).

function uc_words($str, $destSep='_', $srcSep='_')
{
    return str_replace(' ', $destSep, ucwords(str_replace($srcSep, ' ', $str)));
}
  • where is uc_words applicable? Is this why casing so sensitive in filename definition? – easymoden00b Mar 16 '15 at 14:12
  • 2
    when you use Mage::getModel(), Mage::getBlock() or Mage::helper() Magento call the Mage_Core_Model_Config class. You can check the getGroupedClassName() method. At the end it calls the uc_words() function – Pilou Mar 16 '15 at 14:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.