3

I inherited a couple of Magento installs with custom observers to handle integration with SAP B1. The B1 parts I get, but Magento keeps throwing curveballs at me that I just can't get good answers about. I have searched on SE, and found a few people with the same error messages, but none of their fixes/causes seem to be affecting me.

Whenever cron.php runs, I get the following 3 errors every time:

2015-02-25T00:30:02+00:00 ERR (3): Warning: include(Mage/CompanyName/AutomatedImport/Model/Observer.php): failed to open stream: No such file or directory  in /chroot/home/shop/shop.companyname.com/html/lib/Varien/Autoload.php on line 93
2015-02-25T00:30:02+00:00 ERR (3): Warning: include(Mage/CompanyName/AutomatedImport/Model/Observer.php): failed to open stream: No such file or directory  in /chroot/home/shop/shop.companyname.com/html/lib/Varien/Autoload.php on line 93
2015-02-25T00:30:02+00:00 ERR (3): Warning: include(): Failed opening 'Mage/CompanyName/AutomatedImport/Model/Observer.php' for inclusion (include_path='/chroot/home/shop/shop.companyname.com/html/app/code/local:/chroot/home/shop/shop.companyname.com/html/app/code/community:/chroot/home/shop/shop.companyname.com/html/app/code/core:/chroot/home/shop/shop.companyname.com/html/lib:.:/usr/share/pear:/usr/share/php')  in /chroot/home/shop/shop.companyname.com/html/lib/Varien/Autoload.php on line 93

The problem is, my modules are located exactly where they are supposed to be in app/code/local/CompanyName/AutomatedImport, and not under Mage/. I've got another Magento install for a different shop that uses almost the exact same modules (they maybe vary by 5 lines of non-important code) and that one works fine.

Has anyone run into this before? I have a feeling it's some stupid capitalization issue somewhere in my module/etc/config.xml or in app/etc/modules/CompanyName_AutomatedImport.xml but I can't for the life of me find anything that tells me that what I have is in any way wrong. I've been attempting to do due diligence on this for the past week and a half, but I just don't know enough about Magento. All of the SO fixes I've seen involve either problems in the xml that I don't have, or moving modules/Magento installs into different directories/servers, which I haven't done.

Any help would be most appreciated, as I am way past stumped.

Module config.xml

app/etc/modules xml file

Things attempted:

  • Turning on/off caching
  • Clearing the cache(s)
  • Turning on compilation mode, and turning it back off
  • Checking the permissions on my module
  • Did you clear configuration cache? – Fabian Schmengler Mar 4 '15 at 22:58
  • I have. I've turned off/on caching, cleared the cache(s), and turned on/off compilation mode. That's a good point, I should mention those things in the post. – Addama Mar 4 '15 at 23:00
  • Next thing that comes to mind is a file permission problem. The error happens if Magento can't find the observer class, finally falls back to the Mage namespace, which results in these messages – Fabian Schmengler Mar 4 '15 at 23:02
  • The directories are 775 all the way up past my namespace, and both my user and the user that Magento uses are in the same group. – Addama Mar 4 '15 at 23:06
  • My worry is that my XML has some capitalization error, or a place where I was supposed to put the namespace but didn't, or visa versa. – Addama Mar 4 '15 at 23:12
2

In your config.xml you have the line:

<model>CompanyName_AutomatedImport/Observer::automatedImportProcess</model>

The first part of this expression should be either the class name

CompanyName_AutomatedImport_Model_Observer

or the alias that you defined in <models>

companyname_automatedumport/observer
  • Unfortunately, my situation is unchanged :( I changed it to <model>companyname_automatedimport/observer::automatedImportProcess</model>, and the result is the same – Addama Mar 4 '15 at 23:39
  • JTry with the class name instead. If it works then, it's a configuration problem, if not, a problem with the file/class – Fabian Schmengler Mar 5 '15 at 7:44
1

Did you change server (PHP version, OS, etc.) when you inherited? This is mostly likely due to the non-leading upper-cased letter in AutomatedImport. There's some case sensitivity issues across platforms and/or PHP versions (not entirely sure exactly which causes it). It may need to be Automatedimport.

I always only capitalize the first letter of directories and files for this reason when developing Magento extensions. Basically, your companyname_automatedimport and CompanyName_AutomatedImport are not matching up for Magento.

  • The server/PHP version is the same as when it was first installed, thankfully. Those capitalization issues - is that just in the config files, or should I be concerned that my namespace directory is "CompanyName" as well? – Addama Mar 5 '15 at 17:40
  • Hm probably.. Different OS then? I know on my local OS X instances, capitalization is not an issue. It had often caused issues on production environments running Linux or something similar. I just avoid middle capitalization now. Can you try making a dummy extension with both cases of capitalization, and try instantiating your observer with Mage::getModel()? This will certainly tell you if it's a case issue. – musicliftsme Mar 5 '15 at 18:09

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.