Country problem importing Akeeba Subscriptions

More
9 years 2 hours ago #87296 by Alice
I've found a database design problem while importing data from Akeeba Subscriptions, running the component com_aks2membershippro.

Akeeba Subscriptions stores subscriber's country as "ISO 3166-1 alpha-2", that is a two letters code, such as GB, VN, FR and so on.
When importing data to Membership Pro, the component com_aks2membershippro copies the data found in country “as is”, but Membership Pro does not recognize the country code stored into the database.
After a successful import, going to "Subscriber Manager: Edit Subscriber", the Country field displays "Select Country".
This happens because Membership Pro wants the full name of the country, such as "United Kingdom", "Viet Nam", "France", and so on.

This is not a problem to me, I've modified the import procedure and automatically translated country codes to the corresponding country names.
I just wanted to notify the author about the problem in case he wants to fix it, and other users in case they experience the same problem.

Additionally, the sample data (sample_csv.zip) provided at joomdonation.com/forum/membership-pro/23...s-from-csv-file.html don't work for similar reasons: they contain "Vietnam" as Country, while Membership Pro expects "Viet Nam" (with space).

Again, this is not a problem to me. I just wanted to notify.

Please Log in or Create an account to join the conversation.

More
8 years 11 months ago #87329 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Country problem importing Akeeba Subscriptions
Thanks Alice. Since you modify code of the import script to translate the country, could you please share it back to me to save me sometime?

Regards,

Tuan

Please Log in or Create an account to join the conversation.

More
8 years 11 months ago - 8 years 11 months ago #87523 by Alice
I have exported Akeeba data to a CSV file, so I haven't actually fixed the method Aks2MembershipProController::migrate_subscriptions().

However, I handled the conversion from the 2 letters country code to the country name, simply using the data found in the #__osmembership_countries table.
It basically requires only a left outer join to be added to the SELECT query:
Code:
LEFT OUTER JOIN `#__osmembership_countries` ON `#__akeebasubs_users`.`country` = `#__osmembership_countries`.`country_2_code`

Important Note
To be able to convert all the countries: the lookup table must contain the correct country codes, but at the moment (by default) it doesn't .
Last edit: 8 years 11 months ago by Alice.

Please Log in or Create an account to join the conversation.