Additional Information on the Order Page
I need to display additional customer information regarding the order when viewed by an admin.
I need to show the date of the order and the customer's email address(among other things).
How would I go about modifying the order page for admins?
Comments
The orders page is a view, you can edit it
You can change the orders page view in any way you want just by editing it. That's the easiest way. If you add fields to the order, they will also show up on the order page.
Also note that the user's email and order history are in fact on the edit page, if that helps you.
Cant find the view
Hi,
Is this view a commerce 1.1 thingy ? Cant seem to find it on my commerce 1.0 installation
/Anders
Orders page has always been a view
The orders page (the list of orders at admin/commerce/orders) has always been a view. You can also override it with the view provided by [Commerce VBO Views](http://drupal.org/project/commerce_vbo_views)
Hi, It´s not the list, but
Hi,
It´s not the list, but the page at admin/commerce/orders/XXXX/
Whats the easiest way to add further info to that site ?
/Anders
This is something I'm trying
This is something I'm trying to do as well. Is there a ready way to do this?
Thanks Randy, I knew I could
Thanks Randy, I knew I could edit the view but I was going crazy because every time I added a relationship of: Commerce Line Item: Order ID or Commerce Order: Owner it would break the order for the user who placed the order. It would just not show any of the line items.
I was able to work around this by adding and attachment to the default display and overriding the relationships and fields. I added Commerce Line Item: Order ID and Commerce Order: Owner and was able to get the email address and order date from there. I also added a relationship to the order:billing info and got the extra phone number field I added.
I attached the export of the view if anyone wants to take a look.
Also, remember in the views settings, you can 'Always show advanced display settings' to make sure none of the fields or relationships snuck into the default display.
Oh, and for the attachment, I have it restricted to admin and store admin roles, which you may not have. This hides the extra customer info from the customer's view of the order page.
Clarification
Would have liked a bit more clarification on what you did here. I'm trying to do the same thing but I have no idea where you added this Commerce Order: Owner attachment at. :-(
This can be done with the entity_view hook
Here's an example which adds the users email and the order status to the top of the view order page:
<?php
/**
* Implements hook_entity_view_alter().
*/
function YOURMODULE_entity_view_alter(&$build, $type) {
switch ($type) {
case 'commerce_order':
if ($build['#view_mode'] === 'administrator') {
$order = $build['#entity'];
$build['status'] = array(
'#type' => 'fieldset',
'#title' => t('Order details'),
'#weight' => -100,
);
$build['status']['markup'] = array(
'#prefix' => '<dl>',
'#suffix' => '</dl>',
array('#markup' => sprintf('<dt>%s</dt><dd>%s<dd>', t('Status'), $order->status)),
array('#markup' => sprintf('<dt>%s</dt><dd>%s<dd>', t('E-mail'), $order->mail)),
);
}
break;
}
}
?>
Hi, this worked great. I made
Hi, this worked great. I made a custom module of it!
Greetings, Martijn
Works great! Thank you for
Works great! Thank you for the helpful example.
Works great, Thanks!
Works great, Thanks!
Additional question, how to print this like div instead of fieldset. Fieldset looks not nice..