Item |
Quantity |
Price |
Subtotal |
There are only ' . $row['stock'] . ' left in stock of the ' . $row['name'] . '. This item has been removed from your cart and placed in your wish list. | ';
$remove[$row['sku']] = $row['quantity'];
} else {
// Get the correct price:
$price = get_just_price($row['price'], $row['sale_price']);
// Calculate the subtotal:
$subtotal = $price * $row['quantity'];
// Print out a table row:
echo '' . $row['category'] . '::' . $row['name'] . ' |
' . $row['quantity'] . ' |
$' . $price . ' |
$' . number_format($subtotal, 2) . ' |
';
// Add the subtotal to the total:
$total += $subtotal;
}
} // End of WHILE loop.
// Add the shipping:
$shipping = get_shipping($total);
$total += $shipping;
echo '
| Shipping & Handling |
$' . $shipping . ' |
';
// Store the shipping in the session:
$_SESSION['shipping'] = $shipping;
// Display the total:
echo '
| Total |
$' . number_format($total, 2) . ' |
|
';
// Remove any problematic items:
if (!empty($remove)) {
// Clear the results:
mysqli_next_result($dbc);
// Loop through the array:
foreach ($remove as $sku => $qty) {
list($sp_type, $pid) = parse_sku($sku);
// Move it to the wish list:
$r = mysqli_multi_query($dbc, "CALL add_to_wish_list('$uid', '$sp_type', $pid, $qty);CALL remove_from_cart('$uid', '$sp_type', $pid)");
echo "CALL add_to_wish_list('$uid', '$sp_type', $pid, $qty);CALL remove_from_cart('$uid', '$sp_type', $pid)";
} // End of FOREACH loop.
} // End of $remove IF.
?>