$smarty = new Smarty();
// include boxes
require DIR_FS_CATALOG . 'templates/' . CURRENT_TEMPLATE . '/source/boxes.php';
// include needed functions
require_once DIR_FS_INC . 'xtc_count_customer_orders.inc.php';
require_once DIR_FS_INC . 'xtc_date_long.inc.php';
require_once DIR_FS_INC . 'xtc_image_button.inc.php';
require_once DIR_FS_INC . 'xtc_get_all_get_params.inc.php';
if (!isset($_SESSION['customer_id'])) {
    xtc_redirect(xtc_href_link(FILENAME_LOGIN, '', 'SSL'));
}
$breadcrumb->add(NAVBAR_TITLE_1_ACCOUNT_HISTORY, xtc_href_link(FILENAME_ACCOUNT, '', 'SSL'));
$breadcrumb->add(NAVBAR_TITLE_2_ACCOUNT_HISTORY, xtc_href_link(FILENAME_ACCOUNT_HISTORY, '', 'SSL'));
require DIR_WS_INCLUDES . 'header.php';
$module_content = array();
if (($orders_total = xtc_count_customer_orders()) > 0) {
    $history_query_raw = "select o.orders_id, \n                                 o.date_purchased,\n                                 o.delivery_name,\n                                 o.billing_name,\n                                 ot.text as order_total,\n                                 s.orders_status_name\n                        from " . TABLE_ORDERS . " o,\n                             " . TABLE_ORDERS_TOTAL . " ot,\n                             " . TABLE_ORDERS_STATUS . " s \n                        where o.customers_id = " . (int) $_SESSION['customer_id'] . "\n                        and o.orders_id = ot.orders_id\n                        and ot.class = 'ot_total'\n                        and o.orders_status = s.orders_status_id\n                        and s.language_id = " . (int) $_SESSION['languages_id'] . "\n                        order by orders_id DESC";
    $history_split = new splitPageResults($history_query_raw, isset($_GET['page']) ? $_GET['page'] : 0, MAX_DISPLAY_ORDER_HISTORY);
    $history_query = xtc_db_query($history_split->sql_query);
    while ($history = xtc_db_fetch_array($history_query)) {
        $products_query = xtc_db_query("select count(*) as count from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . $history['orders_id'] . "'");
        $products = xtc_db_fetch_array($products_query);
        if (xtc_not_null($history['delivery_name'])) {
            $order_type = TEXT_ORDER_SHIPPED_TO;
            $order_name = $history['delivery_name'];
        } else {
            $order_type = TEXT_ORDER_BILLED_TO;
            $order_name = $history['billing_name'];
        }
        $module_content[] = array('ORDER_ID' => $history['orders_id'], 'ORDER_STATUS' => $history['orders_status_name'], 'ORDER_DATE' => xtc_date_long($history['date_purchased']), 'ORDER_PRODUCTS' => $products['count'], 'ORDER_TOTAL' => strip_tags($history['order_total']), 'ORDER_BUTTON' => '<a href="' . xtc_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'page=' . (empty($_GET['page']) ? "1" : (int) $_GET['page']) . '&order_id=' . $history['orders_id'], 'SSL') . '">' . xtc_image_button('small_view.gif', SMALL_IMAGE_BUTTON_VIEW) . '</a>');
        require_once DIR_FS_INC . 'xtc_get_tracking_link.php';
Esempio n. 2
0
$max = isset($_SESSION['tracking']['products_history']) ? count($_SESSION['tracking']['products_history']) : 0;
$products_history = array();
$also_purchased_history = array();
//EOF - DokuMan - 2010-02-28 - set undefined Undefined variables
while ($i < $max) {
    $product_history_query = xtDBquery("select * from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id=pd.products_id and pd.language_id='" . (int) $_SESSION['languages_id'] . "' and p.products_status = '1' and p.products_id = '" . $_SESSION['tracking']['products_history'][$i] . "'");
    $history_product = xtc_db_fetch_array($product_history_query, true);
    $cpath = xtc_get_product_path($_SESSION['tracking']['products_history'][$i]);
    if ($history_product['products_status'] != 0) {
        $history_product = array_merge($history_product, array('cat_url' => xtc_href_link(FILENAME_DEFAULT, 'cPath=' . $cpath)));
        $products_history[] = $product->buildDataArray($history_product);
    }
    $i++;
}
$order_content = '';
if (xtc_count_customer_orders() > 0) {
    $orders_query = xtc_db_query("select\n\t                                  o.orders_id,\n\t                                  o.date_purchased,\n\t                                  o.delivery_name,\n\t                                  o.delivery_country,\n\t                                  o.billing_name,\n\t                                  o.billing_country,\n\t                                  ot.text as order_total,\n\t                                  s.orders_status_name\n\t                              from " . TABLE_ORDERS . " o, " . TABLE_ORDERS_TOTAL . "\n\t                                  ot, " . TABLE_ORDERS_STATUS . " s\n\t                              where o.customers_id = '" . (int) $_SESSION['customer_id'] . "'\n\t                              and o.orders_id = ot.orders_id\n\t                              and ot.class = 'ot_total'\n\t                              and o.orders_status = s.orders_status_id\n\t                              and s.language_id = '" . (int) $_SESSION['languages_id'] . "'\n\t                              order by orders_id desc limit 3");
    while ($orders = xtc_db_fetch_array($orders_query)) {
        if (xtc_not_null($orders['delivery_name'])) {
            $order_name = $orders['delivery_name'];
            $order_country = $orders['delivery_country'];
        } else {
            $order_name = $orders['billing_name'];
            $order_country = $orders['billing_country'];
        }
        $order_content[] = array('ORDER_ID' => $orders['orders_id'], 'ORDER_DATE' => xtc_date_short($orders['date_purchased']), 'ORDER_STATUS' => $orders['orders_status_name'], 'ORDER_TOTAL' => $orders['order_total'], 'ORDER_LINK' => xtc_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $orders['orders_id'], 'SSL'), 'ORDER_BUTTON' => '<a href="' . xtc_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $orders['orders_id'], 'SSL') . '">' . xtc_image_button('small_view.gif', SMALL_IMAGE_BUTTON_VIEW) . '</a>');
        require_once DIR_FS_INC . 'xtc_get_tracking_link.php';
        $order_content[count($order_content) - 1]['TRACKING_LINKS'] = xtc_get_tracking_link($orders['orders_id']);
    }
}
$smarty->assign('LINK_EDIT', xtc_href_link(FILENAME_ACCOUNT_EDIT, '', 'SSL'));