Jump to content

How to change WHMCS Price Decimal Separator?


eArmin

Recommended Posts

I want to use another character instead of a dot or comma ("." & ",") in WHMCS, especially in invoices PDFs. Currencies' settings just allow you to choose from 4 predefined formats that are not what I need. Could someone please tell me how to change this character? please also tell me the file names that should be edited, not only a line of code that I don't know where should I insert it.

 

Thank you

Link to comment
Share on other sites

  • 2 years later...
14 minutes ago, brian! said:

from what to what? and where ??

div class="price"><span>{$product.pricing.minprice.price} {$LANG.orderpaymenttermonetime}</span></div>
						{else}
						<div class="package-starting-from ">{$LANG.startingat}</div>
						<div class="price"> {if $product.pricing.rawpricing.triennially neq -1}<span>{$currency.prefix}{($product.pricing.rawpricing.triennially/36)|string_format:"%.2f"}{$currency.suffix}</span>/mo
							{elseif $product.pricing.rawpricing.biennially neq -1}<span>{$currency.prefix}{($product.pricing.rawpricing.biennially/24)|string_format:"%.2f"}{$currency.suffix}</span>/mo
							{elseif $product.pricing.rawpricing.annually neq -1}<span>{$currency.prefix}{($product.pricing.rawpricing.annually/12)|string_format:"%.2f"}{$currency.suffix}</span>/mo
							{else}{$product.pricing.minprice.cycleText}
							{/if} </div>

Hi Brian,

Lagom support said this:

"Your customization format the price with "dot", as you are using rawrpice value, which WHMCS format always with "dot".
Please fix your customization, to handle the WHMCS currency setting."

How can I change the 'rawpricing' thing?

Thanks

Link to comment
Share on other sites

Hi @isixhosting

1 hour ago, isixhosting said:

How can I change the 'rawpricing' thing?

I would suggest switching from using string_format to number_format - that allows you to easily specify decimal and thousand separator characters in the output...

<div class="price">
	{if $product.pricing.rawpricing.triennially neq -1}<span>{$currency.prefix}{($product.pricing.rawpricing.triennially/36)|number_format:2:',':'.'}{$currency.suffix}</span>/mo
	{elseif $product.pricing.rawpricing.biennially neq -1}<span>{$currency.prefix}{($product.pricing.rawpricing.biennially/24)|number_format:2:',':'.'}{$currency.suffix}</span>/mo
	{elseif $product.pricing.rawpricing.annually neq -1}<span>{$currency.prefix}{($product.pricing.rawpricing.annually/12)|number_format:2:',':'.'}{$currency.suffix}</span>/mo
	{else}{$product.pricing.minprice.cycleText}
	{/if}
</div>

9ne6PUi.png

in the above example, the number is being formatted to 2 decimal places, decimal separated using a comma (,) and thousand separated using a full stop (.) - though I would imagine if you're dividing prices by at least 12, you won't really need to define the thousands separator. 🙂

Edited by brian!
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated