Jump to content

[SOLVED] Some currencies have longer ISO Numeric Codes than 3 characters


Recommended Posts

Just a note to the devs:

I'm trying to add TWD (Taiwan Dollar) into Prestashop 1.4 Beta5 but it's giving me the error that "the field iso_code_num is too long (3 chars max)". The official ISO code for TWD is 4217. It would be great to have this 3 character max length rule removed from this field because there are many currencies that have ISO codes longer than 3 characters.

Thanks!

Link to comment
Share on other sites

I agree. Hope this could be reflected in a new version soon.
By the way, if you encounter this problem, you can try to fix by yourself by making following changes.

1. Change database table iso_code to allow more chars.
2. Change max length of iso_code at following line in file /classes/Currency.php

    protected     $fieldsSize = array('name' => 32, 'iso_code' => 3, 'sign' => 8);

Link to comment
Share on other sites

A generic question here:

Is there a common way to extend classes in Prestashop so that I can have my own folder of extended classes that contain these core file modifications? This way when I update my version, I don't have to worry about merging any files.

Thanks.

Link to comment
Share on other sites

Yes, you will be able to do that after new version 1.4(still in beta 5)

All classes extension should be placed in folder /override/classes
All page class (call controller) will be placed in folder /override/controllers/

This is really a great new version! I like it.

Link to comment
Share on other sites

  • 3 weeks later...

PS - I updated that line in the Currency.php class to accept 4 characters and also increased the iso_code_num column in the ps_currency table but when trying to submit the currency it would give the generic "iso_code_num is invalid" error message. I'm not really sure why this kept happening so I just created the currency with a 3 character long ISO code, and then after I submitted the form I updated the currency iso_code_num in the database manually.

Link to comment
Share on other sites

And to wrap up this thread, it looks like I was completely wrong about 4 character ISO codes. ISO4217, which was listed on the Taiwanese Currency Wikipedia page (and what I thought was the TWD ISO code) was actually a link to the standardized 3 character long currency ISO codes.

FYI TWD is ISO code 901

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...