Last active
August 29, 2015 13:58
-
-
Save edtoken/9973141 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$uEmail = $_POST['user']['email']; | |
$mEmail = get_option('manager_email'); | |
$headers = 'From: ' . $_POST['user']['name'] . ' <' . $uEmail . '>' . "\r\n"; | |
add_filter('wp_mail_content_type',create_function('', 'return "text/html";')); | |
$udata = $_POST['user']; | |
$useremailFile = F_DIR . 'email_html/client/index.html'; | |
$adminemailFile = F_DIR . 'email_html/admin/index.html'; | |
$usFileContent = file_get_contents($useremailFile); | |
$adFileContent = file_get_contents($adminemailFile); | |
// var_dump($udata); | |
$delivery = $udata['delivery']; | |
if($delivery == 1) $delivery = 'Курьером до двери'; | |
if($delivery == 2) $delivery = 'Самовывоз'; | |
if($delivery == 3) $delivery = 'На склад "Новой почты"'; | |
$payment = $udata['payment']; | |
if($payment == 1) $payment = 'Наличный расчет'; | |
if($payment == 2) $payment = 'Безналичный расчет'; | |
if($payment == 3) $payment = 'Наложенный платёж'; | |
if($payment == 4) $payment = 'Курьеру при доставке'; | |
if($payment == 5) $payment = 'На карту ПриватБанка'; | |
$cupons = ''; | |
if(isset($_SESSION['fshop']['cupons'])){ | |
$addCupons = $_SESSION['fshop']['cupons']; | |
$cupons = ''; | |
foreach ($addCupons as $cupon) { | |
$dis = getCuponInfo($cupon['tag']); | |
$cupons .= 'Код: ' . $cupon['tag'] . ', скидка: ' . $dis[0]->discount . '% <br>'; | |
} | |
} | |
$usDatArray = array('{cupons}', '{name}', '{email}', '{phone}', '{address}', '{comment}', '{payment}', '{delivery}', '{itemList}', '{allPrice}', '{items}', '{order_id}'); | |
$usRArray = array( | |
$cupons, | |
$udata['name'], | |
$udata['email'], | |
$udata['phone'], | |
$udata['region'] . ' ' . $udata['city'] . ' ' . $udata['address'], | |
$udata['comment'], | |
$payment, | |
$delivery, | |
$item_list, | |
// $outPrice . ' грн.', | |
$outPrice . ' у.е.', | |
$itemsCols, | |
$order_id | |
); | |
$usEmail = str_replace ( $usDatArray, $usRArray, $usFileContent ); | |
$adEmail = str_replace ( $usDatArray, $usRArray, $adFileContent ); | |
if($order_id){ | |
wp_mail($mEmail, 'Новый заказ на сайте', $adEmail, $headers, ''); | |
wp_mail($uEmail, 'Ваш заказ #' . $order_id, $usEmail, $headers, ''); | |
// wp_mail('[email protected]', 'Новый заказ на сайте', $adEmail, $headers, ''); | |
// wp_mail('[email protected]', 'Ваш заказ #' . $order_id, $usEmail, $headers, ''); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment