<?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 boxes
 *\file 
 *\dir includes/boxes/
 *\brief cart custommers
*/
  global $detail_tot, $detail;

  $currencies=$page->return_object('currencies');
  $cart=$page->return_object('cart');
  $detail=$detail_tot=array();
  $info_box_contents='';

  $new_products_id_in_cart= (tep_session_is_registered('new_products_id_in_cart')? $_SESSION['new_products_id_in_cart']: '');
  if (is_object($cart) && $cart->count_contents() > 0) {
    $products = $cart->get_products();
    for ($i=0, $n=sizeof($products); $i<$n; $i++) {

      if (($new_products_id_in_cart == $products[$i]['id']))  $cart_contents_string = '<span class="newItemInCart">';
      else  $cart_contents_string = '<span class="infoBoxContents">';

      $cart_contents_string .= $products[$i]['quantity'] . '&nbsp;x&nbsp;</span>'."\n".'<span><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '">';

      if ( ($new_products_id_in_cart == $products[$i]['id']))  $cart_contents_string .= "\n".'<span class="newItemInCart">';
      else  $cart_contents_string .= "\n".'<span class="infoBoxContents">';

      $cart_contents_string .= $products[$i]['name'] . '</span></a></span>'."\n";

      $detail[]= $cart_contents_string;

      if ( ($new_products_id_in_cart == $products[$i]['id']))  tep_session_unregister('new_products_id_in_cart');

    }
  } else   $detail[]=__('box shopping cart empty');


  if (is_object($cart) && $cart->count_contents() > 0) {

    foreach($cart->show_list_total() as $i=>$tot) {
        $detail_tot[]=  sprintf('<span>%s </span> %s' ,$tot->text, $currencies->format($tot->value)) ;
    }

    $detail_tot[]=  '<li>'.__('box shopping cart weight').' '.$cart->show_weight().' '.UNIT_WEIGHT_NAME.'</a></li>'."\n";
  }

  $info_box_contents .= '<p><a class="navBt" href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . __('box shopping cart button checkout') . '</a></p>';


  $title='<a href="'.tep_href_link(FILENAME_SHOPPING_CART).'">'.__('box heading shopping cart').'</a>';

  $array=array('title'=>tep_output_string_protected($title,false,true),'content'=>tep_output_string_protected(tep_get_include_contents('box.cart'),false,true));
?>