1

I need to display number of sales for a product or a product variation in product list. But I cannot find a decent way to go. Can I count order numbers for a product or a product variation with their relation? How should I do? I looked this thread Drupal Commerce: Number of a sales per product, what he want is a view, but I need to display number of sales in product list. I appreciate for any help or comments.

0

Look at https://drupal.org/project/commerce_reports and edit your product list View to do what it does in its product sales report.

|improve this answer|||||
  • Thanks for your answer, but what I want is to dislay sales volume in product list to customers, so they can make a decision(buy or not). – Jack Zhou Dec 3 '14 at 10:02
  • You'd still use the same approach. Commerce Reports is built using Views - your product list will be built using Views. Voila! – Ryan Szrama Dec 3 '14 at 14:15
  • Thanks for your time, Ryan. I installed and enabled the commerce_reports, but EntityFieldQueryException raised: "EntityFieldQueryException: Unknown field: commerce_stock in EntityFieldQuery->addFieldCondition() (line 779 of D:\xampp\htdocs\commerce\includes\entity.inc).", my module versions: commerce_kickstart-7.x-2.19, commerce_reports-7.x-4.0-beta1.tar.gz, views_date_format_sql-7.x-3.1.tar.gz, charts-7.x-2.0-rc1.tar.gz, commerce_stock-7.x-2.0.tar.gz. but I guess I only need to study the code of Commerce reports, right? – Jack Zhou Dec 10 '14 at 22:33
0

I got it, We can use hook_entity_view. and we can read profiles\commerce_kickstart\modules\contrib\commerce\modules\product_reference\commerce_product_reference.module for reference.

|improve this answer|||||

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.