I'm trying to send all data from the shopping cart in SimpleCartjs to an email. Basically I prefer to send it to a clients email for confirmation of his order. So for now I got it working, but I cannot seem to send the grandTotal, which is the sum of everything (cost + Tax + Shipping). I am able to echo it to the screen, but when mailing it the grandTotal will not send. Any ideas? here is my code so far. The grandTotal in the end of the body field is just there, But I dont know how to get its value:
$send = $_GET['send'];
$to = 'name@myname.com';
$subject = 'Your Tea shopping Cart';
$content = $_POST;
$body = '';
for($i=1; $i < $content['itemCount'] + 1; $i++) {
$name = 'item_name_'.$i;
$quantity = 'item_quantity_'.$i;
$price = 'item_price_'.$i;
$tax = $_POST['taxRate'];
$ship = $_POST['shipping'];
$total = $content[$quantity]*$content[$price];
$iva = $content[$price]*$tax;
$subtotal = $total + $ship + $iva;
$body .= 'item #'.$i.':';
$body .= $content[$name].'<br>';
$body .= $content[$quantity].'Un.: '.$content[$price].'Euros<br>';
$body .= 'IVA : '.$content[$price]*$tax.'Euros<br>';
$body .= 'Shipping: '. $ship.'Euros<br>';
$body .= 'Total: '.$subtotal.'Euros<br>';
$body .= '------------------------------------<br>';
};
$body .= 'Total: '.$grandTotal;
$headers = 'From: name@myname.com' . "
" .
'Reply-To: name@myname.com' . "
" .
'X-Mailer: PHP/' . phpversion();
$headers .= "MIME-Version: 1.0
";
$headers .= "Content-Type: text/html; charset=ISO-8859-1
";
mail($to, $subject, $body, $headers);