rounded price

  • Posts: 59
  • Thank you received: 0
11 years 9 months ago #95872

hi.
how can i round price? if, for example, price 4567$ need to display like 4600$? how it's possible?

Please Log in or Create an account to join the conversation.

  • Posts: 83041
  • Thank you received: 13405
  • MODERATOR
11 years 9 months ago #95903

Hi,

There is no such option as far as I can see.
Why not directly enter the price of 4600$ in your product price ?

Please Log in or Create an account to join the conversation.

  • Posts: 59
  • Thank you received: 0
11 years 9 months ago #95940

Oh. Main currency is $, secondary is BYR. When user enter price in $, it converted into BYR with scale 1:8750, for example, and price can be 856650 BYR, I want round it.

Please Log in or Create an account to join the conversation.

  • Posts: 83041
  • Thank you received: 13405
  • MODERATOR
11 years 9 months ago #95942

I've did some tests and I think I have a solution to what you need.
Edit your BYR currency via the menu System>Currencies and change the local and international fractional digits options to -1 or -2 or -3 based on the precision of the rounding you want and in the administrator/components/com_hikashop/classes/currency.php, change the code:

		$num = sprintf("%0.{$decimals}f",round($number,$decimals));
to:
if($decimals<0){
			$round = 0;
		}else{
			$round = $decimals;
		}
		$num = sprintf("%0.{$round}f",round($number,$decimals));

That should do what you need hopefully.

Please Log in or Create an account to join the conversation.

  • Posts: 59
  • Thank you received: 0
11 years 9 months ago #95961

something didn't work. i do all what you say but it is nothing. how can i display digits after "," like 000? site is kresloff.by

Please Log in or Create an account to join the conversation.

  • Posts: 83041
  • Thank you received: 13405
  • MODERATOR
11 years 9 months ago #96024

You can't put some digits of prices like that.

What didn't work ? You didn't see any difference ? I tested it on my end and it worked fine...

Please Log in or Create an account to join the conversation.

Time to create page: 0.064 seconds
Powered by Kunena Forum