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

Dowload all Hotspots entries
Hi there, I'm looking for a way to dowload all the Hotspots entries. I've got t...
0 Replies
Posted on Sunday, 06 April 2025
  • #kml
  • #download
Set number of hotspots / user groups
Hi, I'm working with Hotspots for my new website and I love it! After trying ...
0 Replies
Posted on Monday, 31 March 2025
J5 compatibility for Hotspots
Hi guys, Just started to update my old J3x website. Is there J5 compatibility p...
1 Replies
Posted on Monday, 24 February 2025
  • #Hotspots
  • #hotspots Joomla 5
Text size in the comment input form
Hello. How can I increase the font size in the comment input field? For examp...
0 Replies
Posted on Wednesday, 26 February 2025
  • #CComment 6
Problem with enlarged image
Hello. When you click on the image in the comments, it does not appear in the ce...
1 Replies
Posted on Wednesday, 26 February 2025