Jump to content

Order amount in cents


Recommended Posts

Hey Guys,

I want to send an email to my customers after payment. Only problem is, I need to note the price in 'cents'
So lets say Customer A has an order for 98 Euros.

Normally you can use this in an email template: {total_paid} and it will say 98 euros.

But now I have to descrive the amount as 9800 cents. Any Ideas on how to do it? Since you can't make calculations in HTML I don't think its possible to use something like {total_paid}*100

So I think the solution is to make a new function that is posted when order is finished. After an order a new value will be stored, for example {total_paid_cent}.

Any help on how to do this?

Link to comment
Share on other sites

I think you can add new variable in the email template, like total_in_cents.

but you have to assign this variable the related PHP file that send the email.
For example, for order confirmation email, you need to change /classes/PaymentModule.php, ValidateOrder() function.

add new variable as following

After line

   '{total_paid}' => Tools::displayPrice($order->total_paid, $currency, false, false),



add following line

   '{total_paid_in_cents}' => 100*Tools::displayPrice($order->total_paid, $currency, false, false),



then, in your mail template, use the new variable

{total_paid_in_cents}

Link to comment
Share on other sites

if you did it correctly, if should work,
please make sure you have change the write mail templates.

for standard mail templates, it locates in
YourSiteRoot/mails/

for mail templates for mail allert module it locates in its module folder
YourSiteRoot/modules/mailalerts/mails/

Link to comment
Share on other sites

×
×
  • Create New...