can ubercart do this?

Posts: 48
Joined: 10/07/2007
InternationalizationizerNot Kulvik

automatically calculate cost of the product in the user's currency?

sounds simple no? Evil

j/k i have heard of the currency api but i dont know if it is what i m looking for

--

Mohammed Arafa

Posts: 2244
Joined: 08/07/2007
AdministratoreLiTe!

I think it is. If we ever get multi-currency support in Übercart, I think that's what we'll use. You can get it from the Currency Exchange module.

Posts: 28
Joined: 09/25/2007
Getting busy with the Ubercode.

I'm currently working on a uc_currency module.

I am NOT using the existing currency project for a couple of reasons..

First and foremost, it has no caching. This means that when you show a list of 10 products, it hits the remote provider 10 times. It's easy to have an in-memory cache, but you still hit the provider once per page, per visitor.

The other thing I didn't like about the currency module is it has a bunch of extra junk, namely blocks for letting a user calculate exchange rates on your site.

Between the extra overhead, the fact I'd basically have to rewrite it anyways, and then that I would have to wait until the maintainer patched and released it before I could use it.. it just seemed to make sense to roll my own. (But I can be convinced that is a bad idea - and the API part of mine could be pulled out into its own non-ubercart-related module anyways, replacing or merging with the existing currency module).

What I have so far is an API that can use multiple currency providers (right now I'm using webserviceX, but I will probably also put in Yahoo Finance to start with - which is what the other module uses). Different providers have different currencies and update frequencies, so I think this makes sense. It also has caching using a database, with the TTL configurable. This means you hit the provider once per day (or however you configure it), regardless of pageviews/visitors. It also has a memory cache so it will only hit the database once per page.

There's also some options for configuring display format (eg, "$5.00 USD ($4.00 CAD)" or "$4.00 CAD" etc..).

I have some other things to get done that have priority, but I should have something within a week or two (but don't hold me to that). Actually, I should probably write a patch for the hook I'll need so it can at least possibly get into alpha 8.

Posts: 5269
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

gregmac, that sounds awesome! Send me a PM w/ your hook need and I'll try to work it in for ya. Good luck with the rest of the code. Smiling

Posts: 28
Joined: 09/25/2007
Getting busy with the Ubercode.