count orders for each product

Is there a way to calculate the number of orders for a specific product and display it and if so is it possible to integrate it with the devel module for testing. thanks

Posted: Dec 10, 2011


k0nqu3r0r on March 18, 2013

Hi guys! I've spent a lot of time issuing that topic.

What I've found suitable for me.

There's a statistics module - http://drupal.org/project/commerce_reports.

It creates several views for reporting. Basically, you can use product count as basic view of Product reports view. It's called Chart (by Quantity Sold). You can clone it and show as block with your own modifications.

I had to attach my products to product display and show overall count of all products sold, that are connected to my Product Display.

This required me to create field Commerce Line Item: Quantity with enabled Aggregation (settings - Sum).

Also I created Relation Commerce Product: Node referencing products from field_product (selected Commerce Line item: Product in the relationship select).

Then I created Content: Nid Contextual filter and chose Node referencing products from field_product for Relationship and selected Provide default value -> Content ID from URL for argument.

That's all. Should work for you.