<p>The syntax to set a custom field parameter on a Matrix Block element criteria model is like so:</p>

<pre><code>{% set blocks = entry.myMatrixField.mySmartMapField(params) %}
</code></pre>

CC BY-SA 3.0
2015-10-16T09:35:34.163Z
2015-10-16T09:35:34.163Z
carlcs
<p>I'm trying to search through a set of results inside a Matrix field. Craft is giving me this error message: <code>Craft\EntryModel and its behaviors do not have a method or closure named "avdelinger"</code>.</p>

<p>When I searched the information without the Matrix field it worked but now it's not. I'm using the smart map plugin to find the nearest office added in my Matrix field. Here's my code: </p>

<pre><code>{% block content %}

&lt;form action=""&gt;
    &lt;input type="search" name="sted" placeholder="Search"&gt;
    &lt;input type="submit" value="Go"&gt;
&lt;/form&gt;

{% for block in entry.avdelinger %}
    &lt;div&gt;
        &lt;h3&gt;{{ block.navn }}&lt;/h3&gt;
        {{ block.sted.street1 }}&lt;br /&gt;
        {{ block.sted.city }}, {{ block.sted.zip }}
    &lt;/div&gt;
    &lt;div&gt;
        Latitude: {{ block.sted.lat }}&lt;br /&gt;
        Longitude: {{ block.sted.lng }}
    &lt;/div&gt;
{% endfor %}


&lt;!-- results --&gt;
{% set target = craft.request.getParam('sted') %}
{% set params = {
    target: target,
    range: 1000,
    units: "kilometers"
} %}

{% set blocks = entry.avdelinger(params).order('distance').find() %}

&lt;h2&gt;Showing results for "{{ target }}"&lt;/h2&gt;
{% for block in blocks %}
    &lt;div&gt;
        {{ block.sted.street1 }}&lt;br /&gt;
        {{ block.sted.city }}, {{ block.sted.zip }}&lt;br&gt;
        &lt;strong&gt;{{ block.sted.distance | number_format(2) }} kilometers away&lt;/strong&gt;
    &lt;/div&gt;
{% else %}
    &lt;h2&gt;No results found&lt;/h2&gt;
{% endfor %}

{% endblock %}
</code></pre>

<p>Thanks!</p>

<matrix><elementcriteriamodel><plugin-smartmap>
Search Matrix and Smartmap
# Search Matrix and Smartmap

(Asked by: username_0 on 2015-10-16)

I'm trying to search through a set of results inside a Matrix field. Craft is giving me this error message: Craft\EntryModel and its behaviors do not have a method or closure named "avdelinger".
When I searched the information without the Matrix field it worked but now it's not. I'm using the smart map plugin to find the nearest office added in my Matrix field. Here's my code: 
{% block content %}


    
    


{% for block in entry.avdelinger %}
    
        {{ block.navn }}
        {{ block.sted.street1 }}
        {{ block.sted.city }}, {{ block.sted.zip }}
    
    
        Latitude: {{ block.sted.lat }}
        Longitude: {{ block.sted.lng }}
    
{% endfor %}



{% set target = craft.request.getParam('sted') %}
{% set params = {
    target: target,
    range: 1000,
    units: "kilometers"
} %}

{% set blocks = entry.avdelinger(params).order('distance').find() %}

Showing results for "{{ target }}"
{% for block in blocks %}
    
        {{ block.sted.street1 }}
        {{ block.sted.city }}, {{ block.sted.zip }}
        {{ block.sted.distance | number_format(2) }} kilometers away
    
{% else %}
    No results found
{% endfor %}

{% endblock %}

Thanks!

**Tags:** matrix, elementcriteriamodel, plugin-smartmap


---

## 1 answers

### Answer by username_1 on 2015-10-16. Score: 2

The syntax to set a custom field parameter on a Matrix Block element criteria model is like so:
{% set blocks = entry.myMatrixField.mySmartMapField(params) %}


---

