<?php
/**
  @licence GPL 2005-2010  The osCSS developers - osCSS Open Source E-commerce
  @portion code Copyright (c) 2002 osCommerce
  @package osCSS-2 <www http://www.oscss.org>
  @version 2.1.0
  @date  15/12/10, 21:53
  @author oscim <mail aurelien@oscim.fr> <www http://www.oscim.fr>
  @encode UTF-8
*/
  $module=$page->_call('account','ret_modules');
  $i=0;
  $orders_query = tep_db_query("select o.orders_id,o.orders_prefix, o.date_purchased, o.delivery_name, o.delivery_country, o.billing_name, o.billing_country, ot.text as order_total, s.orders_status_name from " . TABLE_ORDERS . " o, " . TABLE_ORDERS_TOTAL . " ot, " . TABLE_V_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 1");

?>
<div id="account">

  <?php /** Retour d'erreur checkup sur la boutique */ $page->messageStack->_draw('account'); ?>

  <h2 class="content title <?php echo $language ;?>"><?php echo HEADING_TITLE; ?></h2>

  <div class="prod_box_big">
    <div class="top_prod_box_big"></div>
      <div class="center_prod_box_big">

    <?php if ($cart->count_contents() > 0) { ?>
    <div class="contentBox news_info">
      <h3><?php echo OVERVIEW_TITLE; ?></h3>
      <ul>
        <li><?php echo '<a href="' . tep_href_link(FILENAME_SHOPPING_CART) . '">' . SHOPPING_CART_ACTIF . '</a>'; ?></li>
      </ul>
    </div>
    <?php } ?>


    <?php   while ($orders = tep_db_fetch_array($orders_query)) {
      if (tep_count_customer_orders() > 0) { ?>
      <div class="contentBox overview">
          <h4><?php echo OVERVIEW_PREVIOUS_ORDERS ; ?></h4>
          <ul>
            <li><?php echo '#' . $orders['orders_prefix'].$orders['orders_id']; ?> <?php echo tep_date_short($orders['date_purchased']); ?>  <?php echo $orders['order_total']; ?> <?php echo '<a class="navBtMini" href="' . tep_href_link(FILENAME_ACCOUNT, 'action=history_info&amp;order_id=' . $orders['orders_id'], 'SSL') . '">' . SMALL_IMAGE_BUTTON_VIEW . '</a>'; ?></li>
            <li><?php echo $orders['orders_status_name']; ?></li>
            <li><?php if (tep_not_null($orders['delivery_name'])) echo tep_output_string_protected($orders['delivery_name']) . ', ' . $orders['delivery_country'];
                      else echo tep_output_string_protected($orders['billing_name']) . ', ' . $orders['billing_country']; ?></li>
          </ul>
        <?php } ?>
        <p><?php echo '<a class="navBtMini" href="' . tep_href_link(FILENAME_ACCOUNT, 'action=history', 'SSL') . '">' . OVERVIEW_SHOW_ALL_ORDERS . '</a>'; ?></p>
      </div>
    <?php } ?>

    <div class="contentBox myAccount">
      <h3><?php echo MY_ACCOUNT_TITLE; ?></h3>
      <ul>
        <li><?php echo '<a href="' . tep_href_link(FILENAME_ACCOUNT, 'action=edit', 'SSL') . '">' . MY_ACCOUNT_INFORMATION . '</a>'; ?></li>
        <li><?php echo '<a href="' . tep_href_link(FILENAME_ACCOUNT, 'action=password', 'SSL') . '">' . MY_ACCOUNT_PASSWORD . '</a>'; ?></li>
        <?php /** ACA module */ foreach($module as $k){ if (method_exists($k, 'display_view_min_listMyAccount'))  foreach($k->display_view_min_listMyAccount($customer_id) as $kt=>$vt){ $i++; echo '<li><a href="'.$vt->href_link.'">'.$vt->title.'</a> </li>'; } } ?>
      </ul>
    </div>

    <div class="contentBox myOrders">
      <h3><?php echo MY_ORDERS_TITLE; ?></h3>
      <ul>
        <li><?php echo '<a href="' . tep_href_link(FILENAME_ACCOUNT, 'action=history', 'SSL') . '">' . MY_ORDERS_VIEW . '</a>'; ?></li>
      </ul>
    </div>

    <div class="contentBox myEmail">
      <h3><?php echo EMAIL_NOTIFICATIONS_TITLE; ?></h3>
        <ul>
          <li><?php echo '<a href="' . tep_href_link(FILENAME_ACCOUNT, 'action=newsletters', 'SSL') . '">' . EMAIL_NOTIFICATIONS_NEWSLETTERS . '</a>'; ?></li>
        </ul>
    </div>

    </div>
    <div class="bottom_prod_box_big"></div>
  </div>
</div>