|
|
|
1)) $rows = $nPage * MAX_DISPLAY_SEARCH_RESULTS - MAX_DISPLAY_SEARCH_RESULTS;
$customerstable = $oostable['customers'];
$orders_productstable = $oostable['orders_products'];
$orderstable = $oostable['orders'];
$customers_sql_raw = "SELECT c.customers_firstname, c.customers_lastname,
sum(op.products_quantity * op.final_price) AS ordersum
FROM $customerstable c,
$orders_productstable op,
$orderstable o
WHERE c.customers_id = o.customers_id
AND o.orders_id = op.orders_id
GROUP BY c.customers_firstname, c.customers_lastname
ORDER BY ordersum DESC";
$customers_split = new splitPageResults($nPage, MAX_DISPLAY_SEARCH_RESULTS, $customers_sql_raw, $customers_result_numrows);
// fix counted customers
$orderstable = $oostable['orders'];
$customers_result_numrows = $dbconn->Execute("SELECT customers_id
FROM $orderstable
GROUP BY customers_id");
$customers_result_numrows = $customers_result_numrows->RecordCount();
$customers_result = $dbconn->Execute($customers_sql_raw);
while ($customers = $customers_result->fields) {
$rows++;
if (strlen($rows) < 2) {
$rows = '0' . $rows;
}
?>
. |
' . $customers['customers_firstname'] . ' ' . $customers['customers_lastname'] . ''; ?> |
format($customers['ordersum']); ?> |
MoveNext();
}
?>
|
display_count($customers_result_numrows, MAX_DISPLAY_SEARCH_RESULTS, $nPage, TEXT_DISPLAY_NUMBER_OF_CUSTOMERS); ?> |
display_links($customers_result_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $nPage); ?> |
|