At now on order view page there are no information about order state (Pending, Checkout, etc) and info about order owner (user). Will be good to see this fields as separate items in Order display configuration. Is it possible?

Comments

murz’s picture

Title: Show order state and user info in order page » Show order state and user info in order view page

Order page is admin/commerce/orders/N

rszrama’s picture

This would be useful on the customer view of the order as well at user/###/orders/###.

rszrama’s picture

Title: Show order state and user info in order view page » Add order status and user info as extra fields to Orders

Updating the title.

twardnw’s picture

Any forward motion on this? I agree this would be greatly useful on the customer's view of their orders.

lukasss’s picture

Issue summary: View changes

it will be very useful!

lukasss’s picture

will also be useful information about the payment!

nightlife2008’s picture

Hey guys,

I added the Account info in a custom module:


function MODULE_entity_view_alter(&$build, $type) {
  if ($type == 'commerce_order') {
    MODULE_build_order_content($build);
  }
}

function MODULE_build_order_content(&$build) {
  if ('administrator' == $build['#view_mode']) {
    // Load the orders' owner account object.
    $customer = user_load($build['#entity']->uid);
    // Add all user account display fields to our order build array.
    $build += field_attach_view('user', $customer, 'account', $build['#language']);

    // Create Account UID link field.
    $markup  = '<div class="field-label">' . t('Customer ID') . ':&nbsp;</div>';
    $markup .= '<div class="field-items">' . l($customer->uid, 'user/' . $customer->uid, array('attributes' => array('_target' => 'blank'))) . '</div>';
    $build['customer_uid'] = array(
      '#markup' => '<div class="field field-name-commerce-customer-uid field-label-above">' . $markup . '</div>',
    );
    // Create Account Username field.
    $markup  = '<div class="field-label">' . t('Customer username') . ':&nbsp;</div>';
    $markup .= '<div class="field-items">' . $customer->name. '</div>';
    $build['customer_name'] = array(
      '#markup' => '<div class="field field-name-commerce-customer-username field-label-above">' . $markup . '</div>',
    );
    // Create Account Mail field.
    $markup  = '<div class="field-label">' . t('Customer mail') . ':&nbsp;</div>';
    $markup .= '<div class="field-items">' . $customer->mail. '</div>';
    $build['customer_mail'] = array(
      '#markup' => '<div class="field field-name-commerce-customer-mail field-label-above">' . $markup . '</div>',
    );
  }
}

/**
 * Implements hook_field_extra_fields().
 */
function MODULE_field_extra_fields() {
  $extra = array();

  // Add all user fields as display fields to the commerce order displays.
  $user_field_instances = field_info_instances('user', 'user');
  if (!empty($user_field_instances)) {
    foreach($user_field_instances as $field => $properties) {
      $new_field = array(
        'label' => t('Customer: @label', array('@label' => $properties['label'])),
        'description' => $properties['description'],
        'entity' => 'user',
        'weight' => 0
      );

      $extra['commerce_order']['commerce_order']['display'][$field] = $new_field;
    }

    $customer_uid_field = array(
      'label' => t('Customer: ID'),
      'description' => t("Display the customer's account uid."),
      'weight' => -10,
    );

    $customer_name_field = array(
      'label' => t('Customer: username'),
      'description' => t("Display the customer's account username."),
      'weight' => -10,
    );

    $customer_mail_field = array(
      'label' => t('Customer: mail address'),
      'description' => t("Display the customer's account mail."),
      'weight' => -10,
    );

    $extra['commerce_order']['commerce_order']['display']['customer_uid'] = $customer_uid_field;
    $extra['commerce_order']['commerce_order']['display']['customer_name'] = $customer_name_field;
    $extra['commerce_order']['commerce_order']['display']['customer_mail'] = $customer_mail_field;
  }

  return $extra;
}

This would add ALL user fields to the order display. This allows you to group things in fieldsets (field_group module?)

Check the screenshots of the admin view of an order, and the orders' manage display screen.

Hopefully this can point you in the right direction. I'm using a Stanley admin theme based Subtheme and added some custom CSS for columns etc.

You can also use the Commerce_Backoffice Orders submodule to provide a status form on the Order view pages.

Greets,
Kim