Im trying to send email notifications to customer in magento for custom events.
ie) Whenever the admin changes the status of a custom article, from Approve to Disapprove, there should be an email trigger to the customer.
I could get an email for order canceled event, i need to achieve for the above scenario.
I have tried below:
app\code\local\Magenshop\Recipe\etc\config.xml
<?xml version="1.0"?>
<config>
<modules>
<Magenshop_Recipe>
<version>1.0.0</version>
</Magenshop_Recipe>
</modules>
<global>
<events>
<recipe_admin_approve>
<observers>
<recipe>
<type>singleton</type>
<class>recipe/status</class>
<method>statusChangedApproved</method>
</recipe>
</observers>
</recipe_admin_approve>
</events>
</global>
So now when admin changes the status here, i should get a notification
\app\code\local\Magenshop\Recipe\Model\Status.php
<?php
class Magenshop_Recipe_Model_Status extends Varien_Object
{
const STATUS_ENABLED = 1;
const STATUS_DISABLED = 0;
const STATUS_REQUESTORM = 3;
static public function getOptionArray()
{
return array(
self::STATUS_ENABLED => Mage::helper('recipe')->__('Approved'),
self::STATUS_DISABLED => Mage::helper('recipe')->__('UnApproved'),
//self::STATUS_REQUESTORM => Mage::helper('recipe')->__('Remove')
);
}
static public function toOptionArray()
{
return array(
self::STATUS_ENABLED => Mage::helper('recipe')->__('Approved'),
self::STATUS_DISABLED => Mage::helper('recipe')->__('UnApproved'),
//self::STATUS_REQUESTORM => Mage::helper('recipe')->__('Remove')
);
}
//custom notification methods
public function statusChangedApproved()
{
echo 'status changed';die;
}
}
?>