Abandoned Basket Email Needs Product.Summary

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
scooter85
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 50
Joined: Wed Apr 15, 2009 2:41 pm

Abandoned Basket Email Needs Product.Summary

Post by scooter85 » Tue May 24, 2011 8:42 am

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

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Abandoned Basket Email Needs Product.Summary

Post by mazhar » Tue May 24, 2011 9:13 am

You need to do it in NVelocity. I think something like this will work for you

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
This code will print basket item information plus product summary.

scooter85
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 50
Joined: Wed Apr 15, 2009 2:41 pm

Re: Abandoned Basket Email Needs Product.Summary

Post by scooter85 » Tue May 24, 2011 9:16 am

Thanks for the help Mazhar I'll give it a try
Scott

scooter85
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 50
Joined: Wed Apr 15, 2009 2:41 pm

Re: Abandoned Basket Email Needs Product.Summary

Post by scooter85 » Tue May 24, 2011 9:43 am

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

scooter85
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 50
Joined: Wed Apr 15, 2009 2:41 pm

Re: Abandoned Basket Email Needs Product.Summary

Post by scooter85 » Tue May 24, 2011 1:04 pm

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)

Image

Thanks,
Scott

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Abandoned Basket Email Needs Product.Summary

Post by mazhar » Wed May 25, 2011 3:23 am

EDIT

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

scooter85
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 50
Joined: Wed Apr 15, 2009 2:41 pm

Re: Abandoned Basket Email Needs Product.Summary

Post by scooter85 » Wed May 25, 2011 7:05 am

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

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Abandoned Basket Email Needs Product.Summary

Post by mazhar » Wed May 25, 2011 8:12 am

Yes there is an issue. Seems like I made that mistake. Try following code

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
Actually the statement saying $basketItem.OrderItemType != null was wrong. It was suppose to be $basketItem.Product != null

scooter85
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 50
Joined: Wed Apr 15, 2009 2:41 pm

Re: Abandoned Basket Email Needs Product.Summary

Post by scooter85 » Wed May 25, 2011 8:34 am

Nope, still doesn't work. Any Ideas?

scooter85
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 50
Joined: Wed Apr 15, 2009 2:41 pm

Re: Abandoned Basket Email Needs Product.Summary

Post by scooter85 » Thu May 26, 2011 2:38 pm

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

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Abandoned Basket Email Needs Product.Summary

Post by mazhar » Fri May 27, 2011 5:02 am

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

scooter85
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 50
Joined: Wed Apr 15, 2009 2:41 pm

Re: Abandoned Basket Email Needs Product.Summary

Post by scooter85 » Fri May 27, 2011 6:49 am

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?

Post Reply