A specific user group on my website has the ability to create products on my website. This is all done using Channel Form
tags. Unregistered guests may purchase these products.
For the user group that creates these products, I need to create a widget that shows how many of their created products have been sold so far. But I am not sure what template tags would best suit my purposes.
EDIT
So after looking around the database, I found there are 3 tables necessary to create the query I want
FIND THE INTERSECTION OF THESE TWO TABLES
exp_channel_data
- to filter the entries to the specific product channel (i.e. channel_id = 15
).
exp_channel_titles
- to further filter the product channel entries by author ID (i.e. author_id = CURRENT_USER
)
THEN FIND THE SUM OF THE ITEM TOTALS OF THE SUBSEQUENT RESULTS
exp_store_order_items
- this is where I'd presumably use a SQL statement not very dissimilar from the one Justin Long provided me:
{if logged_in_member_group == 1}
{exp:query sql='SELECT SUM(item_qty) as totalSales FROM exp_store_order_items WHERE entry_id = {entry_id}'}
{totalSales}
{/exp:query}
{/if}