You are here

function commerce_email_customer_profile in Commerce Email 7

Get the customers profile from the order using the billing or shipping address

Parameters

$order: The order object

Return value

$customer_profile Customer profile object

1 call to commerce_email_customer_profile()
commerce_email_order_email_send in ./commerce_email.rules.inc
Rules action: Send the users order as an HTML email

File

./commerce_email.module, line 552
Defines additional menu item and order html email functonality.

Code

function commerce_email_customer_profile($order) {
  if (!empty($order->commerce_customer_billing) && isset($order->commerce_customer_billing[LANGUAGE_NONE][0]['profile_id']) && is_numeric($order->commerce_customer_billing[LANGUAGE_NONE][0]['profile_id'])) {
    $customer_profile = commerce_customer_profile_load($order->commerce_customer_billing[LANGUAGE_NONE][0]['profile_id']);
    return $customer_profile;
  }
  elseif (!empty($order->commerce_customer_shipping) && isset($order->commerce_customer_shipping[LANGUAGE_NONE][0]['profile_id']) && is_numeric($order->commerce_customer_shipping[LANGUAGE_NONE][0]['profile_id'])) {
    $customer_profile = commerce_customer_profile_load($order->commerce_customer_shipping[LANGUAGE_NONE][0]['profile_id']);
    return $customer_profile;
  }
}