Position currency symbol and decimal (. e ,)

Questions and answers about change of functions, design, hosting etc.

Moderators: Koduc, Xpycm

Forum rules
Pay attention! Forum is not a means for guaranteed support of clients and users. An answer as well as a quick answer is not supposed on the forum. We post messages as soon as possible.

The message limit on the forum is 3 messages per day.
If you want to say "thank you" then use the function "Give good reputation point", which is a green icon "plus" under the nickname of the person, who answered the message.

Position currency symbol and decimal (. e ,)

Postby qaona » 09 Jun 2013, 06:58

Where change the position of the currency symbol, from right to left of the value. Example; $ 185,000 to $ 185,000
Where and how to set up thousands and decimal values ​​so the value looks like this: $ 185. 500.50 (one hundred eighty-five thousand, five hundred dollars and fifty cents)
thank you
qaona
Stranger
 
Posts: 24
Joined: 06 Jun 2013, 05:10
Reputation point: 0

Re: Position currency symbol and decimal (. e ,)

Postby Xpycm » 10 Jun 2013, 07:04

Dashboard->Settings->Listings: Decimals point to price and Separator in price to thousandths - https://www.dropbox.com/s/5ixj2p5do4akt ... 170030.png

Or
open protected\modules\apartments\models\Apartment.php file and overwrite public static function priceFormat:
Code: Select all
public static function priceFormat($price) {
    if (
is_numeric($price)) {
        
$priceDecimalsPoint = (param('priceDecimalsPoint')) ? param('priceDecimalsPoint') : ' ';
        
$priceThousandsSeparator = (param('priceThousandsSeparator')) ? param('priceThousandsSeparator') : ' ';

        return 
number_format($price0$priceDecimalsPoint$priceThousandsSeparator);
    }

    return 
$price;


http://php.net/manual/en/function.number-format.php
Dropbox
Open Real Estate CMS: FAQ | FAQ 2 | FAQ 3
Image
Xpycm
Web Developer
Web Developer
 
Posts: 281
Joined: 30 Dec 2011, 11:06
Reputation point: 2

Re: Position currency symbol and decimal (. e ,)

Postby qaona » 11 Jun 2013, 03:48

Unfortunately I could not 100% result. I tried several changes in the configuration. The most we got was £ 600,000. But for me, it would be correct R $ 600,000.00. The currency should be before the value. And with "," (comma) followed by two (00).
I tried changing Apartment.php code example using the link php, example below in bold:
Exemplo: Example:

<?php
$number = 1234567.896;
echo '1: '.number_format($number, 2, ',', '').'<br>';
echo '2: '.number_format($number, 2, '.', '').'<br>';
echo '3: '.number_format($number, 2, ',', '.').'<br>';
echo '4: '.number_format($number, 2, '.', ',').'<br>';
echo '5: '.number_format($number, 2, ',', ' ').'<br>';
echo '6: '.number_format($number, 2, ',', "'").'<br>';
echo '7: '.number_format($number, 2, '', '').'<br>';
?>
Resultado: Result:
1: 1234567,90 -> Decimal separado por ,
2: 1234567.90 -> Decimal separado por .
3: 1.234.567,90 -> Moeda Brasil, Alemanha
4: 1,234,567.90 -> Inglês, USA
5: 1 234 567,90 -> França
6: 1'234'567,90 -> Suíça
7: 123456790 -> Sem decimal

But it gave error, and gave up. I am unable to configure my taste. [url]see image http://meuimovel.webtb.com.br/imag/sepa ... codigo.jpg[/url]
My setup is like the images links.
Image
Image
qaona
Stranger
 
Posts: 24
Joined: 06 Jun 2013, 05:10
Reputation point: 0

Re: Position currency symbol and decimal (. e ,)

Postby Xpycm » 11 Jun 2013, 06:45

Hello.
It's simple!

==============================================================================================

Documentation - http://php.net/manual/en/function.number-format.php
Before - https://www.dropbox.com/s/gkeo7f20ys2fo ... -11_01.jpg
Result - https://www.dropbox.com/s/6gxt8m3lp0pob ... -11_04.jpg

==============================================================================================

You need:

1) Set "Decimals point to price" to "."
2) Set "Separator in price to thousandths" to ","

Screenshot - https://www.dropbox.com/s/7wm9e8j7nm4m7 ... -11_03.jpg

And protected\modules\apartments\models\Apartment.php file
instead of:
Code: Select all
public static function priceFormat($price) {
    if (is_numeric($price)) {
        $priceDecimalsPoint = (param('priceDecimalsPoint')) ? param('priceDecimalsPoint') : ' ';
        $priceThousandsSeparator = (param('priceThousandsSeparator')) ? param('priceThousandsSeparator') : ' ';

        return number_format($price, 0, $priceDecimalsPoint, $priceThousandsSeparator);
    }

    return $price;
}
  


write:
Code: Select all
public static function priceFormat($price) {
    if (is_numeric($price)) {
        $priceDecimalsPoint = (param('priceDecimalsPoint')) ? param('priceDecimalsPoint') : ' ';
        $priceThousandsSeparator = (param('priceThousandsSeparator')) ? param('priceThousandsSeparator') : ' ';

        return number_format($price, 2, $priceDecimalsPoint, $priceThousandsSeparator);
    }

    return $price;
}
 


Result - https://www.dropbox.com/s/6gxt8m3lp0pob ... -11_04.jpg
Dropbox
Open Real Estate CMS: FAQ | FAQ 2 | FAQ 3
Image
Xpycm
Web Developer
Web Developer
 
Posts: 281
Joined: 30 Dec 2011, 11:06
Reputation point: 2

Re: Position currency symbol and decimal (. e ,)

Postby qaona » 11 Jun 2013, 08:38

Ok! Thank you for your help, it's perfect for me
qaona
Stranger
 
Posts: 24
Joined: 06 Jun 2013, 05:10
Reputation point: 0

Re: Position currency symbol and decimal (. e ,)

Postby zoom2 » 22 Jul 2014, 12:51

Hi,

In India price format is like: Rs 11,10,22,000

comma separator will be placed after first 3 digit ( right to left) and thereafter comma for every 2 digit. The default code puts comma after every 3 digit.
Please let us know how we can achieve this.

Thank you for your support.
Alva
zoom2
Stranger
 
Posts: 23
Joined: 07 Jul 2014, 07:41
Reputation point: 0

Re: Position currency symbol and decimal (. e ,)

Postby fisher » 23 Jul 2014, 09:30

Give us examples of different prices, so we will know exactly how to format it
fisher
Citizen
Citizen
 
Posts: 63
Joined: 15 Apr 2013, 09:30
Reputation point: 1

Re: Position currency symbol and decimal (. e ,)

Postby zoom2 » 24 Jul 2014, 08:44

Hi,
Please refer below link to understand in detail.
http://en.wikipedia.org/wiki/Indian_Numbering_System. ( refer in table "Indian figure" column).

Eg:

1,000,000,000 (one billion) is written in India=>Rupees (one hundred crore rupees) is written Rs 1,00,00,00,000.
Here comma separated at first 3 last digit ( from right end) .There after it is separated by 2 digit.

1000=> Thousand Rs
10,000=> 10,000 Rs
1,00,000=>1 Lac Rs
10,00,000=>10 lac Rs ( it is same as 1 million)
1,00,00,000=> 1 crore Rs
10,00,00,000=> 10 crore ( it is same as 1 billion)

Please let me know if you need any further information.

If you are unable to define Lac,Crore then at least separate the digits with proper comma ( 3 digit thereafter 2 digit from right)
Regards
Alva
zoom2
Stranger
 
Posts: 23
Joined: 07 Jul 2014, 07:41
Reputation point: 0

Re: Position currency symbol and decimal (. e ,)

Postby fisher » 24 Jul 2014, 09:22

It's an additional customization. Contact us via contact form - http://monoray.net/contact.
fisher
Citizen
Citizen
 
Posts: 63
Joined: 15 Apr 2013, 09:30
Reputation point: 1

Re: Position currency symbol and decimal (. e ,)

Postby norspeed » 07 Aug 2014, 14:43

How do i change this ( 250,000 £ Sale ) to just this ( £250,000 ) on the listings ?
norspeed
Stranger
 
Posts: 5
Joined: 07 Aug 2014, 10:45
Reputation point: 0

Next

Return to Questions and help for changes

Who is online

Users browsing this forum: No registered users and 1 guest