0

In my Commerce Order settings I have created a custom select list field with the following Allowed values.

Allowed values list

1|01/03/2013

2|02/03/2013

3|03/03/2013

4|04/03/2013

5|05/03/2013

Currently I can choose a date from a select list and that filters all sold products and gives me the result for that date. I am able to separately filter all products sold for each date using views but is there a way I can list the results of each date separately in a block?

Is this possible or do I have to add the field for each date and set the operator Is equal to the date for each date in my select list?

I would like the output to be something like this.

Event Date Sales

01/03/2013 Total: 210

02/03/2013 Total: 150

03/03/2013 Total: 621

04/03/2013 Total: 500

05/03/2013 Total: 142

0

You need to do some advanced Views building to make this happen, so if you've never used Views aggregation (formerly I think it was called "group by"), then I'd recommend looking into video tutorials on the topic.

Basically, if you start with a View of Orders and turn on aggregation (under advanced settings), then you can add two fields to the View:

  1. Your custom date select field using "Group results together" as the aggregation type.
  2. The Order ID using "Count" as the aggregation type.

Fiddle with it from there to get it to look like you want, probably using an unsorted list display format with the fields set the show up on the same line.

Here's a quick working export of a View that groups orders by user and shows the number of orders per each user (courtesy of joshmiller): http://pastebin.com/j7NTrkp9

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.