I'd like to sort a view of Commerce product displays by their popularity (not too bothered by the specifics of how this is calculated). I found a comment by Ryan Szrama that implies it could be possible with vanilla Views:

The gist of it is going to require a View of Orders joined to Line Items via the "Commerce Line Items relationship" joined to the Products via the "Referenced product" relationship. You can filter by Order State to only see purchased products and then count the occurrence of each Product ID to get the most referenced products. The hardest part will be establishing a relationship from the Product ID to the product display, but I believe you can use the reverse relationship from the product ID to a node referencing it so long as you only have a single product display per product.

Unfortunately even if my Views-fu was good enough to do that, I'd like for this to be just one possible sort (ie you can sort by price, title, or popularity) so I'd like to avoid using a View of orders. Is there an existing Views sort handler for this floating around at all, or perhaps another clever way to achieve it?

1 Answer 1


Commerce Product Popularity provides a Radioactivity field for popularity.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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