Discussions

How do I modify the default Commerce Discounts view to filter discounts by user

On the admin/commerce/store/discounts page, I would like to edit the view and add a filter that would allow me to find all of the discounts for "Order Discounts" where there are discount conditions applied to specific users?

In short, I want to be able to see all discounts I have created for a specific user. I realize there are two different kinds of discounts (at least by default); either "Order" or "Product" discount. But if I have hundreds of users, and those users may have 5-10 discounts (for 5-10 different products), how do I easily see what discounts I have created for them in this view?

I suppose I could "Name" the discount using their username, and the part they will receive a discount on, then add a filter keying on the name of the discount, but is there a better, more elegant way of doing this?

I thought I might need to create a relationship to an order condition or something, but couldn't find a way to do that to allow me to just enter the username in the filter.

I am using

Drupal 7.23
Views 3.7
Drupal Commerce 7.x-1.8
Commerce Discount 7.x-1.0-alpha3

Any help would be greatly appreciated.

Posted: Dec 4, 2013

Comments

lalbright on December 4, 2013

Also, conversely, how would I should to the user all the discounts the user has enabled? Not in the cart, but in their profile or something. The cart part already works, but how do they know what discounts they are eligible for?