Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I am trying to create a very simple orders report and the Views calc sum doesn't work on the order totals. Count works fine but sum doesn't. I have included the view that I have created. It just has 2 fields for display. Any assistance would be greatly appreciated.
Comment | File | Size | Author |
---|---|---|---|
orders_with_total.view_.txt | 10.19 KB | sher1 |
Comments
Comment #1
scarr CreditAttribution: scarr commentedI am also having this issue - I'd love to have this sum correctly - let me know if I can help!
Comment #2
scarr CreditAttribution: scarr commentedComment #3
zealny CreditAttribution: zealny commentedHello sher1 and scarr,
I found the way to get sum of order total filed.
First add the filed to views calc
go to admin/structure/views_calc
Base table : Commerce Order
Label : vc Order total (give some name)
Calculation : %field_data_commerce_order_total.commerce_order_total_amount / 100
Format : decimal (2)
Custom function : (I do not know use of this option)
[Save]
Then go to your view and edit it.
Add field : vc Order total
Go to Settings for 'Views Calc Table' and select 'Display calculation' for field 'vc Order total'
You will see sum total for order total field.
Hope this helps you.
Comment #4
Rosamunda CreditAttribution: Rosamunda commentedI've followed the instructions but I do get this error:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'field_data_commerce_order_total.commerce_order_total_amount' in 'field list'
Comment #5
roball CreditAttribution: roball commented#3, thanks - works for me. However, there is always a "Page SUM" row which displays "0.00".
Comment #6
themic8 CreditAttribution: themic8 commented#3 also worked for me. I also get a "Page SUM" row which displays "0.00".