Beee4life / acf-city-selector

An ACF extension to create a new field type, where you can select a city based on country and provence/state.
38 stars 15 forks source link

I see countries but not cities #108

Open nadavlevyme opened 2 years ago

nadavlevyme commented 2 years ago

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

Beee4life commented 2 years ago

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

Try removing all countries and import a new one.

nadavlevyme commented 2 years ago

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

Beee4life commented 2 years ago

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 commented 2 years ago

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.

nadavlevyme commented 2 years ago

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.

Beee4life commented 2 years ago

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.

nadavlevyme commented 2 years ago

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".

Beee4life commented 2 years ago

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 commented 2 years ago

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.

nadavlevyme commented 2 years ago

Thanks, still nothing in the log file.

Beee4life commented 2 years ago

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 commented 2 years ago

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

nadavlevyme commented 2 years ago

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.

Beee4life commented 2 years ago

Have you been able to fix it in the meanwhile ?

nadavlevyme commented 2 years ago

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: @.***>

Beee4life commented 2 years ago

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.

nadavlevyme commented 2 years ago

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: @.***>

Beee4life commented 2 years ago

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

nadavlevyme commented 2 years ago

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: @.***>

Beee4life commented 2 years ago

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

eduhud commented 2 years ago

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.

Beee4life commented 1 year ago

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.

jlb-1985 commented 4 months ago

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 commented 4 months ago

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?

midrocket commented 4 months ago

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