Dynamically Printing the Currency Symbol Depending on the Total

When using the Standard Advanced PDF/HTML Template the currency will always print the US Dollar sign. applying this changes will print the correct symbol of the currency on the total.

Solution

  • Navigate to Customization Forms Advanced PDF/HTML Template
  • Click Edit beside the Preferred Customer Payment PDF/HTML Template
  • Top Right Corner: Toggle Source Code
  • Add the code below:
<#assign currencySymbol = {"USD":"$", "EUR":"€", "GBP":"£", "AUD":"$", "LKR","Rs"}>
<#assign currentCurrency = record.currency.symbol?string>
${currencySymbol[currentCurrency]} ${record.total?string?replace('[^\\.,0-9]','','r')}
  • Click Save

Leave a comment

Your email address will not be published. Required fields are marked *