iChoze -> Zen Cart v1.5 $ Exp $ Recover Cart Sales Report v2.11 Recover Cart Sales contribution: JM Ivler 11/20/03 (c) Ivler / Ideas From the Deep / osCommerce Released under the GNU General Public License Modifed by Aalst (recover_cart_sales.php,v 1.2 .. 1.36) aalst@aalst.com Modified by Lane Roathe (recover_cart_sales.php,v 1.4d .. v2.11) lane@ifd.com www.osc-modsquad.com / www.ifd.com */ require('includes/application_top.php'); require(DIR_WS_CLASSES . 'currencies.php'); $currencies = new currencies(); $tdate = (isset($_GET['tdate']) ? $_GET['tdate'] : RCS_BASE_DAYS); $ndate = seadate($tdate); function zen_date_order_stat($raw_date) { if ($raw_date == '') return false; $year = substr($raw_date, 2, 2); $month = (int)substr($raw_date, 4, 2); $day = (int)substr($raw_date, 6, 2); return date(DATE_FORMAT, mktime(0, 0, 0, $month, $day, $year)); } function seadate($day) { $ts = date("U"); $rawtime = strtotime("-".$day." days", $ts); $ndate = date("Ymd", $rawtime); return $ndate; } ?> > <?php echo TITLE; ?>
Execute("SELECT s.scartid, s.customers_id, s.dateadded, s.datemodified, c.customers_firstname, c.customers_lastname, c.customers_email_address FROM " . TABLE_SCART . " s LEFT JOIN " . TABLE_CUSTOMERS . " c ON (s.customers_id = c.customers_id) WHERE dateadded >= '" . $ndate . "' ORDER BY dateadded DESC" ); $rc_cnt = $scart->RecordCount(); // Loop though each one and process it while(!$scart->EOF) { // Query DB for the FIRST order that matches this customer ID and came // after the abandoned cart $orders = $db->Execute("SELECT o.orders_id, o.date_purchased, s.orders_status_name, ot.text as order_total, ot.value FROM " . TABLE_ORDERS . " o LEFT JOIN " . TABLE_ORDERS_TOTAL . " ot ON (o.orders_id = ot.orders_id) LEFT JOIN " . TABLE_ORDERS_STATUS . " s ON (s.orders_status_id = o.orders_status AND s.language_id = " . $_SESSION['languages_id'] . ") WHERE o.customers_id = " . (int)$scart->fields['customers_id'] . " AND o.orders_status > " . RCS_PENDING_SALE_STATUS . " AND o.date_purchased >= '" . date('Y-m-d', strtotime($scart->fields['dateadded'])) . "' AND ot.class = 'ot_total'"); // If we got a match, create the table entry to display the information if (!$orders->EOF) { $custknt++; $total_recovered += $orders->fields['value']; $cust_array[$custknt] = array_merge($scart->fields, $orders->fields); } $scart->MoveNext(); } ?>
' . ''; ?>
';var_export($cust_array);echo ''; foreach($cust_array as $cust) { ?>

 %  format(zen_round($total_recovered, 2)); ?>