Jump to content

Link product list to Google Maps


oodya

Recommended Posts

Not overly familiar with Google maps API as haven't really used it much.

 

But in theory it's perefectly possible to get their location (i.e. gelocation - http://code.google.com/apis/gears/api_geolocation.html )then have a script on your site that would calculate the closest shop (if product exists) using something like google maps distance matrix thingy - http://code.google.com/apis/maps/documentation/distancematrix/ . And if you've gone that far then displaying the shop location on a google map should be a piece of apple pie!

 

 

Link to comment
Share on other sites

Hmm i think the best solution to that will come out of you becoming much better acquainted with google maps api (which i'm not).

 

But i would imagine your stock table (simplifying this of course) might have a related table for store locations (so every product is assigned to one or more stores). You might store the geolocations of those stores in the DB since they wont change. 

 

Then when someone browses for say 'pumpkins' on your site, your script looks up the item, and finds the stores in which that item is located. So you now know that pumpkins are stocked in store 1 and store 2 and you have the geolocations of those stores.

 

You might then have a "user location " function and a "distance " function.

 

The user location function would pinpoint the user's location. The distance function would 'range check' the user's location relative to the store locations you've stored. Then you might run another function to display this data on the map (through google maps api).

 

As i said that's all very simplified and speculative as i'm not overly familiar with google maps api but i reckon that's doable.

 

 

 

 

Hi,

 

Many thanks for the prompt response.  I can read through the links that you sent me and see what I can come up with.

 

I just have one more question - How do I link the maps to my stocklist?

 

Thanks.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.