News:

Support the VirtueMart project and become a member

Main Menu

Rounding Currency Conversions

Started by CMYKreative, October 07, 2012, 07:16:04 AM

Previous topic - Next topic

CMYKreative

On this site (http://demo.cmykreative.com/berkeley/index.php?option=com_virtuemart&view=category&virtuemart_category_id=9&limitstart=64) we have the base currency set in British Pounds, when changing the currency to another, it produces some messy conversions. What's a quick easy way to make it round up to the nearest whole number?

i.e.
NOW
£34.00
฿ 1,681.31

WE WANT
£34.00
฿ 1,681.00

OR
฿ 1,681.31 = ฿ 1,681.00
฿ 1,681.57 = ฿ 1,682.00

bytelord

Hello,

forgot to mention your vm version. In version 2.0.12 which just released have been introduced round prices on price configuration. So you could upgrade and fix the rounded prices.

You can also search the forum to find solutions regarding price rounding. Such as:
https://forum.virtuemart.net/index.php?topic=98076.0
http://forum.virtuemart.net/index.php?topic=97878.msg322695#msg322695

Regards
Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!

CMYKreative

We are running 2.0.10 but I'm loathe to upgrade yet again as it breaks the site every time it upgrades.

I tried those hacks, but they had absolutely no effect.

Any thoughts?

bytelord

Hi,

I thinking the same, use rounding prices will help you to resolve it. Perhaps using them only for the one currency or from the backend edit the currency and remove the decimals (0) with the rounding at the same time ...

Can you try it?

Some more information for round: http://php.net/manual/en/function.round.php

Regards
Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!

CMYKreative

OK, we've done this:

In Joomla! Administrator -> Conponents -> VirtueMart:

1/ Go to Configuaration -> Select Pricing tab -> Show Following Prices
- Select Enable shoppergroup specific price display
- Select Show Prices
- Select any price display as you want in Show Price
- Rounding Digits: 0 (zero)

* Apply to all


2/ Go to Configuaration -> Currencies -> Select your Currency -> Decimals: 0 (zero)

* Apply to the specified currency


3/ Go to Orders & Shoppers -> Shopper Groups -> select -anonymous-:
- Select Enable shoppergroup specific price display
- Select Show Prices
- Select any price display as you want in Show Price
- Rounding Digits: 0 (zero)

* Apply to the specified shoppergroup


This works, however it applies to ALL currencies, and it removes the (.00) $xxx.00 at the end of all currencies. Any thoughts on how to apply it to specific currencies and to keep the .00 at the end?

bytelord

Hello,

I think this could be done if you write some code. For example when the specific currency is selected then make the rounds manually with the above examples/posts i give you.

In general you could edit your category/default or productdetails/default_prices and do something like

if this curerncy selected then round prices like this else round price like this....

I think you could implemented this

Regards
Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!