<?php
/*
  www.oscGold.com (C) Kamelia-Net Jacek Krysiak
  modul oscGold wer 4.0
*/
if (tep_session_is_registered('customer_id') && (!tep_session_is_registered('customer_is_guest')) ) {
  	$orders_query = tep_db_query("select o.orders_id, o.date_purchased, ot.text as order_total from " . TABLE_ORDERS . " o, " . TABLE_ORDERS_TOTAL . " ot, " . TABLE_ORDERS_STATUS . " s where o.customers_id = '" . (int)$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 = '" . (int)$languages_id . "' order by orders_id desc limit " . MAX_DISPLAY_PRODUCTS_IN_ORDER_HISTORY_BOX);

    if (tep_db_num_rows($orders_query)) {

      $boxHeading = BOX_HEADING_CUSTOMER_ORDERS;
      $corner_left = 'rounded';
      $corner_right = 'rounded';
      $boxContent_attributes = ' align="center"';  
      $box_base_name = 'order_history';
      $box_id = $box_base_name . 'Box';

      $boxContent = '<div class="box_kont">';
	  while ($orders = tep_db_fetch_array($orders_query)) {
        $boxContent .= '<div class="box_list"><a class="boxLink" href="' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $orders['orders_id'], 'SSL') . '"><b>#' .$orders['orders_id'].'</b> - '. tep_date_short($orders['date_purchased']) .' - '.strip_tags($orders['order_total']) . '</a></div>';
        if (file_exists(DIR_WS_TEMPLATES . 'images/infobox/category_line.gif')) {
            $boxContent .= '<div class="box_line">' . tep_image(DIR_WS_TEMPLATES . 'images/infobox/category_line.gif') . '</div>';
        }          
	  } 
      $boxContent .= '</div>';

      include (bts_select('boxes', $box_base_name)); // BTS 1.5
    }
}
?>
