Advertisement
Guest User

Untitled

a guest
Aug 31st, 2015
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.40 KB | None | 0 0
  1. <style type="text/css">
  2. @media all and (max-width: 600px)
  3. {
  4. #lftimg
  5. {
  6. display:none;
  7. }
  8. }
  9. </style>
  10. <?php
  11.  
  12. // Or whatever the path to your app/Mage.php happens to be ...
  13. require_once('app/Mage.php');
  14.  
  15. // Initialize Magento ...
  16. Mage::app("default");
  17.  
  18. // Email Form Template ID in magento admin transactional emails admin page
  19. $templateId = 16;
  20.  
  21. //lets see what site (US or SG) the user is on.
  22. $show_singapore = 'false';
  23. if(Mage::app()->getWebsite()->getId() != 1)
  24. {
  25. $show_singapore = 'true';
  26. }
  27.  
  28. ?>
  29. <div class="page-title">
  30. <h1>
  31. CONTACT US
  32. </h1>
  33. <p>We would love to hear from you!</p>
  34. </div>
  35. <div style='float:left; padding-right:10px; width:90%;'><br /><br />
  36.  
  37. $first_name = $_POST['first_name'];
  38. $last_name = $_POST['last_name'];
  39. $fullname = "$first_name $last_name";
  40. $emailadr = $_POST['emailadr'];
  41. $telephonenum = $_POST['telephonenum'];
  42. $comment = $_POST['comment'];
  43.  
  44.  
  45. if($first_name == '' || $emailadr == ''|| $comment== '')
  46. {
  47. echo "All fields are required, please fill out the <a href="">the form</a> again.";
  48. }
  49. else
  50. {
  51.  
  52. $confirmmsg = "Hello $first_name $last_name,<br /><br />
  53. Thank you for contacting our company. We have received your email and will contact you back shortly.";
  54.  
  55. // Set recepient information
  56. if($show_singapore =='true')
  57. {
  58. $headers = "From: staff@singapore.comrn";
  59. }
  60. else
  61. {
  62. $headers = "From: staff@usa.comrn";
  63. }
  64.  
  65. $headers .= "MIME-Version: 1.0rn";
  66. $headers .= "Content-Type: text/html; charset=ISO-8859-1rn";
  67. mail($email, $subject, $confirmmsg, $headers);
  68.  
  69. // Set sender information
  70. $senderName = 'Customer Service';
  71. $senderEmail = 'staff@usa.com';
  72. $sender = array('name' => $senderName,'email' => $senderEmail);
  73.  
  74. // Set recepient information
  75. if($show_singapore =='true')
  76. {
  77. $recepient_email = 'staff@singapore.com';
  78. }
  79. else
  80. {
  81. $recepient_email = 'staff@usa.com';
  82. }
  83. $recepient = array('name' => 'Customer Service', 'email' => $recepient_email);
  84.  
  85. // Get Store ID
  86. $store = Mage::app()->getStore()->getId();
  87.  
  88. // Set variables that can be used in email template
  89. $var = array(
  90. 'name' => $fullname,
  91. 'emailadr' => $emailadr,
  92. 'telephonenum' => $telephonenum,
  93. 'comment' => $comment
  94. );
  95.  
  96.  
  97. $translate = Mage::getSingleton('core/translate');
  98.  
  99. // Send Transactional Email
  100. try{
  101. Mage::getModel('core/email_template')->sendTransactional($templateId, $sender, $recepient_email, $var);
  102. }
  103. catch(Exception $e){
  104. print_r($e);
  105. }
  106.  
  107. }
  108.  
  109. echo "<div id='messages_product_view'>Your message has been sent!</div>";
  110. }
  111. else
  112. {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement