Inford Posted September 11, 2015 Share Posted September 11, 2015 (edited) Please help me anyone to convert invoice total amount into words. convert amount number to words, number to word conversion, prestashop invoice amount convertion from number to words Edited September 11, 2015 by Inford (see edit history) Link to comment Share on other sites More sharing options...
Inford Posted September 11, 2015 Author Share Posted September 11, 2015 Please help me anyone to convert invoice total amount into words. convert amount number to words, number to word conversion, prestashop invoice amount convertion from number to words Please help me as soon as possible... Thank's Link to comment Share on other sites More sharing options...
tuk66 Posted September 14, 2015 Share Posted September 14, 2015 Look at http://www.presta-addons.com/pdf/Postal%20order%20-%20Slovakia.pdf The word tridsaťpäťtisíctristošesťdesiatšesť is the total amount in words. The M4 PDF Extensions module contains the number-word conversion functions for Czech and Slovak language and there is no problem to add another ones. 1 Link to comment Share on other sites More sharing options...
Inford Posted September 15, 2015 Author Share Posted September 15, 2015 Thank's for this reply ! But i want to convert amount in words (alphabets) in English not to other language. so please give me suggestion for converting numeric amount in words. e.g., 456 convert to Four Hundred Fifty Six Only. Link to comment Share on other sites More sharing options...
tuk66 Posted September 15, 2015 Share Posted September 15, 2015 Try https://github.com/pear/Numbers_Words http://www.karlrixon.co.uk/writing/convert-numbers-to-words-with-php/ Link to comment Share on other sites More sharing options...
Inford Posted September 15, 2015 Author Share Posted September 15, 2015 hello sir ! please reply me that how to add my php converter code i.e., <?php function convert_number_to_words($number) { $hyphen = '-'; $conjunction = ' and '; $separator = ', '; $negative = 'negative '; $decimal = ' point '; $dictionary = array( 0 => 'Zero', 1 => 'One', 2 => 'Two', 3 => 'Three', 4 => 'Four', 5 => 'Five', 6 => 'Six', 7 => 'Seven', 8 => 'Eight', 9 => 'Nine', 10 => 'Ten', 11 => 'Eleven', 12 => 'Twelve', 13 => 'Thirteen', 14 => 'Fourteen', 15 => 'Fifteen', 16 => 'Sixteen', 17 => 'Seventeen', 18 => 'Eighteen', 19 => 'Nineteen', 20 => 'Twenty', 30 => 'Thirty', 40 => 'Fourty', 50 => 'Fifty', 60 => 'Sixty', 70 => 'Seventy', 80 => 'Eighty', 90 => 'Ninety', 100 => 'Hundred', 1000 => 'Thousand', 1000000 => 'Million', 1000000000 => 'Billion', 1000000000000 => 'Trillion', 1000000000000000 => 'Quadrillion', 1000000000000000000 => 'Quintillion' ); if (!is_numeric($number)) { return false; } if (($number >= 0 && (int) $number < 0) || (int) $number < 0 - PHP_INT_MAX) { // overflow trigger_error( 'convert_number_to_words only accepts numbers between -' . PHP_INT_MAX . ' and ' . PHP_INT_MAX, E_USER_WARNING ); return false; } if ($number < 0) { return $negative . convert_number_to_words(abs($number)); } $string = $fraction = null; if (strpos($number, '.') !== false) { list($number, $fraction) = explode('.', $number); } switch (true) { case $number < 21: $string = $dictionary[$number]; break; case $number < 100: $tens = ((int) ($number / 10)) * 10; $units = $number % 10; $string = $dictionary[$tens]; if ($units) { $string .= $hyphen . $dictionary[$units]; } break; case $number < 1000: $hundreds = $number / 100; $remainder = $number % 100; $string = $dictionary[$hundreds] . ' ' . $dictionary[100]; if ($remainder) { $string .= $conjunction . convert_number_to_words($remainder); } break; default: $baseUnit = pow(1000, floor(log($number, 1000))); $numBaseUnits = (int) ($number / $baseUnit); $remainder = $number % $baseUnit; $string = convert_number_to_words($numBaseUnits) . ' ' . $dictionary[$baseUnit]; if ($remainder) { $string .= $remainder < 100 ? $conjunction : $separator; $string .= convert_number_to_words($remainder); } break; } if (null !== $fraction && is_numeric($fraction)) { $string .= $decimal; $words = array(); foreach (str_split((string) $fraction) as $number) { $words[] = $dictionary[$number]; } $string .= implode(' ', $words); } return $string; } ?> ================== how to add this php file into my invoice.tpl file and how to get total amount output into this function. Link to comment Share on other sites More sharing options...
Inford Posted September 16, 2015 Author Share Posted September 16, 2015 hello everyone ! i have face this error when login our admin panel on prestashop.. You are currently connected under the following domain name domain.comThis is different from the domain name set in the "SEO & URLs" tab. If this is your main domain, please change it now. i have check every where in setting and seo & urls tab. but no solution were found. Link to comment Share on other sites More sharing options...
tuk66 Posted September 21, 2015 Share Posted September 21, 2015 1. This question isn't related to this thread. You should create a new one. 2. What is your domain name and what is set in the "SEO & URLs" tab? Link to comment Share on other sites More sharing options...
[email protected] Posted July 25, 2016 Share Posted July 25, 2016 Hi presta team, I want to convert total amount in words in invoice. help me please its urgent...!!!!! Thanks & Regards, Nitin Link to comment Share on other sites More sharing options...
tuk66 Posted July 28, 2016 Share Posted July 28, 2016 It is not so easy. I did it for two languages for the M4 PDF Extensions module and several functions had to be used to manage "number to words" translation. Link to comment Share on other sites More sharing options...
[email protected] Posted July 28, 2016 Share Posted July 28, 2016 thanx Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now