dev-feature/places
dev-feature/placesA Magento 2 module for Google Map embeed
OSL-3.0 AFL-3.0
The Requires
- php >=5.5.0
- magento/framework >=100.0.0
- guzzlehttp/guzzle ^6.3
by Silpion Tomasz Gregorczyk
Wallogit.com
2017 © Pedro Peláez
A Magento 2 module for Google Map embeed
Declare:, (*1)
<block class="LCB\GoogleMap\Block\Render" name="map" as="map" template="map.phtml"/>, (*2)
in your layout xml, (*3)
and <?php echo $this->getChildHtml('map'); ?>, (*4)
in your template file., (*5)
Example for contact_index_index.xml, (*6)
<referenceContainer name="content" htmlClass="row contact-page" htmlTag="div">
<block class="Magento\Contact\Block\ContactForm" name="contactForm" template="Magento_Contact::form.phtml">
<block class="LCB\GoogleMap\Block\Render" name="map" as="map" template="map.phtml"/>
</block>
</referenceContainer>
, (*7)
You can as well use following syntax on any page:, (*8)
<div id="map"></div>
<script type="text/javascript">// <![CDATA[
var apiKey = '<GOOGLE_MAPS_API_KEY>';
require([
'LCB_GoogleMap/js/map'
], function (map) {
map.render(
document.getElementById('map'),
latitude,
longitude,
zoom
);
});
// ]]>
</script>
Lack of map width and height. Add:, (*9)
#map {
min-width: 640px;
min-height: 320px;
}
to your stylesheet., (*10)
A Magento 2 module for Google Map embeed
OSL-3.0 AFL-3.0