Closed (fixed)
Project:
Ubercart
Version:
7.x-3.4
Component:
Reports
Priority:
Minor
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
21 May 2013 at 19:04 UTC
Updated:
19 Jun 2013 at 08:51 UTC
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
Comment #1
DanZ commentedThe 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.
Comment #2
Jonesgr commentedThanks 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.
Comment #3
longwaveYou 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.
Comment #4
Jonesgr commentedThanks longwave. Solved the issue with a view as proposed. ;)