If you want an order field in your view, representing the total price of the order?
Do the following:
Extract the attachment into the same folder as commerce_order_handler_field_order_type.inc
Complement commerce_order.views.inc with
// Expose the order total price.
$data['commerce_order']['order_total'] = array(
'field' => array(
'title' => t('Order total price'),
'help' => t('The sum of all line items totals.'),
'handler' => 'commerce_order_handler_field_order_total',
),
);
And commerce_order.info with
files[] = includes/views/handlers/commerce_order_handler_field_order_total.inc
Comments
Comment #1
rszrama commentedDamien and I discussed this last week as well, and it seems likely that we'll end up with an actual Price field on the order that is recalculated when necessary to contain the latest order total. I need to revisit our notes to discuss currency issues...
Comment #2
pieterdcThe actual order price field (views integration) wouldn't have the option to sum only the items of a certain line item type (which I have - and use - now), I guess ?
But it would be better in lots of other use cases, I know.
Comment #3
rszrama commentedAhh, yeah, it would be nice to maintain a way to subtotal things. Damien and I discussed that, working it into the line item summary area handler somehow... the biggest hangup as usual is multi-currency orders (i.e. how to represent sums in different currencies or combine them into one).
I guess we'll need to maintain some version of this pseudo-field along with a Field API type field on the order.
Comment #4
alexpua commentedAbout different currencies, in store setting owner has to choice base currency for example usd or national..., all orders must be calculate to the base currency and save with exchange rate for that date
In one order customer can not add goods with different currencies.
Comment #5
alexpua commentedCan anybody explain what happen
I try to add Order total views field
and receive next message:
look attach
After I deleted all the changes - message remained
I rewrite modules Commerce and Views and - message remained
Comment #6
alexpua commentedI do not what happen before, I re-install all and add changes "total" before switch on modules
last message disappear but we have new one
look attach
Comment #7
rszrama commentedI've actually just added an order total field to orders, so that's covered. I think what this patch likely represents is more of a "line item total" field, so I'm changing the title accordingly.
Here's the commit for the new order total field:
https://github.com/rszrama/drupalcommerce/commit/75dbcce26ac4995f340bfc2...
Comment #8
bojanz commentedDo we want to do anything else here? Seems done.
Comment #9
jsacksick commented