Coder Social home page Coder Social logo

acf-city-selector's People

Contributors

beee4life avatar inquota avatar mrjohnmc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

acf-city-selector's Issues

Raw import not working & some city files not available

Hi,

I've been trying to import raw text pasted using "Import CSV data (from clipboard)" and when trying to import it drops me an error with the strpos function on line 607 in file /inc/acf-functions.php. I changed that line and now it works:

// Removed line as it receives array instead of file, we check if its array to import raw
//if ( strpos( $file_name, '.csv', -4 ) !== false ) {
if( !is_array($file_name) ){

Also, the cities for the countries Aruba, Curaçao, Grenada, Haiti are not available.

Regards.

Custom post type archives based on city selector fields

Hello, thanks for the interesting plugin. We are moving a site from Drupal to WordPress and were searching for the plugin functionality - being able to select country > region > city.

We have a directory of clubs (a custom post type). The URL structure is:

website.com/clubs/post

We'd also like visitors to be able to find clubs based on country / region / city, with archive pages like this:

website.com/clubs/germany
website.com/clubs/germany/brandenburg
website.com/clubs/germany/brandenburg/potsdam

If a visitor clicks on the first link, they'll see all clubs in Germany; if they click on the second, they'll see all clubs in Brandenburg and so on.

Looking at the documentation I didn't find anything about this, but based on issues #100 and #85, it sounds like this is not possible with the plugin?

I have been reading about how to create custom permalinks containing custom fields, but haven't found anything about how to create archive pages based on custom fields. Perhaps it's not possible. The plugin is great and UI very easy to use, but it sounds like we will have to use native WordPress hierarchical taxonomies instead.

Load selected country, states and cities when editing a post

Hi, I'm from Indonesia. I use your plugin and I'm very satisfied.

But, I found some (maybe) problems about your plugin. I will explain my problem..

  1. I added an ACF City Selector to the field using the City Selector type (listed in the Options section). Then I added some states and cities to my database. And it works like a screenshot below.
    1
    This post ID = 4015

  2. Then I click the Update button to update my post. That works, because ACF City Selector post meta has been saved in the database, like the screenshot below.
    2

  3. But when I edit my post again, ACF City Selector does not show selected country, states and cities like the following screenshot.
    3

Please help me how to fix this problem. thanks.

Not returning enough cities

  • I bought and uploaded the 'Canada' file from the plugin author (3018 Canadian cities)
  • Cleared all plugin data
  • uploaded the new file and activated (ca.csv)
  • Reviewed all ACF Cities plugin settings (cleared transients)
  • Reviewed the support documentation on the author's site
  • Reviewed tickets on github
  • Zero leads
    The tool is not returning the full data set. For example, the selection field is only returning 16 cites starting with "B" in Ontario. The data file contains 61

{$wpdb->prefix}cities table is not created automatically, label & instruction improvement

Impact
The plugin adds a database table named {$wpdb->prefix}cities upon plugin activation and imports cities from 3 different countries.

  1. Plugin activation doesn't create any database table, had to run the following sql code to create the table manually
    CREATE TABLE <?php echo wp_cities ( id int(6) unsigned NOT NULL auto_increment, city_name varchar(50) NULL, state_code varchar(3) NULL, state_name varchar(50) NULL, country_code varchar(2) NULL, country varchar(50) NULL, PRIMARY KEY (id) ) COLLATE utf8mb4_unicode_ci;

The option of importing cities from the existing 3 countries is in plugin's "Settings" page.

  1. When a default country is set in custom fields settings, the default value (label) for 'State' option should be 'Select a province/state", instead of 'Select a country first'
  • with default country set
    incorrect label

  • no default country set
    correct label

  1. request of feature:

Currently in "Fields to use", there're following 4 options
correct label
Can you also add the option "State/province + City", for the case to use only 1 country?

Thanks a lot for the awesome plugin, regards!

Working with taxonomies

Thanks for creating this, there’s surprising not a lot out there.
When you say works “on taxonomy terms” I’m not clear how to implement this and make a connection with my custom taxonomy?
As far as I can see I can only select one Field Type - either City Selector or Taxonomy and I can’t see a filter to connect taxonomy terms.
Ideally I would like to store as hierarchical taxonomy country>state>city in order to simplify use in other functions like 3rd part search plugins.
Any suggestions would be appreciated.

ACF City Selector Csv

Hello! Thanks for great plugin. I checked your demo version here http://acfcs.berryplasman.com/see-it-in-action/ and it looks really good. Could you help me, please? I need the cities and states for US, but i can't find a great csv file with all data. I noticed in demo, that you have the US states/cities. Could you send me the csv file, please?
Also could you explain how to show this 3 fields on the front-end as on your demo? I'd be really greatful for your reply! Thanks.

how to list all states in a country and cities

Hello, Congratulations for the plugin you did.

I am trying to use get_field_object () to get all the
States and cities, to create a filter in the frontend, could you help me?

Here is an example of how I'm trying to do it.

Thank you

$field_key = "field_5b4df093b4581";
$field = get_field_object($field_key);

if( $field )
{
echo ''; foreach( $field['choices'] as $k => $v ) { echo '' . $v . ''; } echo '';
}

Display on front

Hello and thanks for this plugin.

I've installed it and it works on backoffice very well.

However I would like to display it on front page in a search form.
I've seen that you make it here : http://acfcs.berryplasman.com/see-it-in-action/

Can you help me how to do this ?

Thanks in advance.

Regards,

Kévin

Filter results / data

Hello, first of all very good work!

My query is how to store country / state / city fields as metadata to be able to filter later?
I am using Search & Filter, and it does not detect the waterfall fields.

https://www.bobz.co/dynamically-populate-select-fields-choice-in-advanced-custom-fields

I'm following this thread to be able to auto-fill cascading fields, but I'm done with your plugin, which is fantastic.
Might you help me? or tell me how to do the exposed turorial?

Thanks!

Field value with this symbol ' are not visible

Hi,
i have create and uploaded my cities.csv file on my local website but i have found a problem. The field value with this symbol ' are not visible.
For example if
State = Sardegna (it is visible)
State = Valle d'Aosta (it is not visible)

Cattura

No Country or City pr State are showing after importing csv file correctly.

Dear Beee4life,

I am trying to import cities for Lebanon.
Everything worked fine and all the cities, districts and country were imported succeffuly.
But nothing is showing in the ACF field.
The CSV file example is: Aadouiye;Akkar;Akkar;LB;Lebanon.

I tried your first suggestion to delete the transients (mentioned in a previous issue closed for no reply) but it didn't work.
Nothing is showing. Any idea to how I can fix this?

Thank you.

Feature request - Taxonomy as source

Hi,

This looks very promising for a non-developer like myself. Any chance you'd add the ability to choose a custom -hierarchical- taxonomy as a source for the selector? The applications would be limitless. Country/State, Make/Model, Product Category/Subcategory.

Localization support

Hi! Could you add fields in admin panel for select necessary countries list or wp filter in populate_country_select and other? This will be enough to support localization via wpml for example.

Cities not displaying into select list in custom post type edition

Hello,
Since a few days, my new cities aren't displaying into the select list when I'm editing/creating a new custom post type event, which is using the city selector. My new cities are correctly added into the database (I've checked by the search tab into the City Selector plugin and into the database of the website). But, when I'm editing an event, I don't have the new added cities displaying into the select list.
I've tried deleting transients, deleting cache, etc. I've ACF and City Selector up to date.
Do you have any idea what is going wrong?
It was working fine a few days ago but now, it's not and I can't find why...
Thanks a lot for your feedback.
Best regards,
Anaïs

Show countries and states even when city is not selected

If you select just a country and state or just a country, nothing returns on the front end without a city selected. Would be great if, when I only have the country selected, the country will come through when getting the field.

Thanks!!

Attaching city-selector to users

I have a similar issue to #15.

When I attach a city_selector field to a user, it appears to be working properly as follows:

  1. On the user profile screen in the backend, the city, state and country can be selected and display perfectly.
  2. When the user profile is saved, the city-selector field in the usermeta table is updated properly.

Unfortunately the State and City fields are no longer rendered on the user profile screen. These fields are empty despite the fact that the selections are correctly stored in the usermeta table. If anything else is changed in the user profile, it is necessary to re-enter these fields in order to save the changes. This requires first selecting another country, state, city, then re-entering the original country, state and city.

I have no idea how to fix this. I tried adding the code shown in issue #15 to my functions.php but it made no difference.

Thanks in advance for any advice/assistance with this issue.

SQL query in Import file is wrong

In the import excel file, the query is:

="INSERT INTO "&README!$D$15&"cities ( city_name_ascii, state_code, states, country_code, country )"

But the table structure is:

image

City value can't remain in AC field's form

Hello,

When someone selects Country, State and City, after the update, the value of the city does not remain in the form. The mentioned price simply does not appear in the form and in addition to this, there is no city to choose from.

If he chooses another state then he sees the corresponding cities. After that if someone selects the previous state then the cities of the first state return available for selection.

watch this video below:
https://www.youtube.com/watch?v=yDT_p0GtDK8

City not showing after importing from CSV

Hello guys,

a long time ago we did a huge import of cities (like 100 entries or so) in a project and is working normally. Now the unhappy part is when we try to import a new city and all the process is ok but unfortunately it is not showing in ACF selectors in our post as others cities/countries do.

The new city is showing in acf-city-selector dashboard and it is correctly added to DB (sounds obvious) but we dont know why is not showing in the selectors. Not sure if it is an ACF or ACF-City-Selector issue.

Any clue on how to fix this?

GB csv full of errors

Hi

I have purchased the GB csv and imported it. Unfortunately it is full of errors, including missing counties, incorrect counties, counties that no longer exist, and many of the towns/cities are actually small villages or hamlets and so are likely to be of little use.

Also this should be called UK (United Kingdom) as it contains data from Northern Ireland which is not in Great Britain.

Thanks

Warning: strpos() expects parameter 1 to be string

When I try to add new data through pasting from clipboard or typing

Screenshot 2021-08-23 at 14 47 42

the data will get validated. However, when I try to click import csv data, I get this error.
However, using a .csv file is alright. No errors.

( ! ) Warning: strpos() expects parameter 1 to be string, array given in public/wp-content/plugins/acf-city-selector/inc/acfcs-functions.php on line 622

Suggestion: option to set a default country

Hey,

Great plugin, just what I needed! Got a suggestion though:

It would be nice to be able to set a default country so you only need to set the state/province and city.

Verder goed bezig! ;-)

Feature request: work with JetSmartFilters and JetEngine

Hi @Beee4life ,

I have managed to install the plugin and imported the cities of Portugal in the database, added a custom field for my JetEngine custom post type, everything worked smoothly except the minor issues I reported in #62 .

However, I am not able to find a way to use JetEngine Dynamic Fields to get the values of city/state/country, and can't use JetSmartFilters to filter my listings with the different cities.

Is it in your radar to make such enhancement in future, or is it too much to ask?
In my option, these are very useful features which can benefit a lot of users.

Looking forward to your feedback, regards!

Canada file - just downloaded - 2 errors

Just bought the Canada file
Download
Imported

"There are too many columns on line 162. Since your file is not accurate anymore, the file is deleted.

There are too many columns on line 2658. Since your file is not accurate anymore, the file is deleted."

Why?

meta query search/filter

Thanks for the great plugin.

I have a question and probably will be handy too in the future for others. Are we able to use meta query when we search/filter using wp_query? I was thinking it'd be similar like ACF group_field, but it's not working for me, maybe you can point out the right direction.

'meta_query'    => array(
    array(
        'key'       => 'field_name_countryCode',
        'compare'   => '=',
        'value'     => 'AU',
    )
)

Ability to save country only

We have cases on the project where user needs just select a country.
Currently if select a country, do not select a city and then click save, country is not saving.

Also in case if just to show country field only and save it is not saving results.

WordPress 5.4.2
ACF PRO 5.8.9

US Countries not working.

The us.csv file has the errors 'There are too few columns on all lines. Since your file is not accurate anymore, the file is deleted.

Regards,

Javascript error when used on a User Form, Register page on Register Page

Thank you for the AMAZING work on the plugin!

When I add the city selector with those settings.

setting example

Then go to: [sitename]wp-login.php?action=register

And try to select a city, I get the following error in the dev tools console:
Uncaught ReferenceError: ajaxurl is not defined

error

I found that the ajax url is added only on the wp_head hook.

ajax-url

The hook called for the registration page is called login_head.

By adding
add_action( 'login_head', 'city_selector_ajaxurl' );
Right below line 13, triggers the login_head, and ads to ajax and fixes the problem.

Did you want me to PR?

Let me know

City won't selected if its string contain apex

@Beee4life I found an issue on your lastest 1.3.1 version of plugin.

If the City name contain apex (or apostrophe), it won't "saved" properly.
For example:

"City name" is saved properly.
"City's name" won't saved.
Debugging a bit: in database the value of City appear stored as serialized array without any escape char before the apex.

I opened the "acfcs-functions.php" and edit the lines 536, 543 and 550 with:

$selected_value = esc_attr($stored_value);

Now the City with apex will appear properly as selected on the dropdown.

That's strange, before appling the above code, by echoing $key and $selected_value, they appears as equal strings, but at line 572 the ternary condition doesn't work as expected.

I'm no pretty sure about this method could be the best, maybe you need to check or escape the chars before store values.
I have not much time to investigate better, but take a look and check yourself.

Other counties?

Hi there, I love your plugin, but was curious if you're looking into expanding the country set. The countries you support are great, but obviously missing a ton.
Also, would you consider offering a multi-pack that contains all the cities for a savings instead of purchasing all separately? Or even a subscription where you pay and get all future updates?

Using acf-city-selector with Search and Filter Pro

I have a custom post type called 'Venues'.

I created an ACF Field Group for this custom post type, and 'acf-city-selector' is one of the fields in this group.

It works beautifully on:

  1. My front-end-form. It worked straight 'out of the box' with Hookturn's 'Advanced Forms Pro' plugin which I highly recommend for use with the acf-city-selector add-on (the only foms plugin I could find that worked).
  2. The backend post edit screen.
  3. My Beaver Themer singular post layout for this custom post type (after adding the code in the documentation to my functions.php file and using a shortcode in my posts layout).

But now I want to use it in a filter so site users can filter the posts to their own location. I have it working in Search and Filter Pro BUT it doesn't provide the 3 droptdowns for Country, State and City but rolls them all into a single dropdown showing codes but not names. This is not useable.

So I'd appreciate some advice on a search plugin that will work with City-Selector or some PHP code that will enable it to display properly in my filter.

Thanks

Extend it with CPT

Hello there,

It would be awesome , not only using CSV for uploading countries, but with Custom Post Types and Taxonomies maybe?

Where your CPT can be a country etc. or something else.. this plugin can be used in many sittuations, one nice one is something like a simple booking by city and cpt.

Reduce long loading time of cities and state

We encountered a very long waiting time, after selecting a country the interface freezes.
It looks that it makes second request for load all cities and in cases like India it is about 2.7s.

image

Is there are reason to pre load all cities right after load states?
Also is there are way to optimize server time? Currently execution of get_states_call time is about 450-600ms, so for users is start to be not good experience.

Thank you for support

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.