An observer-class solution is the way to go.
You'll use the basic observer elements:
Code:
class my_class extends base
{
public __construct ()
{
$this->attach ('NOTIFY_ORDER_EMAIL_BEFORE_PRODUCTS');
}
public update (&$class, $event, $roParm1, &$rwParm2, &$rwParm3, &$rwParm4) // Up to &$rwParm9, depending on the notifier
{
<insert your processing here>
}
}
For the notifier you're interested in, when your update function receives control:
$class ....... contains a reference to the $order object, so you've got full R/W access to the order's elements
$event ...... contains 'NOTIFY_ORDER_EMAIL_BEFORE_PRODUCTS', in case your observer handles multiple events
$roParm1 ... contains an empty array
$rwParm2 ... contains a reference to the order-class' $email_order variable
$rwParm3 ... contains a reference to the order-class' $html_msg variable
That said, upon receipt of that "notification" you have r/w access to the entire $order object (some information might not be all there, depending on the point at which the notification was raised) and to $rwParm2 and $rwParm3 (up to $rwParm9). Making a change to $rwParm2 results in a change to $email_order, for example.
Bookmarks