Sum by words in template

Hello,
missing how to make $amount sum convertion to text in invoice template?

Any help please.

Hi,

I don’t believe it’s currently supported.

I realize that this feature is not out of box, but how can I use external js or php code direct in the template editing mode and handle with $amount for get right output?

Or even better solution with Numbers_Words
How to use it with $amount or how to modify the backend code?

@david is this possible?

@LaBaSuS

You could update HTMLEngine.php with the following.

you would need the php intl extension installed for this to work.

$data['$amount_in_words'] = ['value' => (new \NumberFormatter($this->client->locale(), \NumberFormatter::SPELLOUT))->format($this->entity->amount), 'label' => ''];
$data['$balance_in_words'] = ['value' => (new \NumberFormatter($this->client->locale(), \NumberFormatter::SPELLOUT))->format($this->entity->balance), 'label' => ''];

The text is localized to the client locale

Hi @david ,

great solution - almost done, but the result a little bit with confusing format to me…:frowning:

$amount_in_words - shows the text with comma like a text and doesn’t pay attention for Currencies is it Eur and cents.

Example $amount = 11,50
$amount_in_words = Eleven comma five
must be smth like = Eleven Eur fifty ct.

+1000 karma point to you

@LaBaSuS

I think that is the closest I was able to get for this using native PHP.