I don't know if its the right place for this. I have several products assigned to a few user profiles/sellers, using user reference. I want to create a view, so that the sellers would be able to view the income (total revenue) of every product assigned to them. I have used a module called "Product Revenue Field" but it doesn't work as expected. What would be the best approach for this? Creating a field in the product node type or just creating a field in views, maybe using views php?
Thanks.

Comments

DanZ’s picture

The same product can sell for different prices at different times, so you'd want to extract this from a View of Ordered Products. Just use aggregation and sum up the results.

You'd still need some way to filter per user.

Jonesgr’s picture

Thanks for the answer. I found this article but it is for drupal 6:
http://www.pt-ink.com/content/displaying-grand-totals-product-ubercart-2x

As for the filtering per user, imagine this:

Each seller has a "personal" view where only his/her products are listed.
For example:
Product 1 Stock:2 Revenue:540
Product 5 Stock:8 Revenue:1200

I thought that a dynamic field in each product node would be an overhead. Also, there are the administrator reports that do the same thing, but they are not accessible to other users.

longwave’s picture

Status: Active » Fixed

You should build a view as DanZ describes in #1. You can use a "User: Uid" contextual filter, with the "Current user or user has permission" validator, to take the user ID from the URL while restricting access to the view - in the same way that the "uc_orders_user" view that comes with Ubercart produces the per-user order listing pages at /user/%/orders.

Jonesgr’s picture

Thanks longwave. Solved the issue with a view as proposed. ;)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.