Merge pull request #465 from touffies/googlemap
Contact Page : Replace IFRAME by GMAP API V3.
This commit is contained in:
File diff suppressed because one or more lines are too long
BIN
templates/frontOffice/default/assets/img/googlemap-icon.png
Normal file
BIN
templates/frontOffice/default/assets/img/googlemap-icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 927 B |
@@ -1242,7 +1242,10 @@ td.product,
|
||||
|
||||
// Page Contact
|
||||
#google-map {
|
||||
border: none;
|
||||
display: block;
|
||||
margin-bottom: @line-height-computed;
|
||||
width: 100%; height: 350px;
|
||||
@filter-map: ~"grayscale(100%)";
|
||||
-webkit-filter: @filter-map;
|
||||
-moz-filter: @filter-map;
|
||||
|
||||
@@ -10,9 +10,7 @@
|
||||
<article class="col-main" role="main" aria-labelledby="main-label">
|
||||
<h1 id="main-label" class="page-header">{intl l="Contact Us"}</h1>
|
||||
|
||||
<div id="google-map">
|
||||
<iframe class="map" width="100%" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=london&aq=&sll=52.8382,-2.327815&sspn=9.377429,22.126465&ie=UTF8&hq=&hnear=London,+United+Kingdom&t=m&z=10&ll=51.511214,-0.119824&output=embed&iwloc=near"></iframe>
|
||||
</div><!-- / #google-map-->
|
||||
<div id="google-map"><!-- Google Map --></div>
|
||||
|
||||
{block name="contact-form"}
|
||||
{form name="thelia.front.contact"}
|
||||
@@ -89,3 +87,49 @@
|
||||
</article>
|
||||
</div>
|
||||
{/block}
|
||||
|
||||
{block name="javascript-initialization"}
|
||||
<script src="//maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&language={lang attr="code"}"></script>
|
||||
<script>
|
||||
var address = '{config key="store_address1"} {config key="store_address2"} {config key="store_address3"}, {config key="store_city"}, {config key="store_country"}';
|
||||
var icon_thelia = '{images file="assets/img/googlemap-icon.png"}{$asset_url}{/images}';
|
||||
{literal}
|
||||
$(function(){
|
||||
$('#google-map').each(function() {
|
||||
var map,
|
||||
$this = $(this),
|
||||
geocoder = new google.maps.Geocoder(),
|
||||
marker,
|
||||
latlng = new google.maps.LatLng(45.79, 3.09),
|
||||
myOptions = {
|
||||
zoom: 9,
|
||||
center: latlng,
|
||||
mapTypeId: google.maps.MapTypeId.ROADMAP
|
||||
};
|
||||
|
||||
map = new google.maps.Map(document.getElementById($this.attr("id")), myOptions);
|
||||
|
||||
// locate store address
|
||||
geocoder.geocode( { 'address': address}, function(results, status) {
|
||||
if (status == google.maps.GeocoderStatus.OK) {
|
||||
map.setCenter(results[0].geometry.location);
|
||||
latlng = new google.maps.LatLng(results[0].geometry.location.Qa, results[0].geometry.location.Ra),
|
||||
marker = new google.maps.Marker({
|
||||
map: map,
|
||||
position: results[0].geometry.location
|
||||
});
|
||||
} else {
|
||||
console.log('Error: The Geolocation service failed.')
|
||||
// Show Thelia address
|
||||
marker = new google.maps.Marker({
|
||||
map: map,
|
||||
position: latlng,
|
||||
icon: icon_thelia
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
{/literal}
|
||||
</script>
|
||||
{/block}
|
||||
|
||||
@@ -107,15 +107,16 @@
|
||||
</div>{/if}
|
||||
</div>
|
||||
|
||||
{* Default value *}
|
||||
{assign var="current_stock_class" value = "in-stock"}
|
||||
{assign var="current_stock_href" value = "http://schema.org/InStock"}
|
||||
|
||||
{loop name="stock_meta" type="product_sale_elements" product="$ID"}
|
||||
{loop name="combi_meta" type="attribute_combination" product_sale_elements="$ID"}
|
||||
{if $LOOP_COUNT == 0}
|
||||
{if $QUANTITY == 0}
|
||||
{assign var="current_stock_class" value = "out-of-stock"}
|
||||
{assign var="current_stock_href" value = "http://schema.org/OutOfStock"}
|
||||
{else}
|
||||
{assign var="current_stock_class" value = "in-stock"}
|
||||
{assign var="current_stock_href" value = "http://schema.org/InStock"}
|
||||
{/if}
|
||||
{/if}
|
||||
{/loop}
|
||||
|
||||
Reference in New Issue
Block a user