Get all the order statuses by an order id.

Public

Get raw version
php
  1. /**
  2.  * Helper function to get all the (previous) statuses for a commerce order.
  3.  *
  4.  * @param int $order_id
  5.  * The commerce order id.
  6.  *
  7.  * @return array
  8.  * All the statuses that a order have had, including the current one.
  9.  */
  10. function _get_all_previous_order_statuses($order_id) {
  11. $order_statuses = db_select('commerce_order_revision', 'revision')
  12. ->distinct()
  13. ->fields('revision', array('status'))
  14. ->condition('order_id', $order_id)
  15. ->execute()
  16. ->fetchCol();
  17. return $order_statuses;
  18. }