0

I've created a custom module with an Observer to log every product change on a log file.
The Observer is listening on the event catalog_product_save_after. I've created the folder for my namespace under app/code/local and so I defined it on the configuration files.

My problem is that Magento is trying to load the module under the namespace Mage, and I don't know the reason for this behavior.

Here are the error log:

2018-01-05T09:06:51+00:00 ERR (3): Warning: include(Mage/Mynamespace/Editlog/Model/Observer.php): failed to open stream: No such file or directory in /Applications/MAMP/htdocs/magento/lib/Varien/Autoload.php on line 94

2018-01-05T09:06:51+00:00 ERR (3): Warning: include(): Failed opening 'Mage/Mynamespace/Editlog/Model/Observer.php' for inclusion (include_path='/Applications/MAMP/htdocs/magento/app/code/local:/Applications/MAMP/htdocs/magento/app/code/community:/Applications/MAMP/htdocs/magento/app/code/core:/Applications/MAMP/htdocs/magento/lib:.:/Applications/MAMP/bin/php/php7.1.8/lib/php') in /Applications/MAMP/htdocs/magento/lib/Varien/Autoload.php on line 94

Does anyone know why is looking for the observer under the Mage directory ? Do I have to put there my module?

  • Do you have a config.xml in the etc/ folder of your module? Do you also have a properly formatted Mynamespace_Editlog.xml file in app/etc/modules/? – 7ochem Jan 5 '18 at 9:53
  • In your config you can specify your codePool, make sure it is set to local. – AngelsDustz Jan 5 '18 at 10:01
  • Yes I have this two files properly formatted, and the codePool is set to local – Enrico Lebanane Jan 5 '18 at 10:11
  • Could you add the config files to the post so we have some more information to go off, cheers. – AngelsDustz Jan 5 '18 at 10:29
0

I found the error. I made a mistake on the config.xml: I didn't define the models tag.

After I defined it, the module is loaded correctly.

The next time I will also post the whole configuration files.

-1

Please try changing the following line in config.xml from:

<class>[modulename]/observer</class>

to:

<class>Mynamespace_Editlog_Model_Observer</class>
  • Changing to full class name makes it impossible to rewrite the observer. – sv3n Jan 5 '18 at 13:13

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.