How to change text and set address on map ( Add-listing )

This topic contains 23 replies, has 4 voices, and was last updated by  Ding Hua 7 years, 4 months ago.

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

Open Support Ticket
  • Author
    Posts
  • #326974

    Ding Hua
    Expired Member
    Post count: 152

    Hi Stiofan,

    When I use it , I got error zero result .
    Refer attached files for my setting and results.

    Rgds,
    YC

    #327197

    Paolo
    Site Admin
    Post count: 31206

    Are you trying to use the region field and city field for something else?

    I don’t think that will ever work. You must use what Google Maps API returns for those fields.

    I’ll let Stiofan add more comments to that.

    Thanks

    #327456

    Ding Hua
    Expired Member
    Post count: 152

    Hi Paolo,

    It just work.
    Look at my my-setting.png.
    There are two setting I ticked.

    Disable set address on map from changing address fields
    Disable move map pin from changing address fields

    This two setting make sure it won’t break my custom location by the values of region and city from api return.Because locations are not known by the Google API and this prevent breaking my custom location.

    It works perfectly as it suggest and meet what users need.

    The only problem now is api query. It seems like api query is not using postal code that user enter.
    api query only use address and some of the address in Singapore are not know by google map api.

    That is why I requesting option to configure api to use only postal code and country to query like below(postal,country) which return accurate map location in Singapore from google map.

    http://maps.googleapis.com/maps/api/geocode/json?address=732895,Singapore

    Rgds,
    YC

    #328427

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    Seems to work find for me? The zip is sent.

    Stiofan

    #328704

    Ding Hua
    Expired Member
    Post count: 152

    Hi Stiofan,

    Pls try this address

    Block 515 Woodlands Drive 14 Singapore 730515

    refer attached file geo-directory-not-able-to-get-map-location.png , Geo Directory unable to get correct map location and Zero_result error come out for the address “Block 515 Woodlands Drive 14 Singapore 730515.And the map location,log/lat is not showing in correct place.

    For the same address I tried below three methods , all works and google map able to return map location accurately .

    1) key in address “Block 515 Woodlands Drive 14 Singapore 730515” in google map , found working.refer attached file same-address-postal-code-country-on-google-map-ok.png
    2) api query using the whole address “Block 515 Woodlands Drive 14 Singapore 730515”, found working , refer api-query-for-the-same-address-postal-code-country-ok.png
    3) api query using only country and postal code , found working , refer to api-query-with-postal-code-and-country-only.png

    So not sure why Geo directory is not able to locate the correct map location for the same address and having Zero_Result error message.

    Rgds,
    YC

    #329293

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    try this code snippet: (not tested)

    
    
    add_action('geodir_add_listing_codeaddress_before_geocode','_my_set_address_street_zip');
    function _my_set_address_street_zip(){
    ?>
    address = jQuery('#post_address').val();
    address = address + ',' + country + ',' + zip;
    <?php
    }

    Stiofan

    #329565

    Ding Hua
    Expired Member
    Post count: 152

    Hi Stiofan,

    The code is not working. It even bream my entire website and could’t log in anymore.
    I need to delete the code snippet plugin folder to solve it.
    And I cannot install again same code snippet plugin, all my other code snippet currently using are gone.
    I got to use another variant code snippet plugin for others.

    Pls give me the correct one.

    Rgds,
    YC

    #329659

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    if your server does not have php shorttags enabled that could throw an error.

    This code is tested:

    
    
    add_filter('geodir_codeaddress','_my_set_address_street_zip',10,1);
    function _my_set_address_street_zip($codeAddress){
    	
    	$codeAddress =  $codeAddress ." address = jQuery('#post_address').val(); address = address + ',' + country + ',' + zip; ";
    
    	return $codeAddress;
    }

    Thanks,

    Stiofan

    #329664

    Ding Hua
    Expired Member
    Post count: 152

    Hi Stiofan,

    This new code is working fine.
    Thanks.

    Rgds,
    YC

Viewing 9 posts - 16 through 24 (of 24 total)

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

Open Support Ticket