4

I'm using Magento CE 1.7.0.2, having recently upgraded from 1.4.2.0. And when editing/creating a customer address in the backend, the country dropdown field is blank - with no possible options to select. Neither does it work on the frontend address dropdown.

Any ideas what's caused this, the only code hint I could find is: "this.defaultCountries = [false,false];" in the JS on the page, whereas on a new Magento install (same version, same default country) it shows: this.defaultCountries = ['GB','GB'];

Matt
  • 22,721
  • 17
  • 71
  • 112
mattpark22
  • 741
  • 2
  • 14
  • 26
  • 1
    Just worked out that if I change my config to "Website" level, and uncheck use default for default and allowed countries under General. Then it works on the frontend (the country address dropdown), also works under creating a new order. But it still doesn't work under editing/creating a new customer in the admin backoffice. Very confusing... – mattpark22 Aug 21 '12 at 12:58
  • provide the URL which is passed in ajax to get countries. – Kalpesh Aug 21 '12 at 16:17
  • I've taken these snippets of code from the manage customers section, where the dropdown doesn't populate: `this.defaultCountries = [false,"GB"]; this.itemContentTemplate = new Template('#{prefix} #{firstname} #{middlename} #{lastname} #{suffix}
    #{company}
    #{street0}
    #{street1}
    #{street2}
    #{street3}
    #{city}, #{region}, #{postcode}
    #{country_id}
    T: #{telephone}
    F: #{fax}
    VAT: #{vat_id}'); this.regionsUrl = 'https://www.mydomain.co.uk/index.php/myadminpath/json/countryRegion/key/9a4636b0f154d816edefe750b20a9bca/';`
    – mattpark22 Aug 22 '12 at 08:30
  • Did you ever get to the bottom of this one? – Alex Hadley Nov 22 '12 at 16:42

4 Answers4

26

We ran across a similar issue, but ours started happening after everything had been functioning properly.

What we found was that in the core_config_data table, for some reason, there came to be an entry in there with a path of "general" (with nothing after it, or maybe "/general/")...

Point is, since it was one of the last entries, Magento treats that as create (in this case overwrite) the XML node "general" in the core_config that it builds, essentially wiping out all other data in that branch of the XML object.

If you find this entry in the table, you should backup the table (always be safe), and remove that entry. Then clear your cache, and you should find that things are back to normal.

We never did identify HOW the entry came to exist in the table, but that was the fix for us.

Rand
  • 656
  • 7
  • 6
  • 5
    How on earth did you infer that this was the root cause? Did you observe the XML config tree during generation to watch is overwrite? Very useful information -- I just experienced the same problem. Thank you for sharing. – Rick Buczynski May 29 '15 at 17:39
  • It was definitely a matter of observing the config tree during execution. The behavior was so bizarre that we wanted to know what the data showed from the config itself, and were very surprised. So we debugged the building of the tree itself and saw this. – Rand Nov 19 '15 at 16:22
  • Thank you so much for this answer! Saved me hours, possibly days, of time. Worked for me. – Nick Barthelemy Jun 02 '16 at 19:05
  • Wow, had this exact issue and it was plaguing us for days. Thank you so much for posting this. Would be interested to hear if you ever found the root cause of this rogue config entry – Josh Davenport-Smith Aug 08 '17 at 19:14
  • 2
    It can happen when you edit some values manually in database using some MySQL client - you can accidentally add new "empty" row, and the default value for path column is "general" – Roman Snitko Oct 11 '17 at 10:57
  • You Sir, are my hero. – davidvelilla Jun 29 '18 at 13:00
  • I agree with @davidvelilla, you sir are my hero! I solved this issue some 5 - 6 years ago, and I was digging but couldn't remember, I found this post and boom all better! :) – Rob Dec 03 '18 at 18:59
2

Following your lead I made sure that all countries that I needed were available in both the default and website scope and the options appeared in the admin.

nero
  • 521
  • 1
  • 7
  • 19
0

You need to go in System > Configuration > General > Allow Countries and include the countries you want to show in admin. Then the drop down menu should appear correctly for the countries you have picked.

I hope it solves your problem.

Vladyslav
  • 786
  • 4
  • 19
Anton
  • 1
0

Search on table 'core_config_data' in field 'path' remove a row with value 'general' without anything more, if it exist. then It will works

jacr1614
  • 1,250
  • 2
  • 14
  • 23