I have a Smart Map field in a section and am trying to output multiple results (pins) to a single map.
This code will output multiple maps (one map per pin)
{% for mapEntry in craft.entries.section('markets') %}
{% set options = {
height: 500,
zoom: 14,
draggable: false,
markerInfo: '_includes/mapInfoBubble',
markerOptions: {
icon: 'http://maps.google.com/mapfiles/ms/icons/green-dot.png'
},
infoWindowOptions: {
maxWidth: 200
}
} %}
{% set locations = craft.entries.section('markets').marketAddress.find() %}
{{ craft.smartMap.map(locations, options) }}
{% endfor %}
So essentially I am trying to get the {{ craft.smartMap.map(locations, options) }}
outside the for loop.
{% set locations = '' %}
{% set options = '' %}
{% for mapEntry in craft.entries.section('markets') %}
{% set options = {
height: 500,
zoom: 14,
draggable: false,
markerInfo: '_includes/mapInfoBubble',
markerOptions: {
icon: 'http://maps.google.com/mapfiles/ms/icons/green-dot.png'
},
infoWindowOptions: {
maxWidth: 200
}
} %}
{% set locations = craft.entries.section('markets').marketAddress.find() %}
{{ craft.smartMap.map(locations, options) }}
{% endfor %}
But this only results in a single pin (most recent entry).
Can't get my head around this. Any assistance most welcome.
14
is extremely close. The maximum is16
, which practically shows your front doorstep. (Conversely,1
is a distant view from outer space.)