1. Hubbitus
  2. Bug report
  3. Sunday, 11 July 2010
  4.  Subscribe via email
Parsing textual representation of address often do wrong results (at least for my country - Russia). Google provide this information also in object properties, I think better use it.

Patch provided:
[highlight]Index: administrator/components/com_hotspots/views/edit/tmpl/default.php
===================================================================
--- administrator/components/com_hotspots/views/edit/tmpl/default.php (revision 88)
+++ administrator/components/com_hotspots/views/edit/tmpl/default.php (revision 91)
@@ -61,27 +61,34 @@
place = response.Placemark[0];
point = new GLatLng(place.Point.coordinates[1],
place.Point.coordinates[0]);
- addressfull = place.address;
- addresssplit = addressfull.split(\",\";);
- streety = addresssplit[0];
- plzsplit = addresssplit[1].split(\" \";);
- plz = plzsplit[1];
- town = plzsplit[2];
- country = addresssplit[2];

- document.getElementById('street').value=streety;
- document.getElementById('plz').value=plz;
- document.getElementById('town').value=town;
- document.getElementById('country').value=country;
- document.getElementById('gmlat').value=place.Point.coordinates[1];
- document.getElementById('gmlng').value=place.Point.coordinates[0];
+ var zip; // Zip not always set for each address, so we need search it
+ try{
+ \$each(
+ response.Placemark
+ ,function(el, idx){
+ if(el.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea && el.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.DependentLocality && el.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.DependentLocality.PostalCode){
+ zip = el.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.DependentLocality.PostalCode.PostalCodeNumber;
+ throw 'end';
+ }
+ }
+ )
+ }catch(e){}

- addnew.openInfoWindowHtml( '" . JTEXT::_('Street') . " ' + streety +
- '<br />' + '" . JTEXT::_('ZIP') . " ' + plz +
- '<br />' + '" . JTEXT::_('Town') . " ' + town +
- '<br />' + '" . JTEXT::_('Country') . " ' + country +
+ $('street').value = street = (place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.DependentLocality.Thoroughfare ? place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.DependentLocality.Thoroughfare.ThoroughfareName : 'undefined');
+ $('plz').value = zip;
+ $('town').value = place.AddressDetails.Country.AdministrativeArea.AdministrativeAreaName;
+ $('country').value = place.AddressDetails.Country.CountryName;
+ $('gmlat').value = place.Point.coordinates[1];
+ $('gmlng').value = place.Point.coordinates[0];
+
+ addnew.openInfoWindowHtml( '" . JTEXT::_('Street') . " ' + street +
+ '<br />' + '" . JTEXT::_('ZIP') . " ' + zip +
+ '<br />' + '" . JTEXT::_('Town') . " ' + place.AddressDetails.Country.AdministrativeArea.AdministrativeAreaName +
+ '<br />' + '" . JTEXT::_('Country') . " ' + place.AddressDetails.Country.CountryName +
'<br />' + '" . JTEXT::_('Gmlat') . " ' + place.Point.coordinates[0] +
- '<br />' + '" . JTEXT::_('Gmlng') . " ' + place.Point.coordinates[1] );
+ '<br />' + '" . JTEXT::_('Gmlng') . " ' + place.Point.coordinates[1]
+ );
}});
}
});
[/highlight]
Responses (3)


There are %s replies to this question. If you want to see them you need a valid subscription.
If you have a valid subscription, please login now.
Visit store now

Last questions

Complete Uninstall to Work in J4??
We have recently updated a site from Joomlav3 to v4 (4.4.2). Now when we go to m...
2 Replies
Posted on Tuesday, 30 April 2024
  • New
  • verschiedene URL's für Kursübersicht einer Kategor
    Hallo, ich habe eine Frage in Bezug auf SEO: ein externer Spezialist macht die...
    1 Replies
    Posted on Monday, 29 April 2024
  • New
  • Google no index für bestimmte Seiten/Details
    Hallo ich habe eine kleine Frage: wo kann ich einstellen, dass Google die Seite...
    1 Replies
    Posted on Wednesday, 24 April 2024
  • New
  • Changes to Submission Form?
    Are you able to make changes to the Hotspot submission form? There are several f...
    0 Replies
    Posted on Friday, 26 April 2024
  • New
  • Question regarding custom fields
    How do I access custom fields after I have created them?...
    0 Replies
    Posted on Wednesday, 24 April 2024
  • New
    • #custom fields