if ($products_price_real < 0) { $products_price = olc_format_price(abs($products_price_real), true, true, true); } $buy_now = str_replace(HASH, $products_id, $buy_now_link); $buy_now = str_replace(ATSIGN, $products_name, $buy_now); $cpath = olc_get_product_path($products_id); $products_image = str_replace(HASH, $products_image, $img); $products_image = str_replace(ATSIGN, $products_name, $products_image); $products_history[] = array('PRODUCTS_NAME' => $products_name, 'PRODUCTS_IMAGE' => $products_image, 'PRODUCTS_PRICE' => $products_price, 'PRODUCTS_URL' => str_replace(HASH, $products_id, $product_link), 'PRODUCTS_CATEGORY_URL' => str_replace(HASH, $cpath, $cat_path), 'BUY_NOW_BUTTON' => $buy_now); $i++; } } $smarty->assign('products_history', $products_history); } else { $order_content = array(); if (olc_count_customer_orders() > 0) { $orders_query = olc_db_query("\n\t\tselect\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 . " ot, " . TABLE_ORDERS_STATUS . " s\n\t where\n\t o.customers_id = '" . CUSTOMER_ID . "' and\n\t o.orders_id = ot.orders_id and\n\t ot.class = 'ot_total' and\n\t o.orders_status = s.orders_status_id and\n\t s.language_id = '" . SESSION_LANGUAGE_ID . "'\n\t order by orders_id desc limit 3"); while ($orders = olc_db_fetch_array($orders_query)) { $order_name = $orders['delivery_name']; if ($order_name) { $order_country = $orders['delivery_country']; } else { $order_name = $orders['billing_name']; $order_country = $orders['billing_country']; } $orders_id = $orders['orders_id']; $order_content[] = array('ORDER_ID' => $orders_id, 'ORDER_DATE' => olc_date_short($orders['date_purchased']), 'ORDER_STATUS' => $orders['orders_status_name'], 'ORDER_TOTAL' => $orders['order_total'], 'ORDER_LINK' => olc_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $orders_id, SSL), 'ORDER_BUTTON' => HTML_A_START . olc_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $orders_id, SSL) . '">' . olc_image_button('small_view.gif', SMALL_IMAGE_BUTTON_VIEW) . HTML_A_END); } } $smarty->assign('LINK_EDIT', olc_href_link(FILENAME_ACCOUNT_EDIT)); $smarty->assign('LINK_ADDRESS', olc_href_link(FILENAME_ADDRESS_BOOK));
Released under the GNU General Public License ---------------------------------------------------------------------------------------*/ include 'includes/application_top.php'; // include needed functions require_once DIR_FS_INC . 'olc_count_customer_orders.inc.php'; require_once DIR_FS_INC . 'olc_date_long.inc.php'; require_once DIR_FS_INC . 'olc_image_button.inc.php'; require_once DIR_FS_INC . 'olc_get_all_get_params.inc.php'; if (!isset($_SESSION['customer_id'])) { olc_redirect(olc_href_link(FILENAME_LOGIN, '', SSL)); } $breadcrumb->add(NAVBAR_TITLE_1_ACCOUNT_HISTORY, olc_href_link(FILENAME_ACCOUNT, '', SSL)); $breadcrumb->add(NAVBAR_TITLE_2_ACCOUNT_HISTORY, olc_href_link(FILENAME_ACCOUNT_HISTORY, '', SSL)); require DIR_WS_INCLUDES . 'header.php'; $module_content = array(); if (($orders_total = olc_count_customer_orders()) > 0) { $history_query_raw = "select o.orders_id, o.date_purchased, o.delivery_name, o.billing_name, ot.text as order_total, s.orders_status_name from " . TABLE_ORDERS . " o, " . TABLE_ORDERS_TOTAL . " ot, " . TABLE_ORDERS_STATUS . " s where o.customers_id = '" . (int) $_SESSION['customer_id'] . "' and o.orders_id = ot.orders_id and ot.class = 'ot_total' and o.orders_status = s.orders_status_id and s.language_id = '" . SESSION_LANGUAGE_ID . "' order by orders_id DESC"; $history_split = new splitPageResults($history_query_raw, $_GET['page'], MAX_DISPLAY_ORDER_HISTORY); $history_query = olc_db_query($history_split->sql_query); while ($history = olc_db_fetch_array($history_query)) { $products_query = olc_db_query("select count(*) as count from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . $history['orders_id'] . APOS); $products = olc_db_fetch_array($products_query); if (olc_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' => olc_date_long($history['date_purchased']), 'ORDER_PRODUCTS' => $products['count'], 'ORDER_TOTAL' => strip_tags($history['order_total']), 'ORDER_BUTTON' => HTML_A_START . olc_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'page=' . $_GET['page'] . '&order_id=' . $history['orders_id'], SSL) . '">' . olc_image_button('small_view.gif', SMALL_IMAGE_BUTTON_VIEW) . HTML_A_END); }