I was asked to export product and order data on a monthly basis, broken down by location, into .csv format, and I've run into an unusual hiccup. Say a branch orders 6 units of staples. I can easily show the per-unit cost for the staples, but there's no easy way to display the total cost spent in that order for all of the staples.

Is this data best generated here? Or finagled in some way as a computed field in CCK? Or is there another way?

Comments

madsph’s picture

I am not sure but I think this module might help you:

http://drupal.org/project/views_calc

domesticat’s picture

Status: Active » Closed (fixed)

You are absolutely right. I forgot that views_calc let you build fields based on mathematical functions performed on other fields. If anyone else comes looking for this feature, you want to go to admin/settings/views_calc and set up the new field to be

(%uc_order_products.price * %uc_order_products.qty)

with a format of "decimal (2)"

Thanks! Marking closed.

CraigBertrand’s picture

Hey guys, sorry to resurrect an old post however views calc is not really working out in my case. I am getting some weird results when using the provided relationships as well as when I try to use uc_order_node relationship.

When I use the ones provided and do a view of "ordered products" create a views calc field like mentioned above. the math looks good on the line item however when using views calc to total sum that field the sum doesn't add up.

When using uc_order_node the calc field doesn't even work just get 0.00. (And I did add the relationship for the field)

Anyhow it would seem to me that it would be use full to just have a field provided to provide a "Ubercart order product: Line Total" field.

Let me know what you think.