Closed duncanmcclean closed 8 months ago
While creating this PR, I've realised that an order is probably never going to hit the same status twice so this new format isn't really needed.
I'm going to close this PR for now and I can re-open in the future if it's needed.
Nevermind... found some other reasons we probably want this format:
Released as part of v5.7.0.
This pull request makes some improvements to the Status Log that keeps track of status changes on orders.
Changes to the format
Currently, an order's status log is stored like this:
This is fine. However, it comes with one main downside: there's no way of storing status-related metadata, like who updated an order's status or why.
This PR fixes that by changing the format the status log is saved in. Here's how the
status_log
is saved after this change:In order to avoid introducing breaking changes, Simple Commerce will continue to read the old format, then whenever status changes happen, the status log will be saved in its new format.
Changes to the "Update Order Status" action
This PR adds a new "Reason" field to the "Update Order Status" action. This is an optional text field where additional context can be provided about a status change, which will be visible in the order's status log (which is coming soon! 👀 ).
API Changes
If you were using the PHP API for getting status log information, you'll notice a few things have changed:
->statusLog()
method will now return a collection ofStatusLogEvent
objects, instead of an array as was returned previously.$key
to thestatusLog
method to get the relevant timestamp (->statusLog('paid')
). This parameter will be removed in v6.->get('status_log')
, you'll need to change your code to handle both the old & new formats.To Do
StatusLogEvent
DTOstatusLog
method.