View Single Post
  #1  
Old 10-24-2012, 09:08 AM
 
Dougrun Dougrun is offline
 

X-Adept
  
Join Date: Apr 2012
Posts: 897
 

Thumbs up Order totals Statistics

This mod will add a section to your statistics page displaying order totals for the given time period (order status completed).
This is on 4.5.3 and 4.5.4

It modifies:
admin>statistics.php file
skin>common files>admin>main>statistics.tpl

See screenshot. Donations can be made to via paypal to slodoug at sbcglobal.net

admin>statistics.php
find the date picker code:
Code:
$date_cond = " date>='$start_date_off' AND date<='$end_date_off' ";

add this below it:
Code:
$statistics['ordersnet'] = func_query_first_cell("SELECT sum(subtotal) FROM $sql_tbl[orders] WHERE status='C'AND ($date_cond)"); $statistics['ordersfreight'] = func_query_first_cell("SELECT sum(shipping_cost) FROM $sql_tbl[orders] WHERE status='C'AND ($date_cond)"); $statistics['orderscoupdisc'] = func_query_first_cell("SELECT sum(coupon_discount) FROM $sql_tbl[orders] WHERE status='C' AND ($date_cond)"); $statistics['ordersdisc'] = func_query_first_cell("SELECT sum(discount) FROM $sql_tbl[orders] WHERE status='C' AND ($date_cond)"); $statistics['ordersgcused'] = func_query_first_cell("SELECT sum(giftcert_discount) FROM $sql_tbl[orders] WHERE status='C' AND ($date_cond)"); $statistics['ordersgross'] = func_query_first_cell("SELECT sum(total) FROM $sql_tbl[orders] WHERE status='C' AND ($date_cond)"); $statistics['orderstax'] = func_query_first_cell("SELECT sum(tax) FROM $sql_tbl[orders] WHERE status='C' AND ($date_cond)"); $statistics['orderspaysur'] = func_query_first_cell("SELECT sum(payment_surcharge) FROM $sql_tbl[orders] WHERE status='C' AND ($date_cond)");

You can modify your statistics tpl file as you like but here is mine, add this where you want the stats:
Code:
<tr> <th class="TableHead" colspan="2" align="left" height="16">Completed Order Totals: <i><font color="#000099">{$start_date|date_format:$config.Appearance.datetime_format} - {$end_date|date_format:$config.Appearance.datetime_format}</font></i></th> </tr> <tr> <td height="10" colspan="2"></td> </tr> <tr> <td valign="top" width="343" class="Text">Net Sales (Sum of Order subtotals)</td> <td valign="top" width="67" class="Text" align="right">{$statistics.ordersnet}</td> </tr> <tr> <td valign="top" width="343" class="Text">Shipping Total</td> <td valign="top" width="67" class="Text" align="right">{$statistics.ordersfreight}</td> </tr> <tr> <td valign="top" width="343" class="Text">Coupon Discounts Total</td> <td valign="top" width="67" class="Text" align="right">-{$statistics.orderscoupdisc}</td> </tr> <tr> <td valign="top" width="343" class="Text">Other Discounts Total</td> <td valign="top" width="67" class="Text" align="right">-{$statistics.ordersdisc}</td> </tr> <tr> <td valign="top" width="343" class="Text">Gift Certificates Used Total</td> <td valign="top" width="67" class="Text" align="right">-{$statistics.ordersgcused}</td> </tr> <tr> <td valign="top" width="343" class="Text">Tax Total</td> <td valign="top" width="67" class="Text" align="right">{$statistics.orderstax}</td> </tr> <tr> <td valign="top" width="343" class="Text">Payment Surcharges</td> <td valign="top" width="67" class="Text" align="right">{$statistics.orderspaysur}</td> </tr> <tr> <td valign="top" width="343" class="Text">Gross Sales</td> <td valign="top" width="67" class="Text" align="right">{$statistics.ordersgross}</td> </tr>
Attached Thumbnails
Click image for larger version

Name:	xcartstats.jpg
Views:	227
Size:	42.9 KB
ID:	3247  
__________________
4.7.x xcart store
Business 5.4xx
Reply With Quote