Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the earliest possible observer to hook into after payment in Magento?

Tags:

magento

I'm looking to add some data generated after payment (API key) that I can then add into the email that goes out confirming the order. So far every event I've tried happens either too soon (before payment) or too late (the email is gone already).

What I could really use is not just a list of events, but the order in which they trigger.. I've tried several, including sales_order_payment_pay, sales_order_place_before, checkout_onepage_controller_success_action and so on..

like image 713
Rob Porter Avatar asked Jan 18 '26 01:01

Rob Porter


1 Answers

Add some temporary debugging code to app/Mage.php

File: app/Mage.php    
public static function dispatchEvent($name, array $data = array())
{       
    Mage::Log('Event: ' . $name);
    //use below line of calling Mage::Log doesn't work (happens in rare cases)
    //file_put_contents('/tmp/events.log',"$name\n",FILE_APPEND);
    Varien_Profiler::start('DISPATCH EVENT:'.$name);
    $result = self::app()->dispatchEvent($name, $data);
    #$result = self::registry('events')->dispatch($name, $data);
    Varien_Profiler::stop('DISPATCH EVENT:'.$name);
    return $result;
}
like image 70
Alan Storm Avatar answered Jan 19 '26 20:01

Alan Storm



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!