I am having some problems with a module i wrote. I have created observer that upload XML and send notification for admin.
I have testet with 2 events: <sales_order_place_after>
and <sales_order_save_after>
.
The problem is that i offer 2 types of payment option (bank transfer and creditcard). One change state immediately to [New]
(banktransfer) and other is payment by credit card which goes to state [Processing]
before payment is captured and then after payment has been captured [New]
.
This gives me problem as because i only want to upload XML once for every order and <sales_order_save_after>
trigger event for every order update and <sales_order_place_after>
only gets triggered once and and not when payment have been captured.
I think solution would be to use same event as Magento use to send out order confirmation mail. Which event is that?
This is my observer that does not work correct.
public function salesOrderSaveAfter($observer)
{
....
if ($orderStatus == 'pending' || $orderStatus == 'bank_transfer' ) {
Any suggestions to solve this problem?