Page 1 of 1

Email "Receipt" help

Posted: Wed Mar 23, 2011 2:51 pm
by Spira
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.

Re: Email "Receipt" help

Posted: Thu Mar 24, 2011 11:48 am
by AbleMods
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 :)

Re: Email "Receipt" help

Posted: Wed Apr 27, 2011 4:02 pm
by Spira
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.