Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Currency Conversion using a formula


wil

Recommended Posts

Posted

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 $price + $rate instead of $price * $rate.

 

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.

 

CAD version

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

 

 

USD version

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 it should be $80.00

1 x Girls Size 12 Months Please Mum Dress $13.00

 

Sub-Total: $96.00 it should be $102.00

 

 

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...