<?php
// ####################################################
// carrito.php
// parte de shoop
// © ff 2005

// este es el minicarrito. en el muestro el contenido del carrito de la sesion actual
include('_config.php');

	if(is_object($cart)) {
		$numProducts = $cart->itemcount;
		$subTotal = $cart->total;
	} else {
		$numProducts = $subTotal = 0;
	}
?>
<style type="text/css">
<!--
.labelCart		{font-family: Verdana, Arial, Helvetica, sans-serif; 	font-weight: bold; 	font-size: 11px; color: #000000; text-decoration: none}
.productoCart	{font-family: Arial, Helvetica, sans-serif; 			font-weight: normal; 	font-size: 12px; padding-left: 0px;   color: #222222; text-decoration: none}
.productoCartN	{font-family: Arial, Helvetica, sans-serif; 			font-weight: normal; 	font-size: 12px; padding-left: 0px;   color: #222222; text-decoration: none}
.miniCart, .miniCartLink {font-family: Verdana, Arial, Helvetica, sans-serif; 	font-weight: normal; 	font-size: 10px;  color: #000000; text-decoration: none}
.miniCartLink:hover, .productoCart:hover {color: #ff3300; text-decoration: underline; }
.euroCart		{font-family: Arial, Helvetica, sans-serif; 								font-size: 12px;}
.precioCart		{font-family: Verdana, Arial, Helvetica, sans-serif; 	font-weight: bold; 	font-size: 13px; 	color: #006699;}
.rojo {color: #FF0000}
-->
</style>
<script language="javascript">MM_preloadImages('_imgs/gom.gif');</script>

<table border="0" cellpadding="0" cellspacing="0" bgcolor="#E2E4E5" id="carritoTop">
	<tr>
		<td bgcolor="#7A706A"><img src="_imgs/d.gif" width="6" height="18"></td>
		<td bgcolor="#7A706A"><img src="_imgs/titCart.gif" width="132" height="18" alt="su compra"></td>
		<td bgcolor="#212226"><img src="_imgs/cart3.gif" width="24" height="18"></td>
		<td bgcolor="#212226"><img src="_imgs/crnr.gif" width="6" height="18"></td></tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" bgcolor="#E2E4E5" id="carrito">
	<tr>
		<td><img src="_imgs/d.gif" width="6" height="6"></td>
		<td><img src="_imgs/d.gif" width="156" height="6"></td>
		<td><img src="_imgs/d.gif" width="6" height="6"></td></tr>
	<tr>
		<td><img src="_imgs/d.gif" width="6" height="20"></td>
<?php
	if($numProducts) {
?>
  	<td width="156" align="right" class="labelCart"> <?php echo $numProducts . ' ' . ($numProducts > 1 ? ' productos' : ' producto'); ?> en su cesta<br><a href="carrito_add.php" class="miniCartLink">vaciar cesta</a></td></tr>
	<tr><td colspan="3"><img src="_imgs/d.gif" width="6" height="6"></td></tr>
	<tr><td></td><td bgcolor="#ffffff"><img src="_imgs/d.gif" width="6" height="1"></td><td></td></tr>
<?php 
		$items = $cart->get_contents();
		foreach($items as $item) {
?>
	<tr>
		<td><img src="_imgs/d.gif" width="6" height="20"></td>
		<td width="156" class="productoCartN">
<?php
	if($item['info']['tipo'] != 'ocasion') {
?>
	<a href="producto.php?id=<?php echo $item['id'];?>" class="productoCart">
<?php
	}
?>
<?php echo '<b>' . $item['info']['marca'] . '</b> ' . $item['info']['modelo']; ?></a></td></tr>
 	<tr>
		<td></td><td><div align="right"><?php  if($item['qty'] > 1) { ?> <span class="miniCart">(<?php echo $item['qty']; ?> ud. a <?php echo miNumberFormat($item['price']); ?>&euro;)&nbsp;</span><?php } ?><span class="precioCart"><?php echo miNumberFormat($item['subtotal']); ?> </span><span class="euroCart">&euro;</span></div></td><td></td></tr>
	<tr><td></td><td bgcolor="#ffffff"><img src="_imgs/d.gif" width="6" height="1"></td><td></td></tr>
<?php
		} // foreach
?>
<tr><td colspan="3"><img src="_imgs/d.gif" width="6" height="6"></td></tr>
 <tr><td></td><td><div align="right"><span class="labelCart">Subtotal: </span><span class="precioCart"><?php echo miNumberFormat($subTotal); ?> </span><span class="euroCart">&euro;</span><br>
 <?php echo ($subTotal >= $GLOBALS['no_portes'] ? '<span class="rojo miniCart"><b>&iexcl;ENVIO GRATUITO!</b></span>' : ''); ?></div></td>
 <td></td></tr>
	<tr><td colspan="3"><img src="_imgs/d.gif" width="6" height="6"></td></tr>
	<tr>
		<td><img src="_imgs/d.gif" width="6" height="22"></td>
		<td align="right"><a href="pedido.php" onMouseOver="MM_swapImage('checkout','','_imgs/gom.gif',1)" onMouseOut="MM_swapImgRestore()" class="labelSearch">CONFIRMAR COMPRA&nbsp;<img src="_imgs/gog.gif" name="checkout" width="13" height="13" border="0" align="absbottom" id="checkout"></a></td>
		<td><img src="_imgs/d.gif" width="6" height="22"></td></tr>
<?php
	} else {
?>
	  	<td width="156" class="labelCart">
			Su cesta est&aacute; vac&iacute;a.</td></tr>
<?php
}
?>
	<tr><td colspan="3"><img src="_imgs/d.gif" width="6" height="6"></td></tr>
</table>
