How to config aimeos plugin to work with country code iso alpha 2 only?

Questions around the TYPO3 integration and plugins
Forum rules
Always add your TYPO3, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
rungis
Posts: 14
Joined: 23 Oct 2019, 12:14

How to config aimeos plugin to work with country code iso alpha 2 only?

Post by rungis » 18 Jan 2021, 12:34

Aimeos profile billing address (address-payment-countryid) has been saved to the field fe_users.static_info_country as
iso alpha 3 (AND) but needed as iso alpha 2 (AD). How to make it happen?

<select class="form-control" id="address-payment-countryid" name="ai[address][payment][customer.countryid]">
<option value="">Bitte wählen</option>
<option value="AD">
Andorra</option>
<option value="AE">
Vereinigte Arabische Emirate</option>
<option value="AI">
Anguilla</option><option value="AF">
Afghanistan</option>
<option value="AG">
Antigua und Barbuda</option>

this behavior is hardcoded in ai-typo3/lib/custom/config/mshop/customer.php

'update' => array(
'ansi' => '
UPDATE "fe_users"
SET :names
"name" = ?, "username" = ?, "gender" = ?, "company" = ?, "vatid" = ?, "title" = ?,
"first_name" = ?, "last_name" = ?, "address" = ?, "zip" = ?, "city" = ?, "zone" = ?,
"language" = ?, "telephone" = ?, "email" = ?, "fax" = ?, "www" = ?, "longitude" = ?,
"latitude" = ?, "date_of_birth" = ?, "disable" = ?, "password" = ?, "tstamp" = ?,
cry: ???? "static_info_country"=( SELECT "cn_iso_3" FROM "static_countries" WHERE "cn_iso_2" = ? LIMIT 1 ),
"usergroup" = ?, "pid" = ?
WHERE ( siteid = ? OR siteid = \'\' ) AND "uid" = ?
',
),
TYPO3 Version 10.4.12
Aimeos 20.10.5
Webserver nginx/1.15.9
PHP Version 7.3.13-1+ubuntu19.04.1+deb.sury.org+1
Database (Default) MySQL 5.7.28
Operating System Linux 5.0.0-38-generic

User avatar
aimeos
Administrator
Posts: 7835
Joined: 01 Jan 1970, 00:00

Re: How to config aimeos plugin to work with country code iso alpha 2 only?

Post by aimeos » 19 Jan 2021, 17:36

Yes, Aimeos use two letter ISO country codes everywhere and maps the three letter country codes using the static_info_country table. What is your exact request now?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

rungis
Posts: 14
Joined: 23 Oct 2019, 12:14

Re: How to config aimeos plugin to work with country code iso alpha 2 only?

Post by rungis » 20 Jan 2021, 15:24

Aimeos plugin uses two-letter ISO country codes but saves in the fe_user table the 3 letters code. This is the problem. The other plugins use the same field in fe_user (with 2 letters) and I got the clash.
TYPO3 Version 10.4.12
Aimeos 20.10.5
Webserver nginx/1.15.9
PHP Version 7.3.13-1+ubuntu19.04.1+deb.sury.org+1
Database (Default) MySQL 5.7.28
Operating System Linux 5.0.0-38-generic

User avatar
aimeos
Administrator
Posts: 7835
Joined: 01 Jan 1970, 00:00

Re: How to config aimeos plugin to work with country code iso alpha 2 only?

Post by aimeos » 20 Jan 2021, 15:36

Then, the other plugin you are using does it wrong because the fe_users.static_info_country column is VARCHAR(3) for three letter ISO country codes. Which extension does this?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

rungis
Posts: 14
Joined: 23 Oct 2019, 12:14

Re: How to config aimeos plugin to work with country code iso alpha 2 only?

Post by rungis » 20 Jan 2021, 16:22

literally all. for example sf_register. All plugins use 2 letter code due to existed localization. What the reason to perform transitions many times only to save 3 letters code? Why the aimeos profile plugin do it only for the billing address but for delivery address save in 2 letters code?
TYPO3 Version 10.4.12
Aimeos 20.10.5
Webserver nginx/1.15.9
PHP Version 7.3.13-1+ubuntu19.04.1+deb.sury.org+1
Database (Default) MySQL 5.7.28
Operating System Linux 5.0.0-38-generic

User avatar
aimeos
Administrator
Posts: 7835
Joined: 01 Jan 1970, 00:00

Re: How to config aimeos plugin to work with country code iso alpha 2 only?

Post by aimeos » 21 Jan 2021, 16:57

Which else? If there are more extensions saving a 2 letter code than 3 three letter code, then we should switch too.

You can adapt the SQL statements to read/write the 2 letter codes directly:
https://github.com/aimeos/ai-typo3/blob ... #L603-L709
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

rungis
Posts: 14
Joined: 23 Oct 2019, 12:14

Re: How to config aimeos plugin to work with country code iso alpha 2 only?

Post by rungis » 22 Jan 2021, 09:23

ok. The "brotkrueml/form-country-select". This plugin is actively used in typo3 core form framework https://docs.typo3.org/p/brotkrueml/for ... ter/en-us/.

In my opinion, it must be a configurable value, and anyway you must use the same country code for all entities (not like now with billing and delivery addresses).

And thank you for your hard work ))
TYPO3 Version 10.4.12
Aimeos 20.10.5
Webserver nginx/1.15.9
PHP Version 7.3.13-1+ubuntu19.04.1+deb.sury.org+1
Database (Default) MySQL 5.7.28
Operating System Linux 5.0.0-38-generic

Post Reply