Currency Conversion using a formula

wil <[email protected]>
Newsgroups gmane.comp.web.oscommerce.suggestions
Message-ID <4961918e91ca2dbc142589ae3e4d563d@osCommerce-Forums>
This message was sent from: Suggestions and Proposals
http://forums.oscommerce.com/viewtopic.php?p=185639#185639
----------------------------------------------------------------

I'm not sure if it's useful but one of our clients require a way to add $1 to Canadian prices of the products.

I'm modified the currency function to do a [b]$price + $rate[/b] instead of [b]$price * $rate[/b].

This is fine for showing the product price but when they go to the checkout or cart screen or invoice screen it doesn't do the calculation properly.

ex.

[b]CAD version[/b]
  Unisex Size 3-6 Months Bundle Of Joy Outerwear $8.00 
  Unisex Size 6-12 Months Mini Car Playsuit*** $75.00 
  Girls Size 12 Months Please Mum Dress $12.00 
 
Sub-Total: $95.00 


[b]USD version[/b]
1 x Unisex Size 3-6 Months Bundle Of Joy Outerwear $9.00 
5 x Unisex Size 6-12 Months Mini Car Playsuit*** $76.00 [b]it should be $80.00[/b]
1 x Girls Size 12 Months Please Mum Dress $13.00 
 
Sub-Total: $96.00 [b]it should be $102.00[/b]


I think its adding all the prices before conversion and then doing $currency->format() to convert the total. which only adss $1 no matter how many products have been purchased...


I guess the solution would be to convert the prices before adding them and totalling them up.

But we'd have to use a different convert function 

INTEGER $currency->convert() 
instead of
STRING $currency->format() 

so that it will return an integer so we can do further manipulation like adding them up and getting a proper total.  And then use $currency->format($price) to add the proper symols and decimal places.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.