Is there any instruction (I could not find) written on integrating Google Maps with Price Tapestry script, e.g. for use with a hotels data feed. The feed has hotel address as well as latitude and longitude data. Thanks.
Could you guide how to embed this data in the WordPress plugin. Thanks.
Hi,
Sure! Within the WordPress plugin, the HTML would be added to your Product / Main template (wp-admin > Settings > PriceTapestry.org). Here, instead of using the PHP variables, you would use the custom field placeholders - in this case %DB_lat% and %DB_lon%, so the code you would need to add to your template would be:
<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com/?ie=UTF8&ll=%DB_lat%,%DB_lon%&spn=0.045174,0.110378&t=m&z=13&output=embed"></iframe><br /><small><a href="https://maps.google.com/?ie=UTF8&ll=%DB_lat%,%DB_lon%&spn=0.045174,0.110378&t=m&z=13&source=embed" style="color:#0000FF;text-align:left">View Larger Map</a></small>
Hope this helps!
Cheers,
David.
--
PriceTapestry.com
Hi,
Google Maps working great... but how to add marker or marker with bubble info (with name and address)?
Thanks for any help :)
Hello Milano,
Assuming you have the standalone Price Tapestry version working, having added to your includes/product.php template file similar to the following:
<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com/?ie=UTF8&ll=<?php print $mainProduct["lat"]; ?>,<?php print $mainProduct["lon"]; ?>&spn=0.045174,0.110378&t=m&z=13&output=embed"></iframe><br /><small><a href="https://maps.google.com/?ie=UTF8&ll=<?php print $mainProduct["lat"]; ?>,<?php print $mainProduct["lon"]; ?>&spn=0.045174,0.110378&t=m&z=13&source=embed" style="color:#0000FF;text-align:left">View Larger Map</a></small>
...all you need to do is add a new parameter to the iframe src URL called daddr (destination address) and Google will then add a green pin to the map at this location. The address value must be URL encoded, so assuming that you have added the custom field `address` to your site, and you're already using `lat` and `lon` fields as described above, then the following should do the trick:
<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com/?ie=UTF8&daddr=<?php print urlencode($mainProduct["address"]); ?>&ll=<?php print $mainProduct["lat"]; ?>,<?php print $mainProduct["lon"]; ?>&spn=0.045174,0.110378&t=m&z=13&output=embed"></iframe><br /><small><a href="https://maps.google.com/?ie=UTF8&daddr=<?php print urlencode($mainProduct["address"]); ?>&ll=<?php print $mainProduct["lat"]; ?>,<?php print $mainProduct["lon"]; ?>&spn=0.045174,0.110378&t=m&z=13&source=embed" style="color:#0000FF;text-align:left">View Larger Map</a></small>
Hope this helps!
Cheers,
David.
--
PriceTapestry.com
It's working :) Thank you!
And one thing... Maybe I did something wrong but in newest PT this function, eg.:
<?php
print $mainProduct["lon"];
?>
Hi Milano,
That's the correct modification for 14/06A, I changed the main product variable to $product_main in html/product.php for namespace consistency.
Cheers,
David.
--
PriceTapestry.com
Hi,
It's not something that's been covered, but if you have added, say, "lat" and "lon" as custom fields then it would be easy to implement Google Maps as an embedded object (IFRAME) on your product page with the lat and lon from the $mainProduct variable. Have a go with something like this within html/product.php:
<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com/?ie=UTF8&ll=<?php print $mainProduct["lat"]; ?>,<?php print $mainProduct["lon"]; ?>&spn=0.045174,0.110378&t=m&z=13&output=embed"></iframe><br /><small><a href="https://maps.google.com/?ie=UTF8&ll=<?php print $mainProduct["lat"]; ?>,<?php print $mainProduct["lon"]; ?>&spn=0.045174,0.110378&t=m&z=13&source=embed" style="color:#0000FF;text-align:left">View Larger Map</a></small>
Hope this helps!
Cheers,
David.
--
PriceTapestry.com