Magento Custom Model via Mage::getSingleton()

If you are trying to load a custom model using the build in Mage::getSingleton() method and are struggling because it keeps looking in the Mage/ directory for your model instead of your custom model, the best solution I found was simply to put the entire class name of the model.

eg doesn’t work:

//trying to load EC/Custom/Model/Blah.php
Mage::getSingleton('EC_custom/blah');

does work

//trying to load EC/Custom/Model/Blah.php
Mage::getSingleton('EC_Custom_Model_Blah');

Tags: magentocustommodelsingletonmage