0

I need to add Nigerian regions/states to the database. So I created and successfully imported the "directory_country_region.csv" and "directory_country_region_name.csv" files to the "directory_country_region" and "directory_country_region_name" tables via phpMyAdmin. Then, I tried importing "tablerates.csv" into Magento admin, but I got the following error message again:

We couldn't import this file because of these errors: Please correct Region/State "Abia" in the Row #2.
Please correct Region/State "Abuja" in the Row #3.
Please correct Region/State "Adamawa" in the Row #4.
Please correct Region/State "Akwa Ibom" in the Row #5.
Please correct Region/State "Anambra" in the Row #6.
Please correct Region/State "Bauchi" in the Row #7.
Please correct Region/State "Bayelsa" in the Row #8.
Please correct Region/State "Benue" in the Row #9.
Please correct Region/State "Borno" in the Row #10.
Please correct Region/State "Cross River" in the Row #11.
Please correct Region/State "Delta" in the Row #12.
Please correct Region/State "Ebonyi" in the Row #13.
Please correct Region/State "Edo" in the Row #14.
Please correct Region/State "Ekiti" in the Row #15.
Please correct Region/State "Enugu" in the Row #16.
Please correct Region/State "Gombe" in the Row #17.
Please correct Region/State "Imo" in the Row #18.
Please correct Region/State "Jigawa" in the Row #19.
Please correct Region/State "Kaduna" in the Row #20.
Please correct Region/State "Kano" in the Row #21.
Please correct Region/State "Katsina" in the Row #22.
Please correct Region/State "Kebbi" in the Row #23.
Please correct Region/State "Kogi" in the Row #24.
Please correct Region/State "Kwara" in the Row #25.
Please correct Region/State "Lagos" in the Row #26.
Please correct Region/State "Nasarawa" in the Row #27.
Please correct Region/State "Niger" in the Row #28.
Please correct Region/State "Ogun" in the Row #29.
Please correct Region/State "Ondo" in the Row #30.
Please correct Region/State "Osun" in the Row #31.
Please correct Region/State "Oyo" in the Row #32.
Please correct Region/State "Plateau" in the Row #33.
Please correct Region/State "Rivers" in the Row #34.
Please correct Region/State "Sokoto" in the Row #35.
Please correct Region/State "Taraba" in the Row #36.
Please correct Region/State "Yobe" in the Row #37.
Please correct Region/State "Zamfara" in the Row #38.

Those regions/states are already in the database. What else can I do to successfully import the tablerates.csv?

Update

The following is my tablerates.csv file: Tablerates.csv

Thanks in advance.

1

You are going about this completely wrong. The first problem here is that you have added items to the database outside of Magento, ie: phpMyAdmin. The next issue is that you have not followed the proper CSV format required for importing the rates. You'll need to consider an extension for tablerates, such as this one that I had used in the past called matrixrates, i think it was by webshopapps. Here is an example of the data it accepted:

http://support.webshopapps.com/matrixrate/matrixrate-csv-configuration/


Update

I didn't realize you were using Magento 2. While my initial answer may not change, I am going to have to admit that I may not actually be able to answer this with the proper understanding and knowledge to feel confident of my answers.

I can assure you of one thing, updating raw data in the database is a problem unless you are fully certain of what you are doing.

Consider following Magento's documentation for tablerates:

http://docs.magento.com/m2/ce/user_guide/shipping/shipping-table-rate.html

Curious have you applied the NGA ISO country code for Nigeria?

Could you post your tablerates.csv or an example of some of the data?

I hope that nothing has gone wrong because of the SQL updates done within phpMyAdmin.

Update #2

Your data should not contain any data beyond the datatypes required by the import. This means, let's be certain that numbers for weight are exactly that -- numbers. Remove kg. The unit of weight should be specified within some other area of the system configuration.

Be sure that you also are setting wildcard values at the bottom of the list, and using them where appropriate. Currently, it is apparent that you have the list in ascending alphabetical order by state. It also appears that the zipcode/postal code should be * for each of states. I'm guessing that zip code details are only needed where a state may have multiple prices split across it and usage of the zipcode would help specify that difference.


Primary Issue

The issue you have with the states and likely your primary problem, is that there should be ISO Codes used, and not the name of the state.

https://en.wikipedia.org/wiki/ISO_3166-2:NG will list the codes for each of the applicable states/territories. I would suggest not using the "NG-" part of the codes, but you may want to double-check that, or test both scenarios.

For example:

  • FC, Abuja Federal Capital Territory
  • AB, Abia
  • AD, Adamawa
  • AK, Akwa Ibom
  • AN, Anambra

etc..

To simplify your tests and get a better understanding of the issues, use a limited test data set -- three to five rows only.

For the data added through PhpMyAdmin, consider that it is incorrect if you did not apply any sort of region/state code for the states.. Also, be sure that was something that was even required to begin with (in all honesty, I do not know, but I can be fairly certain that it is lacking some of the required information, such as the ISO code for the states)..

  • thanks for your insight. What I did was actually suggested at Magento forum by its moderators: codecommunity.magento.com/t5/Magento-2-x-Admin-Configuration/…code. Is there another way I can go about this issue without installing an extension, as that seems too technical? – Justin Apr 15 '18 at 9:09
  • I'm certain the raw update I made to the database hasn't caused any noticeable issue. And I can easily delete the added regions/states, if necessary. Yes, I've applied the NGA ISO code. I will update the original post, if possible, with the tablerates.csv. Thanks once again. – Justin Apr 15 '18 at 10:31
  • you're literally amazing! I'm humbled by the time you devoted to my issue, your insight and research. You helped me to solve the issue and I can't thank you enough. – Justin Apr 15 '18 at 16:23
  • So glad I could help. – df2k2 Apr 15 '18 at 16:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.