ZenCart_Documentation  1.5.0
http://www.collinsharper.com
C:/xampp/htdocs/zen-cart/admin/stats_customers.php
Go to the documentation of this file.
00001 <?php
00010   require('includes/application_top.php');
00011 
00012   require(DIR_WS_CLASSES . 'currencies.php');
00013   $currencies = new currencies();
00014 ?>
00015 <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
00016 <html <?php echo HTML_PARAMS; ?>>
00017 <head>
00018 <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
00019 <title><?php echo TITLE; ?></title>
00020 <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
00021 <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS">
00022 <script language="javascript" src="includes/menu.js"></script>
00023 <script language="javascript" src="includes/general.js"></script>
00024 <script type="text/javascript">
00025   <!--
00026   function init()
00027   {
00028     cssjsmenu('navbar');
00029     if (document.getElementById)
00030     {
00031       var kill = document.getElementById('hoverJS');
00032       kill.disabled = true;
00033     }
00034   }
00035   // -->
00036 </script>
00037 </head>
00038 <body onload="init()">
00039 <!-- header //-->
00040 <?php require(DIR_WS_INCLUDES . 'header.php'); ?>
00041 <!-- header_eof //-->
00042 
00043 <!-- body //-->
00044 <table border="0" width="100%" cellspacing="2" cellpadding="2">
00045   <tr>
00046 <!-- body_text //-->
00047     <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
00048       <tr>
00049         <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
00050           <tr>
00051             <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
00052             <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
00053           </tr>
00054         </table></td>
00055       </tr>
00056       <tr>
00057         <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
00058           <tr>
00059             <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
00060               <tr class="dataTableHeadingRow">
00061                 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_NUMBER; ?></td>
00062                 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_CUSTOMERS; ?></td>
00063                 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_TOTAL_PURCHASED; ?>&nbsp;</td>
00064               </tr>
00065 <?php
00066   if (isset($_GET['page']) && ($_GET['page'] > 1)) $rows = $_GET['page'] * MAX_DISPLAY_SEARCH_RESULTS_REPORTS - MAX_DISPLAY_SEARCH_RESULTS_REPORTS;
00067   $customers_query_raw = "select c.customers_id, c.customers_firstname, c.customers_lastname, sum(op.products_quantity * op.final_price)+sum(op.onetime_charges)  as ordersum from " . TABLE_CUSTOMERS . " c, " . TABLE_ORDERS_PRODUCTS . " op, " . TABLE_ORDERS . " o where c.customers_id = o.customers_id and o.orders_id = op.orders_id group by c.customers_id order by ordersum DESC";
00068   $customers_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS_REPORTS, $customers_query_raw, $customers_query_numrows);
00069 // fix counted customers
00070   $customers_query_m = $db->Execute("select customers_id
00071                                            from " . TABLE_ORDERS . " group by customers_id");
00072 
00073   $customers_query_numrows = $customers_query_m->RecordCount();
00074 
00075   $rows = 0;
00076   $customers = $db->Execute($customers_query_raw);
00077   while (!$customers->EOF) {
00078     $rows++;
00079 
00080     if (strlen($rows) < 2) {
00081       $rows = '0' . $rows;
00082     }
00083 ?>
00084               <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href='<?php echo zen_href_link(FILENAME_CUSTOMERS, 'cID=' . $customers->fields['customers_id'], 'NONSSL'); ?>'">
00085                 <td class="dataTableContent" align="right"><?php echo $customers->fields['customers_id']; ?>&nbsp;&nbsp;</td>
00086                 <td class="dataTableContent"><?php echo '<a href="' . zen_href_link(FILENAME_CUSTOMERS, 'cID=' . $customers->fields['customers_id'], 'NONSSL') . '">' . $customers->fields['customers_firstname'] . ' ' . $customers->fields['customers_lastname'] . '</a>'; ?></td>
00087                 <td class="dataTableContent" align="right"><?php echo $currencies->format($customers->fields['ordersum']); ?>&nbsp;</td>
00088               </tr>
00089 <?php
00090     $customers->MoveNext();
00091   }
00092 ?>
00093             </table></td>
00094           </tr>
00095           <tr>
00096             <td colspan="3"><table border="0" width="100%" cellspacing="0" cellpadding="2">
00097               <tr>
00098                 <td class="smallText" valign="top"><?php echo $customers_split->display_count($customers_query_numrows, MAX_DISPLAY_SEARCH_RESULTS_REPORTS, $_GET['page'], TEXT_DISPLAY_NUMBER_OF_CUSTOMERS); ?></td>
00099                 <td class="smallText" align="right"><?php echo $customers_split->display_links($customers_query_numrows, MAX_DISPLAY_SEARCH_RESULTS_REPORTS, MAX_DISPLAY_PAGE_LINKS, $_GET['page']); ?>&nbsp;</td>
00100               </tr>
00101             </table></td>
00102           </tr>
00103         </table></td>
00104       </tr>
00105     </table></td>
00106 <!-- body_text_eof //-->
00107   </tr>
00108 </table>
00109 <!-- body_eof //-->
00110 
00111 <!-- footer //-->
00112 <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
00113 <!-- footer_eof //-->
00114 </body>
00115 </html>
00116 <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
 All Data Structures Namespaces Files Functions Variables Enumerations