Anyone have a example of an functional simplecart(js) with checkout through email ?
so i can change for my code.
thank you
Put the following code in a separate php file. I used sendcart.php.
<?php
$to = 'youremail@email.com';
$subject = 'Your Subject';
$content = $_POST;
$body = '';
for($i=1; $i < $content['itemCount'] + 1; $i++) {
$name = 'item_name_'.$i;
$quantity = 'item_quantity_'.$i;
$price = 'item_price_'.$i;
$body .= 'item #'.$i.': ';
$body .= $content[$name].' '.$content[$quantity].' '.$content[$price];
$body .= '<br>';
}
$headers = 'From: youremail@email.com' . "\r\n" .
'Reply-To: youremail@email.com' . "\r\n" .
' X-Mailer: PHP/' . phpversion();
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
mail($to, $subject, $body, $headers);
Header('Location: thankyou.php');
?>
Then in your html file, include the following line inside the script tag.
simpleCart({
checkout: {
type: "SendForm" ,
url: "sendcart.php",
method: "POST",
}
});