Author Topic: Update order status in plgVmOnUpdateOrderPayment  (Read 475 times)

sandomatyas

  • Jr. Member
  • **
  • Posts: 283
Update order status in plgVmOnUpdateOrderPayment
« on: November 15, 2018, 16:47:17 pm »
Here is a scenario:
The shop admin changes the status of an order
A plgVmOnUpdateOrderPayment method in a vmcustom plugin checks the new status anf if it's C, it should send the order data to an external API and if it returns with success, change the status to a new one (F) with a comment, which contains the data I got from the API.
As far as I can see there are 2 options.
  • I manage to set the new status in the plugin with updateStatusForOneOrder, which stores the new status, customer_notified and comments, but VirtueMartModelOrders triggers this method before it stores the status which the shop admin set, so I get  C (by shop admin) -> F (by vmcustom plugin) -> C (by VirtueMartModelOrders )
  • I change $data->order_status to F but in this case I can't set the comment field
There is only one trigger AFTER the order is stored, which is vmcupon's plgVmCouponUpdateOrderStatus
Any idea how should I manage this?
Maybe a plgVmAfterUpdateOrder trigger could help with this.

sandomatyas

  • Jr. Member
  • **
  • Posts: 283
Re: Update order status in plgVmOnUpdateOrderPayment
« Reply #1 on: November 21, 2018, 10:11:37 am »
any guess maybe?