function display_cart($cart, $change = true, $images = 1)
{
// display items in shopping cart
// optionally allow changes (true or false)
// optionally include images (1 - yes, 0 - no)
global $_SESSION;
echo '<table border = 0 width = 100% cellspacing = 0>
<form action = show_cart.php method="post">
<tr><th colspan = '. (1+$images) .' bgcolor="#cccccc">Продукт</th>
<th bgcolor="#cccccc">Цена</th><th bgcolor="#cccccc">Количество</th>
<th bgcolor="#cccccc">Общо</th>
<th bgcolor="#cccccc">Изтрий</th></tr>';
//display each item as a table row
foreach ($_SESSION['cart'] as $a_id => $qty)
{
$artikul = get_artikuli_details($a_id);
echo '<tr>';
if($images ==true)
{
echo '<td align = left>';
if (file_exists("images/$a_id.jpg"))
{
$size = GetImageSize('images/'.$a_id.'.jpg');
if($size[0]>0 && $size[1]>0)
{
echo '<img src="images/'.$a_id.'.jpg" border=0 ';
echo 'width = '. $size[0]/3 .' height = ' .$size[1]/3 . '>';
}
}
else
echo ' ';
echo '</td>';
}
echo '<td align = left>';
echo "<a href = \"show_article.php?a_id=$a_id\">$artikul".$_SESSION['$lang']."_a_title</a>";
echo '</td><td align = center>€ '.number_format($artikul['cena'], 2);
echo '</td><td align = center>';
// if we allow changes, quantities are in text boxes
if ($change == true)
echo "<input type = text name = \"$a_id\" value = \"$qty\" size = 3>";
else
echo $qty;
echo '</td><td align = center>$'.number_format($artikul['cena']*$qty,2)."</td>";
echo '<td align = center>';
echo '<a href = "show_cart.php?delid='.$a_id.'"><img src="images/delete.png" alt="премахване на продукт от количката" border="0"><a href="show_cart.php"></a>';
echo '</td></tr>';
}
// display total row
echo '<tr>
<th colspan = '. (2+$images) ." bgcolor=\"#cccccc\"> </th>
<th align = center bgcolor=\"#cccccc\">
".$_SESSION['items']."
</th>
<th align = center bgcolor=\"#cccccc\">
\$".number_format($_SESSION['por_cena'], 2).
'</th>
<th bgcolor="#cccccc"></th>
</tr>
';