You are here

function mailchimp_ecommerce_get_mc_order_statuses in Mailchimp E-Commerce 7

Helper function to get Mailchimp order status.

@url http://developer.mailchimp.com/documentation/mailchimp/guides/getting-st...

1 call to mailchimp_ecommerce_get_mc_order_statuses()
_mailchimp_ecommerce_commerce_build_order in modules/mailchimp_ecommerce_commerce/mailchimp_ecommerce_commerce.module
Builds a Mailchimp order from a Commerce order.

File

./mailchimp_ecommerce.module, line 1397
Mailchimp eCommerce core functionality.

Code

function mailchimp_ecommerce_get_mc_order_statuses($order_status) {
  $mc_order_statuses = array(
    'financial_status' => '',
    'fulfillment_status' => '',
  );
  $order_statuses = mailchimp_ecommerce_get_order_statuses();

  // Skip if empty.
  if (empty($order_statuses)) {
    return $mc_order_statuses;
  }
  foreach ($order_statuses as $key => $title) {

    // Skip if not a match.
    if ($key != $order_status) {
      continue;
    }
    $order_notification_key_value = variable_get('mailchimp_ecommerce_order_notifications_' . $key, '');

    // Skip if none.
    if (empty($order_notification_key_value)) {
      continue;
    }
    $order_notification_key_value = explode('__', $order_notification_key_value);
    $order_notification_key = $order_notification_key_value[0];
    $order_notification_value = $order_notification_key_value[1];
    $mc_order_statuses[$order_notification_key] = $order_notification_value;
  }
  return $mc_order_statuses;
}