I need to have each product's Merchant Fields listed when the order email is sent. The pre-loaded email templates look like they already provide this functionality, but it also doesn't seem to work. The product in question is linked to a Product Template that has 10 merchant fields. These Merchant fields all have data for the product being ordered, but they aren't coming through in the email.
Thanks,
Josh
Here is a snippet of the nVelocity code I'm using:
<table class="Email">
<tr>
<td style="background:#cccccc; color:#00000; text-align: center;"><strong>SKU</strong></td>
<td style="background:#cccccc; color:#00000; text-align: center;"><strong>Name</strong></td>
<td style="background:#cccccc; color:#00000; text-align: center;"><strong>Price</strong></td>
<td style="background:#cccccc; color:#00000; text-align: center;"><strong>Quantity</strong></td>
<td style="background:#cccccc; color:#00000; text-align: center;"><strong>Total</strong></td>
</tr>
#each
#if (($orderItem.OrderItemType == "Product"))
<tr>
<td class="Email" style="text-align: center;">$orderItem.Sku</td>
<td class="Email">
$orderItem.Name
#if ($orderItem.VariantName.Length > 0)
($orderItem.VariantName)
#end
#########################
# First Attempt to List Merchant Fields
#########################
#foreach($orderItemInput in $orderItem.Inputs)
<br /><b>$orderItemInput.Name:</b> $orderItemInput.InputValue
#end
#########################
# Second Attempt to List Merchant Fields
#########################
#foreach($tf in $orderItem.TemplateFields)
#if ($tf.InputField.IsMerchantField)
${tf.InputField.Name}: $tf.InputValue<br>
#else
Not Merchant Field
#end
#end
</td>
<td class="Email" style="text-align: right;">$orderItem.Price.ToString("C")</td>
<td class="Email" style="text-align: center;">$orderItem.Quantity</td>
<td class="Email" style="text-align: right;">$orderItem.ExtendedPrice.ToString("C")</td>
</tr>
#end
#afterall
</table>
#end
Displaying Merchant Fields in Order Email with nVelocity
-
- Ensign (ENS)
- Posts: 1
- Joined: Tue Apr 08, 2008 3:14 pm
Re: Displaying Merchant Fields in Order Email with nVelocity
It should have worked. I will have a look at this in detail and see why it is not working.
- Logan Rhodehamel
- Developer
- Posts: 4116
- Joined: Wed Dec 10, 2003 5:26 pm
Re: Displaying Merchant Fields in Order Email with nVelocity
I am wondering if we do not copy over merchant fields during the checkout process?sohaib wrote:It should have worked. I will have a look at this in detail and see why it is not working.
Cheers,
Logan
.com
If I do not respond to an unsolicited private message, it's not because I'm ignoring you. It's because the answer to your question is valuable to others. Try the new topic button.
Logan

If I do not respond to an unsolicited private message, it's not because I'm ignoring you. It's because the answer to your question is valuable to others. Try the new topic button.
Re: Displaying Merchant Fields in Order Email with nVelocity
The checkout code is copying over the merchant fields but somehow they are not associated to the order item objects.
This is currently under investigation. Naveed is on it.
This is currently under investigation. Naveed is on it.
Re: Displaying Merchant Fields in Order Email with nVelocity
A bug has been entered in bugzilla. Merchant fields are not getting copied over properly.
- Logan Rhodehamel
- Developer
- Posts: 4116
- Joined: Wed Dec 10, 2003 5:26 pm
Re: Displaying Merchant Fields in Order Email with nVelocity
We all got a little confused on this one. The bug was entered and we "fixed" the problem, but actually the fix is not the right approach. Merchant based input fields should not be copied with the order data because they are not specific to the order. Merchant based fields are specific to the product. The correct nVelocity text would be:
#########################
# Corrected Syntax to List Merchant Fields
#########################
#foreach($fieldValue in $orderItem.Product.TemplateFields)
#set ($field = $fieldValue.InputField)
#if ($field.IsMerchantField)
<br /><b>$field.UserPrompt:</b> $fieldValue.InputValue
#end
#end
#########################
# Corrected Syntax to List Merchant Fields
#########################
#foreach($fieldValue in $orderItem.Product.TemplateFields)
#set ($field = $fieldValue.InputField)
#if ($field.IsMerchantField)
<br /><b>$field.UserPrompt:</b> $fieldValue.InputValue
#end
#end
Cheers,
Logan
.com
If I do not respond to an unsolicited private message, it's not because I'm ignoring you. It's because the answer to your question is valuable to others. Try the new topic button.
Logan

If I do not respond to an unsolicited private message, it's not because I'm ignoring you. It's because the answer to your question is valuable to others. Try the new topic button.