I need to send email with PDF attachment when the order payment is done or when the order status is changed to complete..however i can't find any event related to completion of order ...mails are being sent for order placing or shipment etc but not on order complete...Any help will be appreciated.

1 Answer 1


Use the observer "sales_order_save_commit_after" or "sales_order_invoice_pay" then you can get the order status and depending on the status you do what you want. Here is an example:

// for event sales_order_save_commit_after
public function sendpdf($observer)
    $order = $observer->getOrder();
    if($order->getState() == Mage_Sales_Model_Order::STATE_COMPLETE){
    // do your order complete stuff


// Event sales_order_invoice_pay
public function sendpdf ($observer)
    $invoice = $observer->getEvent()->getInvoice();
    switch ($invoice->getState()) {
        case Mage_Sales_Model_Order_Invoice::STATE_PAID :
            //do your stuff
    return $this;

You will have to check that you don't do the calculation twice, because this method is triggered each time an order is saved. reference

  • On sales_order_invoice_pay, I want to change order state back to 'new', but it goes new then processing. Any ideas? Commented Sep 29, 2017 at 10:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.