1

We can get the Grand total using : $order->getGrandTotal()

but i want grand total in words means if grand total is 499 , then i need to display : Four hundred and Fourty nine only

  • where you want to display this? – Dhiren Vasoya Nov 27 '17 at 12:11
  • @DhirenVasoya i want in custom pdf..... – Baby in Magento Nov 27 '17 at 12:11
  • 4
    I'm voting to close this question as off-topic because this is not really related to magento. – sv3n Mar 1 '18 at 19:44
1

There is no Magento way to convert this

But you can create function and get text by this example

Follow example

https://stackoverflow.com/questions/14314997/is-there-a-way-in-php-to-convert-numbers-to-their-written-version

| improve this answer | |
  • how i can make font size bigger and bold in this code result : $page->drawText('PIN CODE : '.$shippingAddress->getPostcode() , 20, $page->getHeight()-360); ? – Baby in Magento Nov 29 '17 at 11:25
  • play with this code $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_TIMES); $style->setFont($font,12); $page->setStyle($style); – Murtuza Zabuawala Nov 29 '17 at 11:26
  • thanks, but that will increase font size of entire pdf content right? but i want to increase and make bold for only some content in pdf..... – Baby in Magento Nov 29 '17 at 11:28
  • set this code before that content and again reset this code after that line , try out that way I haven't try this – Murtuza Zabuawala Nov 29 '17 at 11:29
  • @BabyinMagento You are always welcome :) – Murtuza Zabuawala Nov 29 '17 at 12:16
1

Try to use an third part for do this using composer

php composer.phar update kwn/number-to-words

https://packagist.org/packages/kwn/number-to-words

| improve this answer | |
1

Using this link

I need this :

$f = new NumberFormatter("en", NumberFormatter::SPELLOUT);
echo $f->format($order->getGrandTotal())
| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.