I am trying to learn Magento hard and although I have good understandig of OOP and programming ,still struggling.I am following tutorials ,do the same as there and got errors ,which is very dissapointing.I made module ,this is my config.xml :

<?xml version="1.0"?>

In the Model folder I have first User.php :


class Foggyline_HappyHour_Model_User extends Mage_Core_Model_Abstract
   protected $_eventPrefix      = 'foggyline_happyhour_user';
   protected $_eventObject      = 'user';

   protected function _construct()

in Model/Resuource/User.php :


class Foggyline_HappyHour_Model_Resource_User extends Mage_Core_Model_Resource_Db_Abstract
   protected function _construct()
       $this->_init('foggyline_happyhour/user', 'user_id');

and Model/Resuorce/User/Collection.php :


class Foggyline_HappyHour_Model_Resource_User_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract
   public function _construct()

Also there is some init script for the database ,I don't know whether this is problem with database or something like this?

in my controller I have this function : 
public function testAction(){

page is just crashing with this code ,if I put capital letters 'Foggyline_Happyhour ,page is not crashing and show bool(false) ,which should mean nothing is instantiated,how do I fix this mess is the big question ? I am using Linux btw

  • use echo get_class($obj); check what class given u?
    – Amit Bera
    Apr 26, 2016 at 17:37
  • Did you flush caches?
    – goral
    Apr 26, 2016 at 17:40

1 Answer 1


in your config.xml, under resources/foggyline_happyhour_setup/setup, you have defined a model tag, but I think it has to be module: https://github.com/bragento/magento-core/blob/1.9/app/code/core/Mage/Cms/etc/config.xml#L167

Also look in you database, if the foggyline_happyhour_user table is created (most likely after you fixed the config.xml and cleared the cache)

  • Ok ,I had typo in one class ,now print_r(get_class_methods($obj)) returns all the methods ,the problem is that the database is not created and it throws exception
    – dobrganch
    Apr 26, 2016 at 17:44
  • the database table not beeing created should be an issue with the config.xml, your setup script or maybe some information in the exception. Could you improve your question and post your setup script, the name of the setup script and the exception stack trace pls. also look up the core_resource table if there is already an entry for your module. The setup script is only executed, if there is no entry or you have a new setup script version Apr 26, 2016 at 17:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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