acf-city-selector icon indicating copy to clipboard operation
acf-city-selector copied to clipboard

I see countries but not cities

Open nadavlevyme opened this issue 2 years ago • 25 comments

Hey, I've added a few cities. When I set the field and select "All fields [default]" under "Fields to use", I see the Country > Region > City perfectly. When I select "Country + City" I can select country, but the cities list is empty.

See this short video with screen capture for more details: https://sharing.clickup.com/clip/p/t1866731/c9951cd2-4013-47e7-968d-104e255c9f41/screen-recording-2022-08-13-10%3A11.webm

What am I doing wrong?

Thanks

nadavlevyme avatar Aug 13 '22 07:08 nadavlevyme

"What you're doing wrong", is hard to determine based on this explanation.

Try removing all countries and import a new one.

Beee4life avatar Aug 13 '22 09:08 Beee4life

I tried what you suggested and still have the same issue. Anything else I could check or info I can send to make the situation more clear?

Thanks

nadavlevyme avatar Aug 13 '22 10:08 nadavlevyme

I have seen your screencast, but I can not reproduce this is a sandbox environment.

I get all cities in Holland, when country + city are selected. See screenshot.

Screenshot 2022-08-13 at 14 48 44

Beee4life avatar Aug 13 '22 12:08 Beee4life

I saw you use Gutenberg... The only thing I can think of right now, (but I think chances are small) is that that interferes in some way, but wouldn't see how.

Beee4life avatar Aug 13 '22 12:08 Beee4life

Thanks for the effort but still the same for me. I even tried reinstalling the plugin. Do you know of a simple way to create a dropdown of Country and Cities cascaded under the country? Like creating categories.

nadavlevyme avatar Aug 13 '22 14:08 nadavlevyme

Do you have an error log open or a console log ? Something must go wrong...

Did you also remove your custom country ? Maybe something goes wrong because of an incorrect import or something (just spitballing here...)

The plugin is being used by several other people, I bet this would have come up if it was an issue with the plugin so I do think it's on your end. I'd love to help if I know what's going wrong, but can't tell based on this info, sorry.

Beee4life avatar Aug 13 '22 17:08 Beee4life

I appreciate your help and sure the plugin works.

It's a new website with almost no other plugins installed. I tried deactivating any unrelated plugin, set the default theme, I've removed any data from the plug-in, and imported only the free list for the Netherlands.

I've set an error log plugin. I played around with the plugin, ACF, and the post and there were no errors The city selection works with all the options, except when I select "Country + City" under "Fields to use".

nadavlevyme avatar Aug 14 '22 06:08 nadavlevyme

Can u try installing the classic editor plugin (to disable gutenberg) ? Not sure if that is affected but I always disable it and did all tests without GB.

I will see if I can reproduce this with Gutenberg later on.

Beee4life avatar Aug 14 '22 14:08 Beee4life

I've set an error log plugin.

You don't need a plugin, just add

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );

to wp-config.php. Explained here. Then an error log will be written to /wp-content/debug.log.

Beee4life avatar Aug 14 '22 14:08 Beee4life

Thanks, still nothing in the log file.

nadavlevyme avatar Aug 14 '22 14:08 nadavlevyme

I just tried it with Gutenberg active, but it still works on my end.

Screenshot 2022-08-14 at 18 01 51

Which ACF version do you use ?

Beee4life avatar Aug 14 '22 16:08 Beee4life

I tested with both v4 and v5, both work, with/without classic editor. I have no idea what it could be.

Beee4life avatar Aug 14 '22 16:08 Beee4life

Thank you very much for the effort. I have no idea what's the issue. Worth case I might reinstall WP from scratch. This site is completely new.

nadavlevyme avatar Aug 14 '22 16:08 nadavlevyme

Have you been able to fix it in the meanwhile ?

Beee4life avatar Sep 20 '22 14:09 Beee4life

Hi, No. I just created a simple dropdown for countries.

On Tue, Sep 20, 2022 at 5:47 PM Beee @.***> wrote:

Have you been able to fix it in the meanwhile ?

— Reply to this email directly, view it on GitHub https://github.com/Beee4life/acf-city-selector/issues/108#issuecomment-1252466767, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKXRKOBKPQP5I2U7Y7HQPMDV7HE7FANCNFSM56NV6MJQ . You are receiving this because you authored the thread.Message ID: @.***>

nadavlevyme avatar Sep 20 '22 14:09 nadavlevyme

I'm sorry to hear that. I wish I knew what's going on. I still think it's related to the theme you use or some other plugin.

Beee4life avatar Sep 20 '22 14:09 Beee4life

I guess you're right, but I tried it with no other plugins but Elementor.

On Tue, Sep 20, 2022 at 5:58 PM Beee @.***> wrote:

I'm sorry to hear that. I wish I knew what's going on. I still think it's related to the theme you use or some other plugin.

— Reply to this email directly, view it on GitHub https://github.com/Beee4life/acf-city-selector/issues/108#issuecomment-1252485081, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKXRKOE3P72WCYAHUDSL2VLV7HGKVANCNFSM56NV6MJQ . You are receiving this because you authored the thread.Message ID: @.***>

nadavlevyme avatar Sep 20 '22 15:09 nadavlevyme

That might explain it partially. Have you tried it without ?

Beee4life avatar Sep 20 '22 16:09 Beee4life

I don't remember. I think I did but I'm not sure.

On Tue, Sep 20, 2022 at 7:37 PM Beee @.***> wrote:

That might explain it partially. Have you tried it without ?

— Reply to this email directly, view it on GitHub https://github.com/Beee4life/acf-city-selector/issues/108#issuecomment-1252614852, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKXRKOFZRODGJXRB34NIILTV7HR3ZANCNFSM56NV6MJQ . You are receiving this because you authored the thread.Message ID: @.***>

nadavlevyme avatar Sep 21 '22 07:09 nadavlevyme

I'd recommend trying it in a fresh install. Only thing I can recommend now I think.

Beee4life avatar Sep 21 '22 09:09 Beee4life

This happened to me too, its a problem with the front-end js when using acf_form() function.

I solved myself changing the .js from acf-city-selector: When country_city method is selected and used acf_form() function for front-end display, the ajax function called is get_state_code instead of get_city_code, I changed the inArray 'all' from the first casuistic to the second one and now it loads correctly.

If you want more details ask me and I will send you the js modified file.

eduhud avatar Sep 27 '22 23:09 eduhud

When country_city method is selected and used acf_form() function for front-end display, the ajax function called is get_state_code instead of get_city_code, I changed the inArray 'all' from the first casuistic to the second one and now it loads correctly.

I did not know that. I will look into that.

Beee4life avatar Nov 05 '22 20:11 Beee4life

I have this problem with the Belgium cities. I use the Netherlands and Belgium. The Dutch cities are all visible, but the Belgium cities are invisible. I tried to delete everything and import it again, but didn't solve the problem.

jlb-1985 avatar May 19 '24 22:05 jlb-1985

This happened to me too, its a problem with the front-end js when using acf_form() function.

I solved myself changing the .js from acf-city-selector: When country_city method is selected and used acf_form() function for front-end display, the ajax function called is get_state_code instead of get_city_code, I changed the inArray 'all' from the first casuistic to the second one and now it loads correctly.

If you want more details ask me and I will send you the js modified file.

Can you please explain to me how to do this?

jlb-1985 avatar May 20 '24 10:05 jlb-1985

Created a pull request, check it out @jlb-1985 @Beee4life

midrocket avatar May 20 '24 11:05 midrocket