PDA

View Full Version : Euro Zero cents in prices



tassonfl
January 26, 2018, 01:47 PM
Hello, maybe is a bug
If I choose the option "Zero cents in prices" the price is correct es EURO 1.000,00
If I dont want Zero cents in prices the price is not correct es EURO 1,000 instead EURO 1.000
This is my config:

Cents separator ,
Separator symbol in prices .

Thank you

tassonfl
January 28, 2018, 04:54 PM
Nobody answered????

Ed
January 28, 2018, 06:38 PM
Go to Basic Settings> Listings> Zero cents in prices

Check Disabled

In Cents separator place ","
In Separator symbol in prices place "."

Click Save and see if it works the way you want it

Good week!

Ed
January 28, 2018, 06:45 PM
Go to Basic Settings> Listings> Zero cents in prices

Check Disabled

In Cents separator place ","
In Separator symbol in prices place "."

Click Save and see if it works the way you want it

Good week!

tassonfl
January 28, 2018, 07:11 PM
Thanks for answering me, yes, of course I did it, but it does not work.
If I disable "Zero cents in prices" instead of showing 1.000 EURO, show 1,000 EURO.

This is my config:

Cents separator ","
Separator symbol in prices "."
Even if I invert "," with "." nothing changes.

Thank you

Ed
January 28, 2018, 08:23 PM
I'll test here on my site, I'll answer you again soon

Ed
January 28, 2018, 09:04 PM
Do you want 1.000 to display that?

Rudi
January 29, 2018, 04:31 AM
Hello Floro Tassone,

If the problem still exists create a ticket

tassonfl
January 29, 2018, 12:52 PM
Yes, I opened the ticket. Thanks so much

Viktor
January 29, 2018, 02:50 PM
Hello Floro,

Open file: ftp://includes>>classes>>rlValid.class.php
find method: str2money and change to my code:



function str2money($aParams) {
global $config;

$string = is_array($aParams) ? $aParams['string'] : $aParams ;

$len = strlen($string);
$string = strrev($string);
$val = $rest = '';

$sep = $config['price_separator'] ? $config['price_separator'] : ".";

if (strpos($string, '.')) {
$rest = substr($string, 0, strpos($string, '.'));
$string = substr($string, strpos($string, '.')+1, $len);
$len -= strlen($rest)+1;
$rest = strrev(substr(strrev($rest), 0, 2)) . ".";

if (!$config['show_cents'] && $rest == '00.') {
$rest = '';
}
} elseif ($config['show_cents']) {
$rest = '00'.$sep;
}

if ($config['price_separator'] != '.') {
$string = str_replace('.', $config['price_separator'], $string);
}

for ($i = 0; $i < $len; $i++) {
$val .= $string[$i];
if ((($i + 1) % 3 == 0) && ($i + 1 < $len)) {
$val .= $config['price_delimiter'];
}
}

$val = strrev($rest.$val);

return $val;
}


save and check again.

tassonfl
January 29, 2018, 03:51 PM
Now it works perfectly. Thanks so much.

Peter Fulopp
December 28, 2020, 09:00 AM
Hello Floro,

Open file: ftp://includes>>classes>>rlValid.class.php
find method: str2money and change to my code:



function str2money($aParams) {
global $config;

$string = is_array($aParams) ? $aParams['string'] : $aParams ;

$len = strlen($string);
$string = strrev($string);
$val = $rest = '';

$sep = $config['price_separator'] ? $config['price_separator'] : ".";

if (strpos($string, '.')) {
$rest = substr($string, 0, strpos($string, '.'));
$string = substr($string, strpos($string, '.')+1, $len);
$len -= strlen($rest)+1;
$rest = strrev(substr(strrev($rest), 0, 2)) . ".";

if (!$config['show_cents'] && $rest == '00.') {
$rest = '';
}
} elseif ($config['show_cents']) {
$rest = '00'.$sep;
}

if ($config['price_separator'] != '.') {
$string = str_replace('.', $config['price_separator'], $string);
}

for ($i = 0; $i < $len; $i++) {
$val .= $string[$i];
if ((($i + 1) % 3 == 0) && ($i + 1 < $len)) {
$val .= $config['price_delimiter'];
}
}

$val = strrev($rest.$val);

return $val;
}


save and check again.

Hi Viktor,

Just to give you a feedback on this:

I've had the same problem with the decimals and your code change has solved it. I'm using Reality Wide template with Flynax 4.7.0.

Great man, hanks very much!

Ramu Palanisamy
February 15, 2022, 04:58 PM
Hi Viktor,

Please help Indian currency with cents. Now it's showing wrongly

For Example: Currently, It's Showing Like this 3,500,000 But It should Show like this 35,00,000 See attached image

4485

For Your Understanding Indian Currency chat attached

4486

Please guide me to fix this issuse.

Ramu Palanisamy
February 17, 2022, 03:09 PM
Hi Viktor,

Please help Indian currency with cents. Now it's showing wrongly

For Example: Currently, It's Showing Like this 3,500,000 But It should Show like this 35,00,000 See attached image

4485

For Your Understanding Indian Currency chat attached

4486

Please guide me to fix this issuse.

Can I get reply for this..Query

Rudi
February 21, 2022, 04:57 AM
Hello,

Replace this code:


for ($i = 0; $i < $len; $i++) {
$val .= $string[$i];
if ((($i + 1) % 3 == 0) && ($i + 1 < $len)) {
$val .= $config['price_delimiter'];
}
}

$val = strrev($rest . $val);


with:


if ($len > 3) {
$thousand = substr($string, 0, 3) . $config['price_delimiter'];
$string = substr($string, 3);
$len -= 3;

for ($i = 0; $i < $len; $i++) {
$val .= $string[$i];
if ((($i + 1) % 2 == 0) && ($i + 1 < $len)) {
$val .= $config['price_delimiter'];
}
}

} else {
$val = $string;
}

$val = strrev($rest . $thousand . $val);

Ramu Palanisamy
February 21, 2022, 11:34 AM
Hello,

Replace this code:


for ($i = 0; $i < $len; $i++) {
$val .= $string[$i];
if ((($i + 1) % 3 == 0) && ($i + 1 < $len)) {
$val .= $config['price_delimiter'];
}
}

$val = strrev($rest . $val);


with:


if ($len > 3) {
$thousand = substr($string, 0, 3) . $config['price_delimiter'];
$string = substr($string, 3);
$len -= 3;

for ($i = 0; $i < $len; $i++) {
$val .= $string[$i];
if ((($i + 1) % 2 == 0) && ($i + 1 < $len)) {
$val .= $config['price_delimiter'];
}
}

} else {
$val = $string;
}

$val = strrev($rest . $thousand . $val);


Thank You..Rudi can please explain which file or file location..Please

Rudi
February 21, 2022, 11:51 AM
The same file that was mentioned here:




Open file: ftp://includes>>classes>>rlValid.class.php
find method: str2money and change to my code:



function str2money($aParams) {
global $config;

$string = is_array($aParams) ? $aParams['string'] : $aParams ;

$len = strlen($string);
$string = strrev($string);
$val = $rest = '';

$sep = $config['price_separator'] ? $config['price_separator'] : ".";

if (strpos($string, '.')) {
$rest = substr($string, 0, strpos($string, '.'));
$string = substr($string, strpos($string, '.')+1, $len);
$len -= strlen($rest)+1;
$rest = strrev(substr(strrev($rest), 0, 2)) . ".";

if (!$config['show_cents'] && $rest == '00.') {
$rest = '';
}
} elseif ($config['show_cents']) {
$rest = '00'.$sep;
}

if ($config['price_separator'] != '.') {
$string = str_replace('.', $config['price_separator'], $string);
}

for ($i = 0; $i < $len; $i++) {
$val .= $string[$i];
if ((($i + 1) % 3 == 0) && ($i + 1 < $len)) {
$val .= $config['price_delimiter'];
}
}

$val = strrev($rest.$val);

return $val;
}

Ramu Palanisamy
February 21, 2022, 12:30 PM
Wow, it's working super...Thank You...Rudi :D