I've built a simple shopping cart and need to generate the total shipping from the array. Here is code so far.
So there may be 2 items listed in the cart, and I'm getting their individual totals with shipping, but want to create a seperate line and output the total charge for shipping alone.PHP Code:<?
while (list($key, $val) = each($_SESSION['cart'])) {
$this_item = $key;
$this_item_qty = $val;
echo ('<tr valign="top">');
echo ('<td>' . $items[$this_item].'</td>');
echo ('<td align="right">$');
echo (number_format($prices[$this_item],2));
echo ('</td>');
echo ('<td>');
if(!$this_item_qty) {
$this_item_qty = 1;
}
echo $this_item_qty;
echo '</td>';
echo ('<td>$'. $shipping[$this_item] .'</td>');
$this_line_total = $this_item_qty * (number_format($prices[$this_item],2) + $shipping[$this_item]);
echo ('<td>$'. number_format($this_line_total,2) . '</td>');
echo ('</tr>');
$total = $total + $this_line_total;
$shippingtotal = // BLAH, BLAH ??
}?>






Bookmarks