Search code examples
magentomagento-1.5

Magento - Custom event module - Class not found error in system.log


I am trying to create a custom module which will capture order information each time a sales happens and will send that to a STOMP server. The idea is to create a realtime dashboard of sales events.

I've created the generic structure of the module and Magento is able to recognize it properly, but the code is not being executed. I've traced it down to the fact that Varien_Autoload cannot find my class.

My config is as follows:

app/etc/modules/PrettySecrets_SalesEvent.xml

<?xml version="1.0"?>
<config>
    <modules>
        <PrettySecrets_SalesEvent>
            <active>true</active>
            <codePool>local</codePool>
        </PrettySecrets_SalesEvent>
    </modules>
</config>

app/code/local/PrettySecrets/SalesEvent/etc/config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <PrettySecrets_SalesEvent>
            <version>0.0.1</version>
        </PrettySecrets_SalesEvent>
    </modules>
    <global>
        <models>
            <prettysecrets_salesevent>
                <class>PrettySecrets_SalesEvent_Model</class>
            </prettysecrets_salesevent>
        </models>
        <events>
            <checkout_onepage_controller_success_action>
                <observers>
                    <prettysecrets_salesevent>
                        <type>singleton</type>
                        <class>prettysecrets_salesevent/observer</class>
                        <method>doStreamToNode</method>
                    </prettysecrets_salesevent>
                </observers>
            </checkout_onepage_controller_success_action>
        </events>
    </global>
</config>

I'm given to believe that the directory structure is extremely important for Magento:

app
 code
  local
   PrettySecrets
    SalesEvent
     etc
      config.xml
     Model
      Observer.php

The system.log shows:

Warning: include(PrettySecrets_SalesEvent_Model_Observer.php): failed to open stream: No such file or directory in /chroot/home/.../includes/src/Varien_Autoload.php on line 93

I've also verified that app/code/local is in my path. Also, I've debugged it down into App.php with Mage::log inserts.

Any help would be much appreciated as I am literally tearing my hair out.

Thanks


Solution

  • Dude you have the Magento compiler enabled, disable this from system > tools > compilation as compilation copies your files to include/src/ folder and all your changes are left unseen by magento after that (before you recompile at least)