Page 1 of 1

[1.3.2] Modification of currency code generates error

Posted: Wed Aug 19, 2009 9:17 pm
by SuperJuice
First up Daniel, I want to say I realise this is _really_ obscure, but I came across it and thought you may be interested. I wasn't looking for it, found it when I was building the Paymate module and playing around with the fallback part.

In the catalog
Have the default currency selected (eg. GBP)

Open the Admin panel:
1. Admin -> Configuration -> Localisation -> Currency
2. Click 'Edit' on default currency
3. Modify the currency code eg. GBP -> GBX
4. Click 'Save'

Refresh your catalog page
Notice: Undefined index: GBP in <basedir>/system/helper/currency.php on line 53
Notice: Undefined index: GBP in <basedir>/system/helper/currency.php on line 54
Notice: Undefined index: GBP in <basedir>/system/helper/currency.php on line 55
Notice: Undefined index: GBP in <basedir>/system/helper/currency.php on line 63

That's about it.. I don't expect people to be changing their currency codes on live systems but I guess it's a bug.

A second part to this I noticed is that you can have 2 currencies with the same currency code, this should probably be checked in the save code of the currency because it makes for some interesting results.. eg. 2 concurrent default currencies.

Once again.. not sure how often people would actually do this.. but it may be hard to troubleshoot if they do! (and may potentially corrupt database entries) ;)

Re: [1.3.2] Modification of currency code generates error

Posted: Thu Aug 20, 2009 1:52 am
by Qphoria
Yea, Its due to the homepage "orders" view. It loads orders as well as the currency code that was used to purchase and tries to look that currency code up and fails since it no longer exists.

I guess one fix would be to update the order table to change the currency when the admin is changed, but that's not really good for historical data. I've not looked into a fix yet personally.