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

Veranstaltung im Frontend sichtbar obwohl nicht ve
Hallo, folgendes Problem stellt sich mir: Wenn ich eine Veranstaltung dupl...
4 Replies
Posted on Friday, 09 February 2024
Suche bei der Matukio - Fehler Ö Ä Ü..
Hallo, evtl. könnt ihr mir weiterhelfen. Bei mir funktioniert die suche bei ...
3 Replies
Posted on Wednesday, 15 May 2024
  • New
  • When is CComment compatible with Joomla 5?
    When is CComment compatible with Joomla 5?...
    4 Replies
    Posted on Tuesday, 05 December 2023
    • #CComment
    • #Joomla 5
    _MATUKIO_NO_EVENTS appears in the frontend if no e
    Hello, there ist still the problem, that on the frontpage appears COM_MATUKIO...
    2 Replies
    Posted on Sunday, 12 May 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...
    3 Replies
    Posted on Monday, 29 April 2024