I can't seem to figure out how to get my observer fire.
Everywhere I look the examples on how to implement one differ ever so slightly in where capitals go and simple things like that. So here's my code, please point out what I'm doing wrong!
app/etc/modules/Mynamespace_Mymodule.xml
<?xml version="1.0"?>
<config>
<modules>
<Mynamespace_Mymodule>
<codePool>local</codePool>
<active>true</active>
</Mynamespace_Mymodule>
</modules>
</config>
app/code/local/Mynamespace/Mymodule/etc/config.xml
<?xml version="1.0"?>
<config>
<modules>
<Mynamespace_Mymodule>
<version>1.0.0</version>
</Mynamespace_Mymodule>
</modules>
<global>
<models>
<mynamespacemymodule>
<class>Mynamespace_Mymodule_Model</class>
</mynamespacemymodule>
</models>
<events>
<checkout_type_onepage_save_order_after>
<observers>
<mynamespace_mymodule>
<type>singleton</type>
<class>mynamespace_mymodule/Observer</class>
<method>on_order_changed</method>
</mynamespace_mymodule>
</observers>
</checkout_type_onepage_save_order_after>
</events>
</global>
</config>
app/code/local/Mynamespace/Mymodule/Model/Observer.php
<?php
class Mynamespace_Mymodule_Model_Observer extends Varien_Event_Observer
{
public function __construct() {
}
public function on_order_changed($observer) {
try {
$mail = Mage::getModel('core/email');
$mail->setToName('Your Name');
$mail->setToEmail('[email protected]');
$mail->setBody('Mail Text / Mail Content');
$mail->setSubject('Mail Subject');
$mail->setFromEmail('[email protected]');
$mail->setFromName("Msg to Show on Subject");
$mail->setType('html');
$mail->send();
} catch (Exception $e) {
Mage::logException($e);
}
}
}
?>