Announcement

Collapse
No announcement yet.

Problem Displaying a Custom Customer Field in a Template Based Email

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Bruce - PhosphorMedia
    replied
    I'm not seeing l.settings:customer:xxxx in the default email templates. Do you have the CSSUI Customer Fields item selected?

    Leave a comment:


  • lesliekirk
    replied
    Following on with my previous post, another question came to mind. The form is using a reCaptcha - could it be interfering with the passing of data?

    This is the form

    Code:
    <div class="row bg-white main-content-row">
    <mvt:if expr="g.Order">
    <mvt:assign name="l.settings:url" value="l.settings:urls:OINF:secure" />
    <mvt:elseif expr="g.Redeem">
    <mvt:assign name="l.settings:url" value="l.settings:urls:RGFT:secure" />
    <mvt:elseif expr="g.WishList">
    <mvt:assign name="l.settings:url" value="l.settings:urls:WISH:secure" />
    <mvt:else>
    <mvt:assign name="l.settings:url" value="g.domain:mm_surl" />
    </mvt:if>
    
    <mvt:assign name="l.settings:recapKey" value="crypto_base64_encode( 'yada_yada_yada_keycode' )" />
    
    <form method="post" action="&mvte:url;" id="js-acad-form" class="column whole acad-form" autocomplete="off">
    <input type="hidden" name="Store_Code" value="&mvte:global:Store_Code;" />
    <input type="hidden" name="Action" value="RECAP" />
    <input type="hidden" name="Screen" value="RECAP">
    <input type="hidden" name="Order" value="&mvte:global:Order;" />
    <input type="hidden" name="NewAccount" value="1" />
    <input type="hidden" name="Customer_Approval" value="pending" />
    <input type="hidden" name="recapSecretKey" value="&mvte:recapKey;">
    <div class="customer-fields">
    <mvt:item name="customer" />
    </div>
    <div class="row">
    <div class="column whole medium-nine-tenths align-right">
    <input type="submit" value="Save" class="button button-medium button-primary">
    <p><br>Once application is recieved, We will email you a link to a form that we need filled out. <br>Please complete this form and send it back to us so we can activate your account. Thanks for your patience.</p>
    </div>
    </div>
    </form>
    </div>

    These are the fields that are not passing any data on to the email

    Code:
    <div class="form_row">
    <label class="required" for="customer_business_type">Business Type:</label>
    <select name="customer_business_type" id="Business_Type" class="input" required onchange="leaveChange()">
    <option value="">&lt;Select One&gt;</option>
    <mvt:if expr="g.customer_business_type EQ 'Restaurant'">
    <option value="Restaurant" selected>Restaurant</option>
    <mvt:else>
    <option value="Restaurant">Restaurant</option>
    </mvt:if>
    <mvt:if expr="g.customer_business_type EQ 'Deli'">
    <option value="Deli" selected>Deli</option>
    <mvt:else>
    <option value="Deli">Deli</option>
    </mvt:if>
    <mvt:if expr="g.customer_business_type EQ 'Supermarket'">
    <option value="Supermarket" selected>Supermarket</option>
    <mvt:else>
    <option value="Supermarket">Supermarket</option>
    </mvt:if>
    <mvt:if expr="g.customer_business_type EQ 'Gift'">
    <option value="Gift" selected>Gift Store</option>
    <mvt:else>
    <option value="Gift">Gift Store</option>
    </mvt:if>
    <mvt:if expr="g.customer_business_type EQ 'Mail'">
    <option value="Mail" selected>Mail Order</option>
    <mvt:else>
    <option value="Mail">Mail Order</option>
    </mvt:if>
    <mvt:if expr="g.customer_business_type EQ 'Other'">
    <option value="Other" selected>Other</option>
    <mvt:else>
    <option value="Other">Other</option>
    </mvt:if>
    </select>
    </div>
    <mvt:if expr="g.customer_business_type EQ 'Other'">
    <mvt:assign name="l.settings:display_other_opt" value="''" />
    <mvt:else>
    <mvt:assign name="l.settings:display_other_opt" value="'hide'" />
    </mvt:if>
    <div class="form_row &mvt:display_other_opt;" id="customer_other_business_desc_field">
    <label class="required" for="customer_other_business_desc">Other:</label>
    <input type="text" name="customer_other_business_desc" id="customer_other_business_desc" value="&mvte:global:customer_other_business_desc;" class="textfield" />
    </div>
    <div class="form_row">
    <label class="required" for="customer_business_years">Years in business:</label>
    <select name="customer_business_years" id="Business_Type" class="input" required>
    <option value="">&lt;Select One&gt;</option>
    <mvt:if expr="g.customer_business_years EQ 'LessThan1'">
    <option value="LessThan1" selected>Less Than 1 Year</option>
    <mvt:else>
    <option value="LessThan1">Less Than 1 Year</option>
    </mvt:if>
    <mvt:if expr="g.customer_business_years EQ '1-2'">
    <option value="1-2" selected>1-2</option>
    <mvt:else>
    <option value="1-2">1-2</option>
    </mvt:if>
    <mvt:if expr="g.customer_business_years EQ '3-5'">
    <option value="3-5" selected>3-5</option>
    <mvt:else>
    <option value="3-5">3-5</option>
    </mvt:if>
    <mvt:if expr="g.customer_business_years EQ '6-10'">
    <option value="6-10" selected>6-10</option>
    <mvt:else>
    <option value="6-10">6-10</option>
    </mvt:if>
    <mvt:if expr="g.customer_business_years EQ 'Over10'">
    <option value="Over10" selected>Over 10</option>
    <mvt:else>
    <option value="Over10">Over 10</option>
    </mvt:if>
    </select>
    </div>
    <div class="form_row">
    <label class="required" for="customer_state_tax_id"> Tax ID #<br/>
    I certify that I am registered to collect sales tax in the 'Ship to' state. </label>
    <input type="text" name="customer_state_tax_id" id="customer_state_tax_id" value="&mvte:global:customer_state_tax_id;" class="textfield" required/>
    </div>
    <div class="form_row">
    <label class="required" for="customer_irish_food_check">Do you sell Irish / English Foods</label>
    <select name="customer_irish_food_check" id="customer_irish_food_check" class="input" required>
    <option value="">&lt;Select One&gt;</option>
    <mvt:if expr="g.customer_irish_food_check EQ 'Yes'">
    <option value="Yes" selected>Yes</option>
    <mvt:else>
    <option value="Yes">Yes</option>
    </mvt:if>
    <mvt:if expr="g.customer_irish_food_check EQ 'No'">
    <option value="No" selected>No</option>
    <mvt:else>
    <option value="No">No</option>
    </mvt:if>
    </select>
    </div>
    <div class="form_row">
    <label class="required" for="customer_business_desc">Brief Description of your business</label>
    <textarea name="customer_business_desc" id="customer_business_desc" class="textfield" rows="4" required>&mvte:global:customer_business_desc;</textarea>
    </div>

    Is the form created all wrong?

    Leave a comment:


  • lesliekirk
    replied
    I have an email template form that isn't passing any data on too. I'm going to post it (and maybe be able to debug it while I and others hopefully do).

    Code:
    <!-- BOF Custom Fields -->
    <div class="text-1" style="color:#7a838d; font-family:Arial, sans-serif; min-width:auto !important; font-size:16px; line-height:24px; text-align:left">
    <mvt:item name="customfields" param="Read_Customer_ID(l.settings:customer:id, 'customer_business_type', g.customer_business_type)" />
    <p>Business Type: &mvt:global:customer_business_type; </p>
    <mvt:item name="customfields" param="Read_Customer_ID(l.settings:customer:id, 'customer_business_years', g.customer_business_years)" />
    <p>Business Years: &mvt:global:customer_business_years;</p>
    <mvt:item name="customfields" param="Read_Customer_ID(l.settings:customer:id, 'customer_business_desc', g.customer_business_desc)" />
    <p>Business Description: &mvt:global:customer_business_desc;</p>
    <mvt:item name="customfields" param="Read_Customer_ID(g.customer:id, 'customer_other_business_desc', g.customer_other_business_desc)" />
    <p>Other Desc: &mvt:global:customer_other_business_desc; </p>
    <mvt:item name="customfields" param="Read_Customer_ID('l.settings:customer:id', 'customer_irish_food_check', g.customer_irish_food_check)" />
    <p>Sell Irish Foods: &mvt:global:customer_irish_food_check;</p>
    <mvt:item name="customfields" param="Read_Customer_ID(l.settings:customer:id, 'customer_website', g.customer_website)" />
    <p>Business Website: &mvt:global:customer_website;</p>
    <mvt:item name="customfields" param="Read_Customer_ID(l.settings:customer:id, 'customer_website_url', g.customer_website_url)" />
    <p>Business Website URL: &mvt:global:customer_website_url;</p>
    <mvt:item name="customfields" param="Read_Customer_ID(l.settings:customer:id, 'customer_storefront', g.customer_storefront)" />
    <p>Ecommerce Website: &mvt:global:customer_storefront;</p>
    <mvt:item name="customfields" param="Read_Customer_ID(l.settings:customer:id, 'customer_storefront_url', g.customer_storefront_url)" />
    <p>Ecommerce Website URL: &mvt:global:customer_storefront_url;</p>
    <p>&nbsp;</p>
    <mvt:item name="customfields" param="Read_Customer_ID(g.customer:id, 'customer_agree_to_terms', g.customer_agree_to_terms)" />
    <p>Agree to Terms: &mvt:global:customer_agree_to_terms;</p>
    <p><br>
    </p>
    <div class="text-footer-1" style="color:#303748; font-family:Arial, sans-serif; min-width:auto !important; font-size:16px; line-height:24px; text-align:left"><br>
    <mvt:item name="customfields" param="Read_Customer_ID(g.customer:id, 'customer_create_timestamp', g.customer_create_timestamp)" />
    Date Applied: &mvt:global:customer_create_timestamp;<br>
    </div>
    <br>
    </div>
    <!-- EOF Custom Fields -->
    Should I also post the code used to attempt to capture this data? (I'm thinking it might be needed to help determine what might be breaking down).

    Leave a comment:


  • Bruce - PhosphorMedia
    replied
    its coming...though we might need you to check for errors :)

    Leave a comment:


  • Bruce - PhosphorMedia
    replied
    yea, that's why i always look for the obvious three times. too many hours of typing mivascript

    Leave a comment:


  • Bruce - PhosphorMedia
    replied
    The obvious :) check if custom fields item is active, triple check the variable names and values

    I just tried

    <mvt:item name="customfields" param="Read_Customer_ID( g.customer:id, 'TaxExempt', g.taxExempt)" />

    and got the expected results on a site i'm working on.

    Leave a comment:


  • Bruce - PhosphorMedia
    replied
    here's how you debug;
    1) Go to your Customer Custom Field entry in custom fields and COPY the code (let copy/paste be your god).
    2) Place this above the Read code [ &mvt:global:customer:id; ]<br /> and see if it gets populated.
    3) Make sure the id of the customer (assume its you) has something in that field by looking for it under Menu | Customers

    Leave a comment:


  • Pat
    replied
    Thanks for the reply - tried that - no luck.

    Leave a comment:


  • Bruce - PhosphorMedia
    replied
    Try
    Code:
    <mvt:item name="customfields" param="Read_Customer_ID(g.customer:id, 'customer_business_type', g.customer_business_type)" />
    
    &mvt:global.customer_business_type;

    Leave a comment:


  • Pat
    replied
    Hi - I am trying the same thing in an email going to customer

    My Customer custom field code is customer_business_type

    I am expection &mvt:g.customData:customer_business_type; to display the data from the custom field - but alas is not.


    My code on the email is

    <mvt:item name="customfields" param="Read_Customer_ID( g.customer:id, customer_business_type, g.customData )" />

    &mvt:g.customData:customer_business_type;

    any help appreciated

    Leave a comment:


  • Bruce - PhosphorMedia
    replied
    Customer, Order, Category custom fields are not automatically stated in any templates that I know of. They all have to be called manually.

    However, simple to do if you've got access to the 'key' variable (i.e., customer_id, order_id, cat_id). Also, if you do this:

    Code:
     
     <mvt:item name="customfields" param="Read_Customer_ID( g.customer:id, '', g.customData )" />
    You'd get all custom fields based on their custom field codes. For example acquisition = g.customData:acquisition favColor = g.customData:favColo foodChoice = g.customData:foodChoice

    Leave a comment:


  • Problem Displaying a Custom Customer Field in a Template Based Email

    Hello,

    I have a custom field on my signup page and I'd like to include the value of that custom field in the Email that gets sent to me when a new customer signs up. However, I'm having a hard time figuring out how to display the custom field in the Template Based Email.

    Here's my code so far:

    On the ACAD Page I have a dropdown menu with the name of "acquisition":
    Code:
    How did you hear about us?
    <select name="acquisition">
         <option value="">Please Make a Selection</option>
         <option value="Email">Email</option>
         <option value="Web Search">Web Search</option>
         <option value="Referral">Referral</option>
    </select>
    On the Landing Page (after signing up) I store the custom field:
    Code:
    <mvt:if expr="g.Action EQ 'ICST' AND g.acquisition">
         <mvt:item name="customfields" param="Write_Customer_ID( g.Basket:cust_id, 'acquisition', g.acquisition )" />
    </mvt:if>
    The custom field is stored, and I can successfully display the value on the Landing Page using the following code:
    Code:
    <mvt:item name="customfields" param="Read_Customer_ID( g.Basket:cust_id, 'acquisition' )" />
    <p><strong>Acquisition:</strong> &mvt:customfields:acquisition;</p>
    However, when I use that same exact code to display the value within the Template Based Email, the value is blank.

    I have verified that the Custom Fields item is assigned to the Email Template.

    Can anyone shed any light on why this isn't working in the Email Template?

    Thanks!

    UPDATE:
    It appears that rather than using the Custom Field, I can simply use the global variable in the Email Template:
    Code:
    &mvt:global:acquisition;
    This should be enough to solve my issue.

    Maybe the Email Template doesn't have access to the Custom Fields?
    Or maybe the email is sent before the Custom Fields have been saved?
    If anyone has a definitive answer, I'd still love to hear it!

    Thanks!
    Last edited by allclear; 03-12-19, 01:25 PM.
Working...
X