Displaying order subtotal

I am using the $order_info.subtotal variable to display the total in the subject line of order emails. This works fine except when the subtotal ends in a 0. For instance…



$7.90 becomes $7.9

$5.00 becomes $5



Does anyone know what I need to do to get this to go out 2 decimal places when there is a zero?

Example:


Your order {$order_info.order_id} in the amount of ${$order_info.subtotal|fn_format_price}




Should do the trick. Sends the value of order_info.subtotal as the first arguement to fn_format_price() which should force it to 2 decimal places.

I changed the code as suggested but it’s still dropping the zeros. ???

Hmm… It should return NN.nn… You did clear your cache, right?

I’m pretty sure I have more than once, but I just did so we’ll see what happens.

I’ve gotten two more since… $0 and $11.8 instead of $0.00 and $11.80



This is what I have in order_notification_subj.tpl



{$lang.order} #{$order_info.order_id} (${$order_info.subtotal|fn_format_price})

That should work… Sorry, that’s all I know.

You could stick a very small font line at the bottom to make sure you’re messing with the right template.

Yeah, it’s the correct template. I changed the subject lines a couple of days ago and added the subtotal so I could better keep track of sales. However, my concern is that since it goes to customers too it looks unprofessional.

[quote name=‘ogia’]Yeah, it’s the correct template. I changed the subject lines a couple of days ago and added the subtotal so I could better keep track of sales. However, my concern is that since it goes to customers too it looks unprofessional.[/QUOTE]



You can try this:

{include file="common_templates/price.tpl" value=$$order_info.subtotal}

[quote name=‘cscartrocks’]You can try this:

{include file="common_templates/price.tpl" value=$$order_info.subtotal}[/QUOTE]



IT WORKS!! :smiley:



Thanks for all the help!

[quote name=‘ogia’]IT WORKS!! :smiley:



Thanks for all the help![/QUOTE]

You’re welcome. :slight_smile:

I spoke too soon… I had tested it on a free order and got $0.00. It turns out it is now showing $0.00 for EVERY order!



I guess I’ll go back to no total. Having that in the order notification subject line was something I had in my other carts and I missed it.

That would imply that there is no $order_info.subtotal value in the view’s template variables. Suggest you add a {debug} and see what is actually being passed in.

In order summary products shows dual currency but total, shipping and other things under the "table" does not show dual currency. Any Idea?