I bought a shopping cart widget for muse. To send orders to my email, you need to insert the code somewhere, but I don't understand where. Help please!
this code:
<?php
$adminEmail = ‘email’; // почта владельца магазина
$siteName = ‘name’; // название магазина
$siteEmail = ‘email2’; // эл. почта магазина
$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$delivery = $_POST['delivery'];
$address = $_POST['address'];
$comment = $_POST['comment'];
$checkoutList = $_POST['checkoutList'];
$total = $_POST['total'];
$currency = $_POST['currency'];
$orderId = $_POST['orderId'];
$checkoutListArr = explode('>>>>', $checkoutList);
foreach($checkoutListArr as $key => $str) {
$checkoutListArr[$key] = explode('>>', $str);
}
$checkoutListTable = [];
foreach($checkoutListArr as $key => $str) {
array_push($checkoutListTable, "<tr><td>$str[1]</td><td>$str[2] $currency</td><td>x$str[3]</td><td>$str[4] $currency</td></tr>");
}
$checkoutListTable = implode($checkoutListTable);
$headers = "Content-type: text/html; charset=utf-8\r\n";
$headers .= "From: ".$siteName."<".$siteEmail.">\r\n";
$adminMessage = '<html><body>';
$adminMessage .= "<p>Имя: $name</p>";
$adminMessage .= "<p>Эл. почта: $email</p>";
$adminMessage .= "<p>Телефон: $phone</p>";
$adminMessage .= "<p>Доставка: $delivery</p>";
$adminMessage .= "<p>Адрес: $address</p>";
$adminMessage .= "<p>Коментарий: $comment</p>";
$adminMessage .= "<table><tbody>";
$adminMessage .= "$checkoutListTable";
$adminMessage .= "</tbody></table>";
$adminMessage .= "<p>Итого: $total $currency</p>";
$adminMessage .= "</body></html>";
$userMessage = '<html><body>';
$userMessage .= "<p>Доставка: $delivery</p>";
$userMessage .= "<table><tbody>";
$userMessage .= "$checkoutListTable";
$userMessage .= "</tbody></table>";
$userMessage .= "<p>Итого: $total $currency</p>";
$userMessage .= "</body></html>";
if (isset($checkoutList)) {
mail($adminEmail, 'Заказ №'.$orderId, $adminMessage, $headers);
mail($email, 'Заказ №'.$orderId, $userMessage, $headers);
}
?>