<?php

$cart = $_SESSION['ncart'];


?>

<table class="table table-hover" >
  <tr>
    <th class="nome">Produto</th>
    <th class="qtd">Qtd</th>
    <th class="valor">Valor</th>
    <th class="excluir"></th>
  </tr>
  <?php 

  if(sizeof($cart)>0){

  $total=0; $itens=0; foreach ($cart as $id => $qtd) {

  	$prod = retornaProd($id);

   ?>
  <tr class="animate">
    <td class="nome"><?php echo $prod['nome']; ?></td>
    <td class="qtd"><?php echo $qtd; $itens+=$qtd; ?></td>
    <td class="valor"><?php $valor = $prod['valor']*$qtd; $total += $valor; echo "R$ ".number_format($valor,2,',',''); ?></td>
    <td class="excluir"><a href='' class ='subProd' id='del_<?php echo $id; ?>' ><span class='glyphicon glyphicon-remove'></span></a></td>
  </tr>
  <?php } ?>

  <tr class="dest">
    <td class="total">Total</td>
    <td class="qtd"><?php echo $itens; ?></td>
    <td class="valor"><?php echo "R$ ".number_format($total,2,',',''); ?></td> 
    <td class="excluir"></td>
  </tr>

  <a href="<?php echo sti('urlbase'); ?>finalizar" class="btn btn-warning finalizar animate">Finalizar pedido</a>

  <?php }else{ ?>

  <tr>
    <td colspan='4'>Sua cesta de pedidos está vazia.</td>
 
  </tr>
  <a href='' disabled class="btn btn-default finalizar animate">Finalizar pedido</a>


  <?php } ?>
</table>









