Street address shows City when street address is optional and not provided

This topic contains 17 replies, has 5 voices, and was last updated by  antoniomartin 4 years, 1 month ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #530391

    Bruce Frantzis
    Full Member
    Post count: 30

    We have set the “Street” field as optional on our site.
    When creating a listing the “Address” field must have a value for this plugin to work so we enter just “City” and “Country”. This works in every way but has a bug when the “Street” is show on the detail page.

    Address entered:

    Brighton, UK

    Detail page shows the address as:

    Brighton
    Brighton
    Brighton and Hove
    BN2 1RA
    United Kingdom

    Note that “Brighton” is listed twice in first two lines once as “Street” and once as “City”.

    I cannot simply hide the “Street” as sometimes it is provided as should be visible. There are no options in the UI to control this.

    Please advise,
    Thanks.

    #530413

    Guust
    Moderator
    Post count: 29970

    That would require your own customization.
    We usually suggest to use the name of the listing as the street address in cases like yours.
    Thanks

    #530441

    Alex Rollin
    Moderator
    Post count: 27815

    A recommendation:

    Use the Street2 field for the street address, then adjust your GD Post Address custom template to use street2 and not street.

    A

    #530805

    Bruce Frantzis
    Full Member
    Post count: 30

    Thanks for the suggestions but these are both work around for a bug making data entry/automation more difficult, involve unnecessary customization, reducing flexibility, and not addressing the core problem that this does not work as expected.

    The template is working correctly and is only showing values that are stored in the database. I cannot customize the template to fix this as Geodirectory is saving “Brighton” to “street” field in the database. This is the bug. I cannot hide it because I do not know if it is valid data. This field should be empty if street is not provided – right?

    Adding a custom field will not work as it will not get auto populated by the validated address returned from Google. So people who want to share their street address will have to enter it twice and the second input is not validated.

    Many places already use 2 lines for Street; Street1 for mailing and Street2 for Apartment/Suite number. In UK many places have names which go in Street1 and mailing street in Street2. Adding another Street field would overly complicate things.

    So please confirm that this is a bug by testing the entry of

    Brighton, UK

    in the Geodirectory Admin UI and looking at database “street” field to see if “Brighton” is saved. If it is then I consider this a bug. If you do not think it a bug then please explain why not.

    Thanks.

    #530859

    Alex Rollin
    Moderator
    Post count: 27815

    Hello,

    address fields are mandatory, including the street address field as well as city, region and country. A value must be included in the address field, and so in some cases the value retrieved from the API is left in place. It is not a bug.

    Are you using OSM?

    #531239

    Bruce Frantzis
    Full Member
    Post count: 30

    address fields are mandatory, including the street address field

    – There is a setting in Geodirectory v1 to make Street optional. Cannot find this in v2.
    – Geodirectory v1 and v2 allow entry without street as in the example provided above.
    -The Street field in database allows empty values.

    This was working for us in v1 and we are having problems with it whilst testing v2. Are you saying that this has changed?

    the value retrieved from the API is left in place. It is not a bug.

    Are you saying that it’s normal practice to copy the city into the street, if street is empty, rather than displaying address without street? That certainly does not sound like normal practice and does sound like a bug to me.

    Are you using OSM?

    Probably not as I do not know what it is. Please can you provide more info?

    Either way, bug or not, how can I fix this in code when the underlying stored data is wrong? It needs to be fixed in a way that hides City from Street field, does not make address entry more difficult, and retains functionality for people who:

    – Do not enter street
    – Enter 1 street line
    – Enter 2 street lines

    Please provide code samples of how to fix it.
    Thanks

    EDIT – previous reply did not display unordered lists. Tried to fix and the post disapperead. Posting again using simple dashes for lists.

    #531358

    Alex Rollin
    Moderator
    Post count: 27815

    The street field is required, and that is not a bug.

    However, you can place any value you want into the street field, and that is also not a bug.

    Using the GD Post Address widget/shortcode/block you can display any/all/none of the individual address parts on the frontend; GD Post Address gives you complete control over what parts of the address are displayed on the frontend.

    I would recommend that you start with the GD Post Address widget. It is only a matter of minutes to add the widget to GD Details Sidebar and then configure the advanced option (blue button) with a Template that displays only the address data you want to display in the order you want to display it.

    #531503

    Bruce Frantzis
    Full Member
    Post count: 30

    As I said before

    Geodirectory allow entry without street as in the example provided above.

    So how can it be required/mandatory? Can you enter “Brighton, UK” (without a street)? Or it this only happening on my site?

    However, you can place any value you want into the street field, and that is also not a bug.

    I cannot have “any value” in street because when I chose not to enter any value then Geodirectory code is inserting the City value. I do not want that. That is not how address entry works on any software I have used in my whole life. I don’t know how you can say “that is not a bug”. Name any other software that does this?

    The GD Post Address widget/shortcode/block only allows hiding the street address ALL OF THE TIME. I do not want that. I only want to hide the street IF it has not been entered.

    Can you show me how to do that?

    #531506

    Bruce Frantzis
    Full Member
    Post count: 30

    Found the setting in GeoDirectory v1. Note last form input in screenshot shows you can make it optional.

    #532831

    Bruce Frantzis
    Full Member
    Post count: 30

    Can I get a solution to my problem? This is stopping us from upgrading to GeoDirectory v2.

    #532873

    Alex Rollin
    Moderator
    Post count: 27815

    Hello,

    Unfortunately there isn’t a workaround, the street address is required.

    The image you point out is a bug in V1. Listings without a street address would not save in V1 either, or if they did they would break the functionality of GD. This is not a ‘feature’ that will be added to V2.

    One solution might be to try our new GD Dynamic Content Widget. Something like this:

    
    
    
    [gd_dynamic_content key="do_not_show_street_checkbox" condition="is_not_empty"][gd_post_address show="label-value" address_template="%%street2%%,%%city%%"][/gd_dynamic_content]
    
    

    For that, you could have a checkbox “Don’t show First Street Address Field”
    When the box is checked, only the second street2 field and City would show, or you can adjust that template as you like.

    Conditionally hiding items can be done with your own custom CSS in some cases, but, that will only hide it visually and the data will still be present.

    Instead, to conditionally hide items based on a field value, like the GD Dynamic Content widget example, or you can consider creating your own customization, or use a third party plugin or theme builder.

    #533345

    Bruce Frantzis
    Full Member
    Post count: 30

    I have to say that I am disheartened by the level of support on this issue. Clearly anyone can enter an address without specifying a street. Clearly Street is not a required field in the database. There really is no reason why this should be mandatory. This is a problem introduced in code that limits functionality unnecessarily.

    I am also disappointed that no good solution was provided to fix this. In the end I had to debug the code and implement a fix. To save others the hassle of contacting support I provide it below:

    Add this to theme functions.php file:

    
    
    
    // Hide duplicate City text intriduced by bug in geodirectory.
    add_filter( 'geodir_custom_field_output_address_fields' , 'duplicate_city_address_filter');
    function duplicate_city_address_filter($address_fields) {
      if (!empty($address_fields['street']) && !empty($address_fields['city'])) {
        $street_raw = strip_tags($address_fields['street']);
        $city_raw = strip_tags($address_fields['city']);
        if ($street_raw == $city_raw) {
          unset($address_fields['street']);
        }
      }
      return $address_fields;
    }
    

    This code checks the saved values of ‘Street’ and ‘City’. If they are the same, which happens when ‘Street’ was not entered, then the ‘Street’ value is removed and will not be displayed. This does not alter any saved data and is applied whilst the page is being rendered.

    #533397

    Guust
    Moderator
    Post count: 29970

    I am sorry that you feel that way. Your issue is not a bug but a special request. GeoDirectory is primarily designed to create map based listings, and therefore require a street address to get the correct latitude and longitude coordinates for the listing. If you do not use a street address, then all listings in the same city will normally all be located in exactly the same spot.
    For listings that do not require an address, a CPT can be created that doesn’t use addresses and maps.

    From our support policy at https://wpgeodirectory.com/support-policy/

    We provide GeoDirectory and its addons as are. We don’t provide customization services for them nor we support any 3rd Party customizations of our products. For customization we intend any html/css/php/js work that changes the way GeoDirectory and its addons look or function, in relation to the way we made GeoDirectory and its addons available to you.

    We understand that some people want to use our software for different uses, and that’s why we offer https://geodirectoryexperts.com/

    Thanks

    #533421

    Bruce Frantzis
    Full Member
    Post count: 30

    Your issue is not a bug but a special request.

    It is not a special request because this optional street address was a feature in v1 and is not in v2. That is a regression which is predominantly considered a bug. As I have stated multiple times, and which you continue to ignore, you can enter an address that does not have a Street in both v1 and v2.

    Either way the software has a bug. If the Street is mandatory then your UI has a bug in allowing an address without it. Otherwise, if not mandatory, then there is a bug with the software copying the City value into the Street field.

    therefore require a street address to get the correct latitude and longitude coordinates for the listing. If you do not use a street address, then all listings in the same city will normally all be located in exactly the same spot.

    Yes that is the point. Some businesses do not want their exact location known as that do not cater to walk in business. But prospective customers still need to know their rough location to know that they are nearby.

    We don’t provide customization services for them nor we support any 3rd Party customizations of our products.

    Again I am not asking you to customize anything. I am asking you to retain features between versions.

    #533452

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    Hi Bruce,

    Just to clear things up, we have always required an exact location, GPS to street. It is required if it’s not showing that then its a bug. We do have a feature that will fill the street with the best know info if somehow it is empty.

    Some businesses do not want their exact location known as that do not cater to walk in business. But prospective customers still need to know their rough location to know that they are nearby.

    At this point in time, we simply do not provide that functionality, an exact location is currently required (including street).

    We do have a task to implement what you are talking about, a sort of service area, though there are a few sticking points.
    1. What do we show on maps. Maps usually require an exact GPS for a pin. Our current thinking is simply don’t show anything on the archive maps and then show some sort of area map on the details page.
    2. Many of our features work with sorting by distance, how do we sort those in the distance orders, i guess the only fair way it to list them last.

    If it was easy we would have done it a long time ago, if you know of a directory currently mixes exact locations with non-exact locations please let us know.

    Your suggestions are welcome.

    Stiofan

Viewing 15 posts - 1 through 15 (of 18 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket