<?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  28/11/10, 08:18
 *\author oscim <mail aurelien@oscim.fr> <www http://www.oscim.fr>
 *\encode UTF-8
 *\group content
 *\file 
 *\dir includes/content/
 *\brief cart custommers
*/
//! chargement cart fonction d'affichage
  $DCart=$cart->init_draw();
?>
<div id="shoppingCart">

  <?php $boxe =$page->oscss_boxes->_return('checkout_progressbar'); ?>
  <?php echo unhtmlentities($boxe->content) ?>

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

  <?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_SHOPPING_CART, 'action=update_product')); ?>
    <?php if ($cart->count_contents() > 0) { ?>
      <div id="cartContent">
	<?php echo $DCart->hidden ; ?>
        <fieldset>
        <legend> <?php echo MY_CART_LEGEND; ?> </legend>
          <?php foreach($DCart->products as $i=>$product):
// 	    $p=$cart->draw_cart('',$product);
	    if( false ) echo $product;
	    else { ?>
            <div id="ajaxcartProduct<?php echo $i; ?>" class="cartProduct <?php echo @$product['class']; ?>">
              <p class="cartDelete">
                <label for="cart_delete<?php echo $i ;?>" title="<?php echo TABLE_HEADING_REMOVE ; ?>" ><span><?php echo TABLE_HEADING_REMOVE ; ?></span></label>
                <?php   if(_cst_bool('AJAX_CART_MODE'))  echo tep_draw_checkbox_field('cart_delete[]','cart_delete'.$i, $product['id'], false, 'onclick="changecartdel('.$i.')"');
                        else  echo tep_draw_checkbox_field('cart_delete[]','cart_delete'.$i, $product['id']); ?>
              </p>

                <?php echo '<a class="tn" href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $product['id']) . '">' . tep_image(DIR_WS_IMAGES . $product['image'], $product['name'],  $page->_conf_value('SMALL_IMAGE_WIDTH'), $page->_conf_value('SMALL_IMAGE_HEIGHT')) . '</a>' ; ?>
                <ul>
                  <li class="cartName"><?php echo $product['name'] ;?></li>
                  <li class="cartQty"> <?php
                  if(_cst_bool('AJAX_CART_MODE'))   echo MY_CART_QTY .' '. tep_draw_input_field('cart_quantity[]','cartQty'.$i, $product['quantity'], 'onkeyup="changecartqty('.$i.')"') . tep_draw_hidden_field('products_id[]', $product['id']) ;
                  else  echo MY_CART_QTY .' '. tep_draw_input_field('cart_quantity[]','cartQty', $product['quantity']) . tep_draw_hidden_field('products_id[]', $product['id']) ;
                  ?> </li>
<!--                   <li id="ajaxcartPriceht<?php echo $i; ?>" class="cartPrice"> <?php //echo $currencies->display_price($product['final_price'], 1, $product['quantity']) ;?> </li> -->
                  <li id="ajaxcartPrice<?php echo $i; ?>" class="cartPrice"> <?php echo $currencies->format($product['total_line_ttc']) ?> </li>
                </ul>
            </div>
          <?php } endforeach; ?>
          <div class="spacer">&nbsp;</div>
        </fieldset>
      </div>

    <div id="TotCart" class="SubTotal">
      <ul>
	<li id="ajaxcartSubTotal" class="cartSubTotal">
	   <ul>
	  <?php foreach($cart->show_list_total() as $i=>$tot) { ?>
	    <li class="cart SubTotal"><?php printf('<span>%s </span> %s' ,$tot->text, $currencies->format($tot->value)); ?></li>
	  <?php } ?>
	  </ul>
	</li>
	<li id="ajaxcartWeight" class="cartWeight">
	  <?php echo '<span>' . SUB_TITLE_WEIGHT_TOTAL .'</span>' . $cart->show_weight().' '.UNIT_WEIGHT_NAME; ?>
	</li>
      </ul>
    </div>

      <?php if ($DCart->any_out_of_stock == 1) {
            if (_cst_bool('STOCK_ALLOW_CHECKOUT')) { ?>
          <div class="warning"><?php echo OUT_OF_STOCK_CAN_CHECKOUT; ?></div>
      <?php } else { ?>
            <div class="warning"><?php echo OUT_OF_STOCK_CANT_CHECKOUT; ?></div>
      <?php }
          } ?>

        <p class="formBt">
	  <?php echo '<a class="navBt" href="' . tep_href_link(FILENAME_SHOPPING_CART, 'action=resetCart') . '">' . IMAGE_BUTTON_RESET_CART . '</a>'; ?>
          <input class="submitBt" type="submit" value="<?php echo IMAGE_BUTTON_UPDATE_CART; ?>"  />
        </p>

        <div class="navBt">
          <?php
            $back = sizeof($navigation->path)-2;
            if (isset($navigation->path[$back])) echo '<a class="navBt" href="' . tep_href_link($navigation->path[$back]['page'], tep_array_to_string($navigation->path[$back]['get'], array('action')), $navigation->path[$back]['mode']) . '">' . IMAGE_BUTTON_CONTINUE_SHOPPING . '</a>';
            else   echo '<a class="navBt" href="javascript:history.go(-1)">' . IMAGE_BUTTON_BACK . '</a>'; ?>
          <?php echo '<a class="navBt" href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . IMAGE_BUTTON_CHECKOUT . '</a>'; ?>
        </div>
    <?php } else { ?>
      <div class="infoText"><?php echo TEXT_CART_EMPTY; ?></div>

      <div class="navBt">
	<?php echo '<a class="navBt" href="' . tep_href_link(FILENAME_DEFAULT) . '">' . IMAGE_BUTTON_CONTINUE . '</a>'; ?>
      </div>
    <?php } ?>
  </form>
</div>