Nvelocity assistance please

Store UI, layout, design, look and feel; Discussion on the customer facing pages of your online store. Cascading Style Sheets, Themes, Scriptlets, NVelocity and the components in the ConLib directory.
Post Reply
User avatar
troutlet
Lieutenant (LT)
Lieutenant (LT)
Posts: 77
Joined: Mon Sep 24, 2007 3:01 am
Location: USA
Contact:

Nvelocity assistance please

Post by troutlet » Thu Aug 13, 2009 9:16 am

I'm trying to place a list of order items within a new email template. Each item should be a link to the actual product page but I'm not clear on how to do the looping. Can anyone give me a hand with this?

Code: Select all

<p>
<!--Should be 1st product in order--><a href="${store.StoreUrl}Product3.aspx?ProductId=${product.ProductId}">$product.Name</a><br>
<!--Should be 2nd product in order--><a href="${store.StoreUrl}Product3.aspx?ProductId=${product.ProductId}">$product.Name</a><br>
</p>

mwolf
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 50
Joined: Mon Jul 02, 2007 9:37 pm
Location: Chicago, IL
Contact:

Re: Nvelocity assistance please

Post by mwolf » Thu Aug 13, 2009 1:34 pm

This is how it is done in the Customer Order Confirmation Email. You can probably use most of this code and I also added the link around the Product Name.

Code: Select all

<!-- Output Non-Shipping Items -->
#foreach($orderItem in $order.Items.FilterByShipmentAndSort())
#beforeall
<table class="Email">
<tr>
<th class="Email">Non-Shipping Items</th>
</tr>
</table>		
<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") || ($orderItem.OrderItemType == "Coupon") || ($orderItem.OrderItemType == "Discount"))
<tr>
<td class="Email" style="text-align: center;">
#if (($orderItem.OrderItemType == "Product"))
$orderItem.Sku
#elseif (($orderItem.OrderItemType == "Discount"))
DISCOUNT
#elseif (($orderItem.OrderItemType == "Coupon"))
COUPON
#end
</td>
<td class="Email">
<a href="${store.StoreUrl}Product3.aspx?ProductId=${orderItem.ProductId}">$orderItem.Name</a>
#if ($orderItem.VariantName.Length > 0)
($orderItem.VariantName)
#end
#foreach($orderItemInput in $orderItem.Inputs)
#if (!$orderItemInput.IsMerchantField)
<br /><b>$orderItemInput.Name:</b> $orderItemInput.InputValue
#end
#end
</td>
<td class="Email" style="text-align: right;">$orderItem.Price.ToString("ulc")</td>
<td class="Email" style="text-align: center;">$orderItem.Quantity</td>
<td class="Email" style="text-align: right;">$orderItem.ExtendedPrice.ToString("ulc")</td>
</tr>

User avatar
troutlet
Lieutenant (LT)
Lieutenant (LT)
Posts: 77
Joined: Mon Sep 24, 2007 3:01 am
Location: USA
Contact:

Re: Nvelocity assistance please

Post by troutlet » Thu Aug 13, 2009 2:48 pm

Thanks, with that I was able to get it done.

Post Reply