Hello,
We are using our store here in india, the currency format for amounts which are high is different.
currently oc shows amounts like Rs.255,000 where as in india it is Rs. 2,55,000
How can i edit this. i need it to be in indian format
We are using our store here in india, the currency format for amounts which are high is different.
currently oc shows amounts like Rs.255,000 where as in india it is Rs. 2,55,000
How can i edit this. i need it to be in indian format
system/library/currency.php
Code: Select all
$string .= number_format(round($value, (int)$decimal_place), (int)$decimal_place, $decimal_point, $thousand_point);
Code: Select all
if ($symbol_right == 'RS.' || $symbol_left == 'RS.' ) {
//indian format
$num=round($value, (int)$decimal_place)
$num=explode('.',$num);
$dec=(count($num)==2)?'.'.$num[1]:'.00';
$num = (string)$num[0];
if( strlen($num) < 4) return $num;
$tail = substr($num,-3);
$head = substr($num,0,-3);
$head = preg_replace("/\B(?=(?:\d{2})+(?!\d))/",",",$head);
$string .= $head.",".$tail.$dec;
} else {
$string .= number_format(round($value, (int)$decimal_place), (int)$decimal_place, $decimal_point, $thousand_point);
}
hello,
Thanks it seems to be working for amounts where the price is more than 3 digits. example anything above 1000 is fine. but for 3 digit numbers it isnt working. for example there is product which cost Rs. 575 it appears like this now Rs. ,575
how do we solve this
Thanks it seems to be working for amounts where the price is more than 3 digits. example anything above 1000 is fine. but for 3 digit numbers it isnt working. for example there is product which cost Rs. 575 it appears like this now Rs. ,575
how do we solve this
Code: Select all
if ($symbol_right == 'RS.' || $symbol_left == 'RS.' ) {
//indian format
$num=round($value, (int)$decimal_place);
$num1=explode('.',$num);
$dec=(count($num1)==2) ? '.' .$num1[1] : '.00';
$num_ = (string)$num1[0];
if( strlen($num_) < 4) {
$string .= $num;
} else {
$tail = substr($num_,-3);
$head = substr($num_,0,-3);
$head = preg_replace("/\B(?=(?:\d{2})+(?!\d))/",",",$head);
$string .= $head.",".$tail.$dec;
}
} else {
$string .= number_format(round($value, (int)$decimal_place), (int)$decimal_place, $decimal_point, $thousand_point);
}
Code: Select all
123.56 => 123.56
1123 => 1,123.00
11123.56 => 11,123.56
111123 => 1,11,123.00
1111123.56 => 11,11,123.56
11111123.56 => 1,11,11,123.56
111111123.56 => 11,11,11,123.56
1111111123.56 => 1,11,11,11,123.56
Good Job, but with OC 3.x code have some bug you have selected currency value rather then amount
it should be
and the piece of code will be
If you need any further assistance for Opencart development you can reach me out at
http://asktofaizan.com/ocd.php
OR
http://asktofaizan.com
OR
http://alliancedigitals.com
Code: Select all
$num=round($value, (int)$decimal_place);
Code: Select all
$num=round($amount, (int)$decimal_place);
Code: Select all
$num=round($amount, (int)$decimal_place);
$num1=explode('.',$num);
$dec=(count($num1)==2) ? '.' .$num1[1] : '.00';
$num_ = (string)$num1[0];
if( strlen($num_) < 4) {
$string .= $num;
} else {
$tail = substr($num_,-3);
$head = substr($num_,0,-3);
$head = preg_replace("/\B(?=(?:\d{2})+(?!\d))/",",",$head);
$string .= $head.",".$tail.$dec;
}
If you need any further assistance for Opencart development you can reach me out at
http://asktofaizan.com/ocd.php
OR
http://asktofaizan.com
OR
http://alliancedigitals.com
For further assistance with Opencart Development you can reach me at
asktofaizan@gmail.com | https://asktofaizan.com |
Who is online
Users browsing this forum: No registered users and 217 guests