Working on a project where there is a need to be able to take data provided in the form of an xml file, from an AS400 mainframe, which updates information relating to certain orders placed in Expresso.
Notably, a status change from 'approved' to 'shipping'. Naturally, when this occurs the customer should be notified via email along with a provided shipping number.
The issue at hand is how to trigger an email within Expresso when a simple database change on a field is made. If one goes through the application itself, via the GUI, and changes a status then an email is sent. However, the staff want no part in manually changing order statuses on the EE end of things. They'd rather only have to focus on the AS400.
So there has to be logic in place to accomplish this.
The Expresso team was helpful and pointed me in the right direction, however I was hoping for some additional clarity from you guys and perhaps recommendations or code examples.
Anything that triggers our
updateStatus
method in Order.php will trigger any emails and actions associated with the change of order status. So if you have emails setup to be sent for each status then these will be triggered.If you're changing the status outside of the Store application however and not going through our updateStatus method then you'll need to latch on to our Order Status hooks (https://exp-resso.com/docs/extension_hooks.html#order_status_hooks). You can use the
store_order_update_status_end
to fire off an email or anything else you need to perform once the status has been changed.
This is my first time diving this deep into EE or Expresso. I've done some exciting things so far in this project, but this one has been the most indepth thus far.