Update the email message for the passport form
authorSteve Sutton <steve@gaslightmedia.com>
Tue, 14 Apr 2015 15:36:45 +0000 (11:36 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Tue, 14 Apr 2015 15:36:45 +0000 (11:36 -0400)
CHANGE TEXT IN BEGINNING OF EMAIL:
Thank you for ordering the Gaylord Golf Mecca Passport.
This is a confirmation receipt for:
Customer information (name, address, etc) [spelling correction ss]
Line break the quantity and price and type (individual line items)
Shipping fee
Total of order

Toolkit/Contacts/ContactUs.php
Toolkit/Contacts/PassPort.php
Toolkit/Contacts/templates/passportConfEmail.tpl
js/PassportForm.js

index 337bf6d..f1830d1 100755 (executable)
@@ -906,6 +906,7 @@ class Toolkit_Contacts_ContactUs
         $email,
         $emailSubject,
         $emailTemplate,
+        $emailData = null,
         $mailFactory = 'mail'
     ) {
 
@@ -918,6 +919,7 @@ class Toolkit_Contacts_ContactUs
         $page->subject     = $emailSubject;
         $page->fname       = $this->getSubmitValue('fname');
         $page->lname       = $this->getSubmitValue('lname');
+        $page->formData    = $emailData;
 
         if ($this->elementExists('qty')) {
             $page->qty = $this->getSubmitValue('qty');
index 9a4b7e0..5a51d0f 100755 (executable)
@@ -1,6 +1,6 @@
 <?php
 //    vim:set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker syntax=php:
-$GLOBALS['bottomScripts'][] = MEDIA_BASE_URL . 'js/PassportForm.js';
+$GLOBALS['bottomScripts'][] = MEDIA_BASE_URL . 'js/PassportForm.js?v=1.0.0';
 /**
  * File Doc Comment
  *
@@ -201,6 +201,12 @@ class Toolkit_Contacts_PassPort
             'display' => 'State/Province',
             'opts'    => $GLOBALS['states']
         );
+        $e[] = array(
+            'type'    => 'text',
+            'req'     => true,
+            'name'    => 'zip',
+            'display' => 'ZIP/Postal Code'
+        );
         $e[] = array(
             'type'    => 'email',
             'req'     => true,
@@ -213,12 +219,6 @@ class Toolkit_Contacts_PassPort
             'name'    => 'email_rmv',
             'display' => 'Verify E-mail'
         );
-        $e[] = array(
-            'type'    => 'text',
-            'req'     => true,
-            'name'    => 'zip',
-            'display' => 'ZIP/Postal Code'
-        );
         $e[] = array(
             'type'    => 'tel',
             'req'     => false,
@@ -268,8 +268,8 @@ class Toolkit_Contacts_PassPort
             'type'    => 'static',
             'req'     => false,
             'display' => '</label><table role="grid">'
-            . '<tr><td>Postage and Handling</td><td><input type="text" readonly value="3" style="width: 50px;"></td></tr>'
-            . '<tr><td>Total Price</td><td><input type="text" id="passport_total" name="total_price" readonly value="0" style="width: 50px;"></td></tr>'
+            . '<tr><td>Postage and Handling</td><td>$<input type="text" readonly value="3" style="width: 50px;"></td></tr>'
+            . '<tr><td>Total Price</td><td>$<input type="text" id="passport_total" name="total_price" readonly value="0" style="width: 50px;"></td></tr>'
             . '</table></label>'
         );
 
@@ -315,13 +315,15 @@ class Toolkit_Contacts_PassPort
                         'm' => 'mm',
                         'Y' => 'yyyy'
                     )
-                )
+                ),
+                'att' => array('style' => 'width: 70px;')
             );
             $e[] = array(
                 'type' => 'text',
                 'req' => true,
                 'name' => 'cc_cvv',
                 'display' => 'CVV',
+                'opts' => array('style' => 'width: 50px;')
             );
         }
 
@@ -485,10 +487,30 @@ class Toolkit_Contacts_PassPort
     {
         $email = $this->getSubmitValue('email');
         if (GLM_TOOLBOX::valid_email($email)) {
+            $perPrice     = filter_var($_REQUEST['pass_type'], FILTER_VALIDATE_INT);
+            $qtyPassports = filter_var($_REQUEST['qty'], FILTER_VALIDATE_INT);
+            $totalCharge  = filter_var($_REQUEST['total_price'], FILTER_VALIDATE_INT);
             $this->sendConfirmation(
-                $email, // Email to
-                'Gaylord Golf Passport', // Email Subject
-                'passportConfEmail.tpl' // Email Template File
+                'vagrant@localhost',//$email, // Email to
+                'Gaylord Golf Passport Order', // Email Subject
+                'passportConfEmail.tpl', // Email Template File
+                array(
+                    'fields'        => array(
+                        'First Name' => filter_var($_REQUEST['fname'], FILTER_SANITIZE_STRING),
+                        'Last Name'  => filter_var($_REQUEST['lname'], FILTER_SANITIZE_STRING),
+                        'Address'    => filter_var($_REQUEST['address'], FILTER_SANITIZE_STRING),
+                        'City'       => filter_var($_REQUEST['city'], FILTER_SANITIZE_STRING),
+                        'State'      => filter_var($_REQUEST['state'], FILTER_SANITIZE_STRING),
+                        'ZIP'        => filter_var($_REQUEST['zip'], FILTER_SANITIZE_STRING),
+                        'Email'      => filter_var($_REQUEST['email'], FILTER_SANITIZE_STRING),
+                        'Telephone'  => filter_var($_REQUEST['phone'], FILTER_SANITIZE_STRING),
+                    ),
+                    'qtyPassports'  => $qtyPassports,
+                    'perPrice'      => $perPrice,
+                    'passportPrice' => $qtyPassports * $perPrice,
+                    'shipping'      => 3,
+                    'totalCharge'   => $totalCharge
+                )
             );
         }
     }
@@ -688,6 +710,7 @@ class Toolkit_Contacts_PassPort
                 $this->mergeFiles
             );
             if ($res === true) {
+                $this->captchaQuestion->destroy();
                 $this->cleanForm();
                 $this->freeze();
                 $this->emailOwner();
index 056a34d..6970299 100755 (executable)
             <b>{subject:h}</b>
         </font>
     </p>
-    <table cellspacing="0" cellpadding="0" bgcolor="#c0c0c0" border="0">
+    <table cellspacing="0" cellpadding="0" border="0">
         <tr>
             <td>
-                <table cellspacing="1" cellpadding="5" border="0" bgcolor="#c0c0c0" width="400">
+                <table cellspacing="1" cellpadding="5" border="0"  width="450">
                 <tr><td>
-               <p>Thank you for requesting a Golf Passport!</p>
-               <p>This is a confirmation of your order for {qty} {pass_type}(s)</p>
-               <p>A $3.00 shipping charge is added to your total.</p>
+               <p>Thank you for ordering the Gaylord Golf Mecca Passport.</p>
+               <p>This is a confirmation receipt for:</p>
+               </td></tr>
+               <tr><td>
+                    <table cellspacing="1" cellpadding="5" border="0"  width="400">
+                            {foreach:formData[fields],label,value}
+                            <tr>
+                                <td>{label}</td>
+                                <td>{value}</td>
+                            <tr>
+                            {end:}
+                            <tr>
+                                <td>{formData[qtyPassports]} Passports  at ${formData[perPrice]} each</td>
+                                <td>${formData[passportPrice]}</td>
+                            <tr>
+                            <tr>
+                                <td>Shipping Charge</td>
+                                <td>${formData[shipping]}</td>
+                            <tr>
+                            <tr>
+                                <td>Total Charge</td>
+                                <td>${formData[totalCharge]}</td>
+                            <tr>
+                        </tr>
+                    </table>
                </td></tr>
                </table>
             </td>
@@ -27,7 +49,7 @@
             <td>
                 <table cellspacing="0" cellpadding="10" border="0" width="400">
                     <tr>
-                        <td bgcolor="#eeeeee">
+                        <td>
                             <font size="1" face="arial, sans-serif">
                                 To ensure the delivery of these e-mails to your inbox,
                                 please add {email_from:h} to your e-mail Address Book or Safe List.
index 4a506b6..9d6751e 100644 (file)
@@ -28,7 +28,8 @@ $(document).ready(function () {
         PassportForm.pass_type = +$(this).val();
         setPassportPrice();
     });
-    PassportForm.pass_type = pass_type.val();
+    var pass_type_selected = $('input[name="pass_type"]:checked');
+    PassportForm.pass_type = pass_type_selected.val();
     PassportForm.qty = qty.val();
     setPassportPrice();
 });