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

<pre><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 %}
</code></pre>

CC BY-SA 3.0
2014-08-13T19:52:17.353Z
2014-08-15T09:41:26.660Z
2014-08-15T09:41:26.660Z
Lindsey D
<p>And how do you set a different icon and infoWindow when a lightswitch or entry type?</p>

<pre><code>{% 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) }}
</code></pre>

CC BY-SA 3.0
2014-08-13T18:38:03.697Z
Feature request: MarkerClusters with custom icons.
Johannes Lamers
CC BY-SA 3.0
2014-08-13T19:29:10.947Z
Thanks for the feature request! Feel free to email me at support@doublesecretagency.com with any others.
Lindsey D
<plugins><plugin-smartmap>
How do you set a different icon per entry in SmartMap?
# How do you set a different icon per entry in SmartMap?

(Asked by: username_0 on 2014-08-13)

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) }}

**Tags:** plugins, plugin-smartmap
> **Comments:**
> **username_0**: Feature request: MarkerClusters with custom icons.  
> **username_1**: Thanks for the feature request! Feel free to email me at support@doublesecretagency.com with any others.  

---

## 1 answers

### Answer by username_1 on 2014-08-13. Score: 4 | Accepted answer

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 %}


---

