I'm thinking of using Loki in admin of my webstore so that I from my
order pages can get a location for the purchasing customer. I have the
IP number of the customers but can't get the map to show and can't
understand how to input the IP number properly. I use a CS-Cart store
with Smarty classes and have entered this Loki code into my order
pages:
{literal}
<script type="text/javascript" src="
http://loki.com/plugin/files/
loki.js"></script>
<script type="text/javascript">
//<![CDATA[
var map;
function init() {
// Setup the GMap instance
map = new GMap2(document.getElementById("map"));
map.setCenter(new GLatLng(42.364632, -71.058368), 13);
// and kick off the Loki request
requestLocation();
}
function requestLocation() {
var loki = new LokiAPI();
loki.onSuccess = function(location) {
// Populate form input fields
document.getElementById("address").value = location.house_number+'
'+location.street;
document.getElementById("city").value = location.city;
document.getElementById("region_code").value =
location.region_code;
document.getElementById("postal_code").value =
location.postal_code;
// Reset the center of the map and place a new marker
var point = new GLatLng(parseFloat(location.latitude), parseFloat
(location.longitude));
map.setCenter(point, 13);
var marker = new GMarker(point);
map.addOverlay(marker);
marker.openInfoWindowHtml('<strong>Your location</strong><br/
>'+location.latitude+', '+location.longitude+'');
};
loki.onFailure = function(error, msg){
alert('An error has been encountered ('+error+'). '+msg);
};
loki.setKey("beta");
// Here we want the entire location object returned -- lat/lon and
full reverse geocode
loki.requestLocation(true,loki.FULL_STREET_ADDRESS_LOOKUP);
}
window.onload = init;
//]]>
</script>
{/literal}
Can anyone please point me in the right direction?
Thank you!
Bill