<p>OK So without being too verbose about this, here is how I managed to attach information to each marker.</p>

<ol>
<li>It is important to remember that each marker has an ID which corresponds to the entry / user that it is derived from. Using javascript, I created a small function that when given a numeric ID, it creates the smartmap ID by prepending adn appending characters to the ID. So 43 would return smartmap-mapcanvas-1.43.memberAddress in my case.</li>
<li>Using that function as a building block, I was able to create a craft loop on my template that queries the user, gets their id, gets the relevant information, and then using javascript to apply it to the matching id marker. </li>
<li>Google markers are just javascript objects. So you can add anything to them.... Strings, Arrays, Objects, whatever... Then use javascript to query that extra </li>
</ol>

<p>If anyone needs help, hit me up and I'll happily share my code.</p>

CC BY-SA 3.0
2015-12-22T17:53:48.183Z
2015-12-22T17:53:48.183Z
Adam Menczykowski
<p>I have successfully got Smart Map up &amp; running and now want to tailor it for my own purposes.</p>

<p>I will have hundreds of markers for businesses, which I am categorising via fields in Craft. What I would love to do is pass custom options to the markers on an individual basis. E.g.:</p>

<p>Marker 1 - Business-type: Retail; Market-sector: Domestic, Educational; Products: Chair, Table, Upholstery.</p>

<p>Marker 2 - Business-type: Manufacturer; Market-sector: Office, Children; Products: Soft seating, Divider panels.</p>

<p>As you see there are 3 keys with multiple values in each.</p>

<p>-</p>

<p>I know I can pass custom options into the map <a href="https://developers.google.com/maps/documentation/javascript/reference#MarkerOptions" rel="nofollow">using the API</a>, but can it be done manually in conjunction with the plugin? </p>

<p>It is possible to pass information per-marker for the info Bubble, but I don't see anything in the documentation about custom option data.</p>

CC BY-SA 3.0
2015-12-01T17:04:45.683Z
I see somebody else has manually passed in data per marker in a loop, but this is not using the Smart Map plugin. http://craftcms.stackexchange.com/a/9664/3991
Adam Menczykowski
CC BY-SA 3.0
2015-12-01T18:28:45.593Z
You can access every property via a variable "element" in the marker template. But I probably didn't really get what you're asking.
carlcs
CC BY-SA 3.0
2015-12-01T20:14:46.923Z
Thanks @carlcs - I am using the element variable for my infoWindow. Can I pass the element variable into the markerOptions?
Adam Menczykowski
CC BY-SA 3.0
2015-12-01T20:17:19.177Z
Sorry, I thought that's what you're after, adding markup to the marker's info window. I've no clue what markerOptions config is good for.
carlcs
CC BY-SA 3.0
2015-12-01T21:28:56.560Z
OK Not to worry, thanks for offering assistance @carlcs
Adam Menczykowski
<plugin-smartmap>
Smart Map - pass options into markers individually
# Smart Map - pass options into markers individually

(Asked by: username_0 on 2015-12-01)

I have successfully got Smart Map up & running and now want to tailor it for my own purposes.

I will have hundreds of markers for businesses, which I am categorising via fields in Craft. What I would love to do is pass custom options to the markers on an individual basis. E.g.:

Marker 1 - Business-type: Retail; Market-sector: Domestic, Educational; Products: Chair, Table, Upholstery.

Marker 2 - Business-type: Manufacturer; Market-sector: Office, Children; Products: Soft seating, Divider panels.

As you see there are 3 keys with multiple values in each.

-

I know I can pass custom options into the map [using the API](https://developers.google.com/maps/documentation/javascript/reference#MarkerOptions), but can it be done manually in conjunction with the plugin?

It is possible to pass information per-marker for the info Bubble, but I don't see anything in the documentation about custom option data.

**Tags:** plugin-smartmap

> **Comments:**
> **username_0**: I see somebody else has manually passed in data per marker in a loop, but this is not using the Smart Map plugin. http://craftcms.stackexchange.com/a/9664/3991  
> **username_1**: You can access every property via a variable "element" in the marker template. But I probably didn't really get what you're asking.  
> **username_0**: Thanks @username_1 - I am using the element variable for my infoWindow. Can I pass the element variable into the markerOptions?  
> **username_1**: Sorry, I thought that's what you're after, adding markup to the marker's info window. I've no clue what markerOptions config is good for.  
> **username_0**: OK Not to worry, thanks for offering assistance @username_1  

---

## 1 answers

### Answer by username_0 on 2015-12-22. Score: 3

OK So without being too verbose about this, here is how I managed to attach information to each marker.

1. It is important to remember that each marker has an ID which corresponds to the entry / user that it is derived from. Using javascript, I created a small function that when given a numeric ID, it creates the smartmap ID by prepending adn appending characters to the ID. So 43 would return smartmap-mapcanvas-1.43.memberAddress in my case.
2. Using that function as a building block, I was able to create a craft loop on my template that queries the user, gets their id, gets the relevant information, and then using javascript to apply it to the matching id marker.
3. Google markers are just javascript objects. So you can add anything to them.... Strings, Arrays, Objects, whatever... Then use javascript to query that extra

If anyone needs help, hit me up and I'll happily share my code.


---

