Tags/topics: 
1
Answers
Vote up!
0
Vote down!

Hide already purchased products (or allow purchasing the product only once)

Hi,

I have a view with a list of product displays, and I would like to hide all the products that are already purchased by the current user. This would allow purchasing products only once per user.

I've tried to modify the view and add a relationship with the order, but I can't find the relationship "Order".
As it's explained in the similar issue http://drupal.org/node/1221372 , I also tried to create a view of "Commerce Order". I think this would work for displaying a list of purchased products, but not for displaying a list of non-purchased products, because a view of 'Commerce Order' displays results with orders, not results without orders.

Asked by: netol
on October 25, 2012

1 Answer

Vote up!
1
Vote down!

There is probably a better way to go about this, but here you go: A "catalog" view that filters out all products you have purchased.

http://pastebin.com/Gjk1dM4b

Caveat: This is a view of line items (things that have been purchased) and would require that all of your products have been purchased at least one time before.

Step 1) Create a View of "Line Items"

Step 2) Add relationships to Order and Product

Step 3) Add a filter on the "User:current" and choose to use the relationship "Order: owner" and mark it "no"

Step 4) Profit?

Josh Miller
Answer by: Josh Miller
Posted: Mar 6, 2013