Developer forum

Forum » Development » Order Modified notifier

Order Modified notifier

Gonçalo Assunção
Reply

Hello all,

I'm working with the Live Integration project, and when a checkout process is finished, the order is sent to the ERP.  But, in this project, the order confirmation page has a small form, which the fields are order custom fields. For example a field called "choose an offer". If the user fills that form, which would update one of those custom fields, I would like to sent an update of that order to the ERP.

I was wondering if there's an event that is triggered if there's any change in the order. I was trying to use the 'before' or 'after' order is saved, and use a condition that if the order is 'completed', then update the order to the ERP.


The issue here is that in the checkout process, after the order is completed, the order is saved at least once. With this I would sent the order after finished, and update it to the ERP right after. We don't want that to happen. We want to send it after finished, and only update it if one of those custom fields is changed.

I even tried to make a combination of the following conditions:
if(order.Complete && order.Modified > order.CompletedDate)


But this is also triggered by that last save in the checkout process.

I also tried (in the before save notifier), when I send that form, to compare the custom order fields from the order in the notifier args, to the same order in the db, but still I had no success with this.

 

Is there any other way to do this?

 

Thank you in advance

Kind Regards
'Gonzalo'


Replies

 
Nicolai Høeg Pedersen
Reply

Hi Gonçalo

I think you are on the right track - you should use the Notifications.eCommerce.Order.AfterSave notification. If the order has the custom field set, send it to ERP. That should be relatively simple. You can also do your order.Modified check but add a second or 2.

BR Nicolai

 

You must be logged in to post in the forum