HI guys,

When a customer reviews their order - the price that is shown to them doesn't reflect the currency that they have ordered in - rather - it show the prices in the country/currency that is selected.

How can this be addressed and brought into line taking the order currency from the order details?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

hixster’s picture

Priority: Normal » Major
hixster’s picture

** bump ** Any chance of an update on the outstanding issues guys - I have a site that is live and needs some love - could really use some help

Many thanks

Bartezz’s picture

Status: Active » Closed (works as designed)

Hi Hixster,

This is how the module works. If a user selects The Netherlands from the dropdown whilst browsing the site and adding products to the cart he/she will get the prices for the Dutch market in Euros. Now if that shopper decides on checkout that he/she isn't really Dutch but American and changes the billing country all product prices will be changed to the prices set for USA in $. This is to prevent customers to shop in prices not meant for their countries market. It's completely by design and I don't think it will be changed.

Cheers

hixster’s picture

Hi Bartezz, thanks for the reply. Sorry, I don't think I explained this properly. When I mentioned order review, i was actually referring to the completed orders that appear in a users account. For example.

http://www.mysite.com/user/uid/orders

Orders that have been paid for and are completed obviously show up in the users account and in my opinion the value of the order should always be shown in the currency it was ordered in and not be dependant on the country selector - otherwise it's just way to confusing.

What do you think?

Bartezz’s picture

Status: Closed (works as designed) » Postponed (maintainer needs more info)

Ah, that's a complete different story. I will have to do some tests on this. Tell me, does it only show the incorrect currency or also the incorrect prices?

Cheers

hixster’s picture

Hi Bartezz, I think the value is correct, it's just the currency symbol.

Bartezz’s picture

Hi Hixster,

Just done some testing and found out it is also the case on the admin pages

- admin/store/orders/XX
- admin/store/orders/xx/*

There is some logic as to why this is happening tho and I don't think there will be an easy fix. See the currency symbol is insert via the price_handler() functionality and this doesn't discriminate against anything if you catch my drift. Also, the currency nor currency symbol isn't stored with an order, just the bare prices/numbers. So when looking back at an order as a user or admin there is no way for the module to know what the currency was at the time of order.

So I've cooked up a patch, which I would like you to review very well. What this does is checking upon the price_alter call is that the price that is being altered comes from a completed order or not. If it comes from a completed order it won't change the currency to the currently active country's currency but it'll take the delivery country from the order and uses that country's currency symbol.

The only drawback to this is that when a country's currency changes (like when the Euro will be introduced in Brittain, Norway, United States) it won't remember that the old order was done in GBP, NOK or USD, but how often will this be the situation?

Hope the patch works out well, don't use in production yet and please post back any findings!

Cheers

hixster’s picture

Cool, I will give it a try.
Btw, I know completed orders store a record of the currency the user paid in, but I think this might just be returned by paypal (or the gateway in use - I'm not certain about this - you probably know more about it)and stored as an administrator
note, so it's probably not reliable enough to use.
I'll let you know about the patch. Thanks again!

Bartezz’s picture

Hi Hixster,

Because of your comment I checked out the database tables again and couldn't find any record of currency so maybe it indeed is paypal or your gateway storing this. However I did find that in the uc_orders table there's a record called 'data' which stores all session variables at the time of order (at least I think that's what it does).

So a possibility is is to add the currency to the session at the time of order so that this will be stored in the data record when the order is saved and then use this when viewing completed orders/invoices etc...

Docc, what do you think? I mean, the patch kinda solves the issue but storing the currency information at the time of order in the uc_order table would fix this permanently...

Cheers

hixster’s picture

I think storing the currency with an order would be a great addition and would allow us to develop custom sales reports(views) by region for our clients.

Bartezz’s picture

Well you could use the same solution as I did for the custom sales reports based on the order delivery country too :)
But we'll see what Docc has to say about storing curfrency info in a session so that it'll get saved in the data field in uc_order table.

Cheers

hixster’s picture

Hi Bartezz - we're selling software licenses so don't use the delivery address - I guess I could
use the billing address all the same. :-)

Bartezz’s picture

Status: Postponed (maintainer needs more info) » Needs review
FileSize
4.3 KB

Ok, here is what I've done;

- save currency information (currency, sign, decimal sign, etc) in order-data object for future references
- when old order is being viewed this data is being used to display order, because this will only be available for orders after implementation of this patch, I use the delivery_country method from above for older orders without currency information stored
- also, I've made changes that allows currency only to be changed for orders with a status 'in_checkout', so that the country selector does not effect orders that have a status 'payment_pending', 'processing', 'completed', cancelled', etc etc.

Please test thoroughly Hixster and let me know how it works out.

Docc, what do you think of these changes?

Cheers

janton’s picture

I added patch 1 and 2
Bartezz: "also, I've made changes that allows currency only to be changed for orders with a status 'in_checkout'"

It seems i can't change currency when i'm in the domain.com/cart ? I switch from USA to Netherlands, i added different currency in domain.com/admin/store/settings/countries/edit/formats for Netherlands before.. but now it seems currency is not changing anymore? Do you have the same hixter?

Bartezz’s picture

Hi Janton,

Thanx for reviewing. Thought hixster would have had time to do so by now. ;)

Anyway, I've reproduced the bug you've mentioned. The reason I didn't notice the bug is because my shoppers aren't allowed to change delivery details upon checkout, this data is loaded from their profile. (only registered user's may purchase)

EDITED:
Well I came up with a possible solution but I've just tested it and it's not working in all cases. The problem I'm facing is that the hook_price_handler_alter() isn't always being fed with a &$context. That way I know jack sh#$t on the price in some cases...

I'm really going to need a lot of time to look in to a possible fix. Docc, do you have any ideas?

Cheers

Bartezz’s picture

Ok, I think I've found a solution. I've only tested it lightly and have to complete the code but it seems like a solution.

While testing I did find another problem tho, in admin/store/orders/XX above the order there is mention of Balance, the currency used here is not according to the order currency. Also admin/store/orders shows all orders in the def currency...

Will post a new patch asap.

Cheers

janton’s picture

I applied these 1&2Patches because hixter mixted up some thread, i had a different problem.. of course i read the thread before i apply any patch.. but when i start reading here i noticed hixter and me both sell "licenses" and with different currency so it would also apply to me! if you have the new patch i will be happy to test it!

Something totally off-topic: I guess the Country is not automaticly selected with ip2cc or i18 module or something? If a anonymous user visits he has to select the Country he's in i guess?

I'm still looking for the best way to setup my site multilanguage with and automaticly the right currency.
I first thought i create some i18 languages and add every node per language with different currency. For so far i noticed this is not possible with ubercart and any multi currency module? I mean can i create a Dutch node with a price in Euro and then translate that node to English and give a price in Dollars? I think my solution would be to combining this multi currency module with i18 language selection... sorry for the off-topic part ;) i was just thinking out loud!

EDIT: i will read this thread http://drupal.org/node/512160 (sorry for the off-topics)

Bartezz’s picture

@Janton Off topic; start reading this thread http://drupal.org/node/913660#comment-4088652