Order Totals
Get gross order totals, and filter orders using standard channel:entries parameters. If used as a single tag, it will output the sum of the totals. If used as a tag pair, you will have the variables listed below.
Table of Contents
Variables
total
The sum of the order totals that match your filter.
{total}
subtotal
The sum of the order subtotals that match your filter.
{subtotal}
tax
The sum of the order tax amounts that match your filter.
{tax}
shipping
The sum of the order shipping charges that match your filter.
{shipping}
discount
The sum of the order discount amounts that match your filter.
{discount}
count
The number of orders that match your filter.
{count}
Examples
All orders.
{exp:cartthrob:order_totals limit="999999999"}
Orders from January 2010.
{exp:cartthrob:order_totals year="2010" month="01"}
Total: {total}
{/exp:cartthrob:order_totals}
Orders by member whose id is 1.
{exp:cartthrob:order_totals author_id="1"}
Total: {total}
{/exp:cartthrob:order_totals}
Orders from 2011 whose status is paid.
{exp:cartthrob:order_totals channel="orders" status="paid" year="2011"}
{total}
{/exp:cartthrob:order_totals}
Since order_totals uses channel:entries tag as its base, you can use the power of dynamic urls to power your reporting.
Did you know that you can tack on YYYY/ YYYY/MM/ YYYY/MM/DD to your url to dynamically grab entries/orders from those dates?
site.com/order/totals/2011
site.com/order/totals/2011/10
site.com/order/totals/2011/10/01