Email "Receipt" help

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
Spira
Ensign (ENS)
Ensign (ENS)
Posts: 2
Joined: Wed Mar 23, 2011 2:32 pm

Email "Receipt" help

Post by Spira » Wed Mar 23, 2011 2:51 pm

Hello,

We're trying to customize our order confirmation email to display payments made and I'm trying to figure out how to get it to display gift certificates used to pay and the total. The default version includes the total without taking into account gift certificates.

How would this be incorporated? Is there a $order.Items.TotalPriceById that corresponds to Gift Certificates? Also Why doesn't $order.Items.TotalPriceById() incorporate the price post gift certificate? Is there a place to find the breakdown of what $order.Items.TotalPriceById has in the array?

Thank you.

User avatar
AbleMods
Master Yoda
Master Yoda
Posts: 5170
Joined: Wed Sep 26, 2007 5:47 am
Location: Fort Myers, Florida USA

Re: Email "Receipt" help

Post by AbleMods » Thu Mar 24, 2011 11:48 am

Gift certs are considered payments, so you would find them in $order.Payments

Since multiple payments are permitted per order, you'll have to do a for-each loop to work through the payments container.

TotalPricebyId is just a subroutine that totals up line items in the order by the OrderItemTypeId value. So .TotalPricebyId(3) would return the total for all line items with an OrderItemTypeId of 3. That way you can combine line items of a given type into single dollar amount.

To get it to do the math the way you want, you'll have to do the mathematics manually with nVelocity variables.

nVelocity isn't the easiest to read and the email templates can be a pain to modify :)
Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com

Spira
Ensign (ENS)
Ensign (ENS)
Posts: 2
Joined: Wed Mar 23, 2011 2:32 pm

Re: Email "Receipt" help

Post by Spira » Wed Apr 27, 2011 4:02 pm

I'm sorry this has taken me so long, but currently the loop that is in the emails is:

#foreach ( $payment in $payments )
$payment.PaymentMethodName
$payment.ReferenceNumber
#end

Now, this does show multiple types of payments, but NOT gift certificates. How would I edit this to get those in there? would I have to add a foreach along the lines of:

#foreach ( $payment in $order.Payments )
$payment.PaymentMethodName
$payment.ReferenceNumber
#end

If so, how well would this work in conjunction with the first loop? Also, I have no problem doing "manual" mathematics, but I would need to know a variable in order to reference it in response to do subtraction.

Also, most of them have their own id, such as subtotal is .TotalPriceById(0) and shipping and handling is .TotalPriceById(1, 2), is there no simular id for gift certificates? This seems very odd to me.

Thank you again.

Post Reply