<?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  18/11/10, 21:53
  @author oscim <mail aurelien@oscim.fr> <www http://www.oscim.fr>
  @encode UTF-8
*/
  $page->add_var_page('SMALL_IMAGE_WIDTH_CART', '30');
  $page->add_var_page('SMALL_IMAGE_HEIGHT_CART', '30');

//! 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="cart title <?php echo $language ;?>"><?php echo HEADING_TITLE; ?></h2>


  <div class="prod_box_big">
    <div class="shop_top_prod_box_big"></div>


      <div class="center_prod_box_big">
    <table class="invoice invoiceDetails" cellspacing="0" summary="<?php echo HEADING_TITLE; ?>">
        <tr>
	  <th class="shoppingCartProducts "><?php echo TABLE_HEADING_PRODUCTS; ?></th>
	  <th class="shoppingCart pu"><?php echo __('HEADING_PRODUCTS_PRICE_U'); ?></th>
	  <th class="shoppingCartQty "><?php echo __('HEADING_PRODUCTS_QTY'); ?></th>
	  <th class="shoppingCart tright totttc"><?php echo __('HEADING_PRODUCTS_TOT_TTC'); ?></th>
	  <th class="shoppingCart shop_del"><?php /*echo TABLE_HEADING_REMOVE;*/ ?></th>
        </tr>
    </table>

  <?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_SHOPPING_CART, 'action=update_product')); ?>
    <?php if ($cart->count_contents() > 0) { ?>

	<?php echo $DCart->hidden ; ?>


          <?php foreach($DCart->products as $i=>$product):
// 	    $p=$cart->draw_cart('',$product);
	    if( false ) echo $product;
	    else { ?>
	      <div class="shop_cartContent">
		<div class="shop_img">
		  <?php echo tep_image(DIR_WS_IMAGES . $product['image'], $product['name'],  $page->_conf_value('SMALL_IMAGE_WIDTH_CART'), $page->_conf_value('SMALL_IMAGE_HEIGHT_CART')) ; ?>
		</div>
		<div class="shop_product">
		  <?php echo $product['name'] ;?>
		</div>
		<div class="shop_pu">
		  <?php echo $currencies->format($product['price']) ;?>
		</div>
		<div class="shop_qte">
		  <?php if(_cst_bool('AJAX_CART_MODE'))   echo  ' '. tep_draw_input_field('cart_quantity[]','cartQty'.$i, $product['quantity'], 'size="2" onkeyup="changecartqty('.$i.')"') . tep_draw_hidden_field('products_id[]', $product['id']) ;
                  else  echo  ' '. tep_draw_input_field('cart_quantity[]','cartQty', $product['quantity']) . tep_draw_hidden_field('products_id[]', $product['id']) ;
                  ?>
		</div>
		<div class="shop_total_unitaire">
		  <span id="ajaxcartPrice<?php echo $i; ?>" class="cartPrice"> <?php echo $currencies->format(tep_add_tax($product['final_price'], tep_get_tax_rate($product['tax_class_id'])) *$product['quantity']  ) ;?> </span></div>
		<div class="shop_del">
		  <?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']); ?>
		</div>
	      </div>


          <?php } endforeach; ?>
          <div class="spacer">&nbsp;</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 }
          } ?>

      <div class="navBt">

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

          <?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>
    <div class="bottom_prod_box_big"></div>
  </div>
</div>