Displaying Merchant Fields in Order Email with nVelocity

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
AlphaMeasure
Ensign (ENS)
Ensign (ENS)
Posts: 1
Joined: Tue Apr 08, 2008 3:14 pm

Displaying Merchant Fields in Order Email with nVelocity

Post by AlphaMeasure » Tue Apr 08, 2008 3:26 pm

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

User avatar
sohaib
Developer
Developer
Posts: 1079
Joined: Fri Jan 23, 2004 1:38 am

Re: Displaying Merchant Fields in Order Email with nVelocity

Post by sohaib » Wed Apr 09, 2008 11:37 am

It should have worked. I will have a look at this in detail and see why it is not working.

User avatar
Logan Rhodehamel
Developer
Developer
Posts: 4116
Joined: Wed Dec 10, 2003 5:26 pm

Re: Displaying Merchant Fields in Order Email with nVelocity

Post by Logan Rhodehamel » Wed Apr 09, 2008 11:53 am

sohaib wrote:It should have worked. I will have a look at this in detail and see why it is not working.
I am wondering if we do not copy over merchant fields during the checkout process?
Cheers,
Logan
Image.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.

User avatar
sohaib
Developer
Developer
Posts: 1079
Joined: Fri Jan 23, 2004 1:38 am

Re: Displaying Merchant Fields in Order Email with nVelocity

Post by sohaib » Thu Apr 10, 2008 12:12 pm

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.

User avatar
sohaib
Developer
Developer
Posts: 1079
Joined: Fri Jan 23, 2004 1:38 am

Re: Displaying Merchant Fields in Order Email with nVelocity

Post by sohaib » Thu Apr 10, 2008 1:05 pm

A bug has been entered in bugzilla. Merchant fields are not getting copied over properly.

User avatar
Logan Rhodehamel
Developer
Developer
Posts: 4116
Joined: Wed Dec 10, 2003 5:26 pm

Re: Displaying Merchant Fields in Order Email with nVelocity

Post by Logan Rhodehamel » Mon Aug 31, 2009 2:15 pm

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
Cheers,
Logan
Image.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.

Post Reply