Abandoned Basket Email Needs Product.Summary
Abandoned Basket Email Needs Product.Summary
I'm trying to edit the Abandoned Basket Email to show Product Summary instead of Name or Sku. How do I do this?
I've got example code to add Summary into Packing List but I'm not for sure where to add code for Abandoned Basket Email to pull from. Do I need to add code to BasketItemDetail.ascx.cs before pulling it into the email template?
Thanks,
Scott
I've got example code to add Summary into Packing List but I'm not for sure where to add code for Abandoned Basket Email to pull from. Do I need to add code to BasketItemDetail.ascx.cs before pulling it into the email template?
Thanks,
Scott
Re: Abandoned Basket Email Needs Product.Summary
You need to do it in NVelocity. I think something like this will work for you
This code will print basket item information plus product summary.
Code: Select all
#foreach($basketItem in $basket.Items)
#if ($basketItem.OrderItemType == "Product")
<tr>
<td style="text-align:center;">$basketItem.Sku</td>
<td><b>$basketItem.Name</b></td>
<td>$basketItem.Quantity</td>
<td>$basketItem.Price.ToString("ulc")</td>
<td>
#if ($basketItem.Product != null)
$basketItem.Product.Summary
#end
</td>
</tr>
#end
#end
Re: Abandoned Basket Email Needs Product.Summary
Thanks for the help Mazhar I'll give it a try
Scott
Scott
Re: Abandoned Basket Email Needs Product.Summary
I've got the Product.Summary to print out right now but if there are coupons or taxes or shipping it doesn't list the correct info for the description, see below. Is there and if then statement to put if it doesn't have a summary description to put name? I tried just putting Product.Summary instead of Name but now I can't go view any results because I get an error when trying to view the email. When I press the "SEND ALERT" button I get this error "We are sorry, but the page you are trying to access has experienced an error.
Please contact Sales@DccCrafts.com to report this problem."
SKU Description Quantity Price
03-1596 03-1596 Tin Glass Candle Holder Butterfly w/Candle 6.25" (Each) 1 $6.99
24-8110 24-8110 Weathervane Bunny Candle/ Pot Holder Wood & Rusty Tin 20" (Each) 1 $34.99
1 $basketItem.Product.Summary 1 $1.28
20 $basketItem.Product.Summary 1 -$3.50
21 $basketItem.Product.Summary 1 -$20.99
$basketItem.Product.Summary 1 $6.95
Please contact Sales@DccCrafts.com to report this problem."
SKU Description Quantity Price
03-1596 03-1596 Tin Glass Candle Holder Butterfly w/Candle 6.25" (Each) 1 $6.99
24-8110 24-8110 Weathervane Bunny Candle/ Pot Holder Wood & Rusty Tin 20" (Each) 1 $34.99
1 $basketItem.Product.Summary 1 $1.28
20 $basketItem.Product.Summary 1 -$3.50
21 $basketItem.Product.Summary 1 -$20.99
$basketItem.Product.Summary 1 $6.95
Re: Abandoned Basket Email Needs Product.Summary
Mazhar, the code up above didn't work. It caused an error. Did you try that in a copy of Abandoned Baskets Email Template? I took out Sku in the first column td/ since we have sku in our Summary text. See the picture below for my problem. Do you know how to fix the $basketItem.Product.Summary problem in the last 4 lines. (Tax, Discount, Coupon, Shipping)

Thanks,
Scott

Thanks,
Scott
Re: Abandoned Basket Email Needs Product.Summary
EDIT
Well basket item could be of different types. basketItem.Product will only work for items of type product. Try something like this
Well basket item could be of different types. basketItem.Product will only work for items of type product. Try something like this
Code: Select all
#if ($basketItem.OrderItemType == "Product" && $basketItem.Product != null)
$basketItem.Product.Summary
#else
$basketItem.Name
#end
Re: Abandoned Basket Email Needs Product.Summary
No I replace that code inside my <td> </td> in NVelocity and it doesn't work. Causes an error. This is how I added it. Is their some other syntax problem?
Code: Select all
#foreach($basketItem in $basket.Items)
<tr>
<td><b> #if ($basketItem.OrderItemType == "Product" && $basketItem.OrderItemType != null)
$basketItem.Product.Summary
#else
$basketItem.Name
#end</b></td>
<td style="text-align: center;">$basketItem.Quantity</td>
<td style="text-align: right;">$basketItem.Price.ToString("ulc")</td>
</tr>
#end
Re: Abandoned Basket Email Needs Product.Summary
Yes there is an issue. Seems like I made that mistake. Try following code
Actually the statement saying $basketItem.OrderItemType != null was wrong. It was suppose to be $basketItem.Product != null
Code: Select all
#foreach($basketItem in $basket.Items)
<tr>
<td><b> #if ($basketItem.OrderItemType == "Product" && $basketItem.Product != null)
$basketItem.Product.Summary
#else
$basketItem.Name
#end</b></td>
<td style="text-align: center;">$basketItem.Quantity</td>
<td style="text-align: right;">$basketItem.Price.ToString("ulc")</td>
</tr>
#end
Re: Abandoned Basket Email Needs Product.Summary
Nope, still doesn't work. Any Ideas?
Re: Abandoned Basket Email Needs Product.Summary
I figured there would be an easy solution for adding Summary for products but keeping Name for other items. Just wondering if anybody else has any ideas?
Thanks,
Scott
Thanks,
Scott
Re: Abandoned Basket Email Needs Product.Summary
OK I made a mistake in last code. The product null check was not correct. Following code seems functional on my local install
Code: Select all
#if ($basketItem.OrderItemType == "Product" && $basketItem.Product != "")
$basketItem.Product.Summary
#else
$basketItem.Name
#end
Re: Abandoned Basket Email Needs Product.Summary
Excellent!!! Thanks Mazhar!!!
Do you look through other C# code in able for examples of these #if #else statements for your ideas on how to do stuff. Just trying to get an idea how to go about solving these problems on my own in the future?
Do you look through other C# code in able for examples of these #if #else statements for your ideas on how to do stuff. Just trying to get an idea how to go about solving these problems on my own in the future?