3

And how do you set a different icon and infoWindow when a lightswitch or entry type?

{% set locations = craft.entries.section('section').find() %}

{% set options = {
    'zoom': 5,
    'height': 750,
    'markerInfo': '_includes/infoBubble',
    markerOptions: {
        icon: 'http://maps.google.com/mapfiles/ms/icons/green-dot.png'
    },
} %}

{{ craft.smartMap.map(locations, options) }}
  • Feature request: MarkerClusters with custom icons. – Johannes Lamers Aug 13 '14 at 18:38
  • Thanks for the feature request! Feel free to email me at support@doublesecretagency.com with any others. – Lindsey D Aug 13 '14 at 19:29
4

That's a tricky one... Natively, all of the options are applied to all markers equally. But you can do a little workaround using something like this pseudo-code:

{% set markerIconJs  %}

    // On page load
    $(function () {

    {% for entry in locations %}

        {% if entry.lightswitch %}

            // JavaScript: Override the default icon with your own
            smartMap.marker['smartmap-mapcanvas-1.{{ entry.id }}.myAddressField'].setOptions({
                icon: '{{ entry.icon }}'
            });

        {% endif %}

    {% endfor %}

    });

{% endset %}

{% includeJs markerIconJs %}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.