Advertisement
Guest User

Untitled

a guest
Jul 15th, 2018
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.18 KB | None | 0 0
  1. function send_mail(){
  2. $helper = $_POST["helper"];
  3.  
  4. /*Очищаем корзину перед добавлением новых товаров*/
  5. global $woocommerce;
  6. $woocommerce->cart->empty_cart( $clear_persistent_cart = true );
  7.  
  8. if($helper > 0){
  9. $woocommerce->cart->add_to_cart( 264 );
  10. }
  11.  
  12. if(isset($_POST["country_name"])){
  13. $country_name = $_POST["country_name"];
  14. }
  15. else{
  16. $country_name = null;
  17. }
  18.  
  19. if(isset($_POST["city_name"])){
  20. $city_name = $_POST["city_name"];
  21. }
  22. else{
  23. $city_name = null;
  24. }
  25.  
  26. if(isset($_POST["count_day"])){
  27. $count_day = $_POST["count_day"];
  28. }
  29. else{
  30. $count_day = null;
  31. }
  32.  
  33. if(isset($_POST["date_range_start"])){
  34. $date_range_start = $_POST["date_range_start"];
  35. }
  36. else{
  37. $date_range_start = null;
  38. }
  39.  
  40. if(isset($_POST["date_range_end"])){
  41. $date_range_end = $_POST["date_range_end"];
  42. }
  43. else{
  44. $date_range_end = null;
  45. }
  46.  
  47. if(isset($_POST["date_can_move"])){
  48. $date_can_move = $_POST["date_can_move"];
  49. }
  50. else{
  51. $date_can_move = null;
  52. }
  53.  
  54. if(isset($_POST["count_people"])){
  55. $count_people = $_POST["count_people"];
  56. }
  57. else{
  58. $count_people = null;
  59. }
  60.  
  61. if(isset($_POST["home_type"])){
  62. $home_type = $_POST["home_type"];
  63. }
  64. else{
  65. $home_type = null;
  66. }
  67.  
  68. if(isset($_POST["budget_type"])){
  69. $budget_type = $_POST["budget_type"];
  70. }
  71. else{
  72. $budget_type = null;
  73. }
  74.  
  75. if(isset($_POST["email"])){
  76. $email = $_POST["email"];
  77. }
  78. else{
  79. $email = null;
  80. }
  81.  
  82. if(isset($_POST["soc_link"])){
  83. $soc_link = $_POST["soc_link"];
  84. }
  85. else{
  86. $soc_link = null;
  87. }
  88.  
  89. if(isset($_POST["wanted"])){
  90. $wanted = $_POST["wanted"];
  91. }
  92. else{
  93. $wanted = null;
  94. }
  95.  
  96.  
  97. $country_string = '';
  98.  
  99. $validate = validate_individual($count_day, $date_range_start,$date_range_end, $count_people, $home_type, $budget_type, $email);
  100. foreach ($validate as $v) {
  101. echo '<p class="error-message">'. $v . '</p>';
  102. }
  103.  
  104.  
  105.  
  106.  
  107. foreach ($country_name as $key => $country) {
  108. $country_string .= ++$key . ') ' . $country . '('. $city_name[$key-1] .')<br>';
  109. }
  110.  
  111.  
  112.  
  113. $to = 'excelsiorer@yandex.ru';
  114. $subject = 'Заявка на Индивидуальный Трип';
  115. $message = '
  116. <strong>Почта:</strong> ' . $email . '<br>
  117. <strong>Социальная сеть:</strong>' . $soc_link . '<br>
  118. <strong>ФИО:</strong>' . $name . '<br>
  119. <strong>Телефон:</strong>' . $phone . '<br><br><br><br>' . '
  120. <strong>Выбранные страны и города:</strong>' . $country_string . '<br><strong>Количество дней</strong>' . $count_day . '<br>
  121. <strong>Диапазон дат:</strong>' . $date_range . '<br>
  122. <strong>Есть ли возможность сдвинуть?</strong>' . $date_can_move . '<br>
  123. <strong>Количество путешественников</strong>' . $count_people . '<br>
  124. <strong>Жилье</strong>' . $home_type_name . '<br>
  125. <strong>Бюджет</strong>' . $budget_type_name . '<br>' . '<strong>Пожелания:</stron><br>' . $wanted . '<br>' ;
  126. $headers = 'From: ' . $email . "\r\n" .
  127. 'Reply-To: '. $email . "\r\n" .
  128. "Content-type: text/html; charset=$send_charset\r\n" .
  129. 'X-Mailer: PHP/' . phpversion();
  130. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement