You are not logged in.
Hi,
For our shopping cart we will be using Zend_Currency to take values and convert based on Zend_Locale and I have a quick question.
As our shopping cart will at times contain multiple items we want to know, do we create a new instance of Zend_Currency for every item's cost or just have the one instance and change it's value for each item using setValue?
Cheers,
Ryan
Offline
hey Ryan,
my understanding of Zend_Currency (due to its scanty documentation) is that it merely works with the viewing of currencies and mapping number spaces for a particular locale. I think you'll still end up writing the conversion code yourselves. I would suggest that you have a base currency and keep everything as such and then write a simple adapter factory...
e.g.
$converter = new My_CurrencyConverter(new UsdToEuroConverter());
$converter->convert($amount);
the various converter classes would have the necessary business rules (or lookups to currency web services). the My_CurrencyConverter class would be more concerned with the view logic and so it would have a generic implementation of Zend_Currency, drawing from the users' Zend_Locale settings.
Let me know what you end up doing!
Best,
-
j
Offline