All Low add-ons are now owned by EEHarbor. Read the blog post.

Support archive

Low search results with Zoo Visitor custom field

Martin Pedemonte 7 Jun 2016 10:04 question, complete

Hi,
I'm trying to get distance results. Not using a "form", just using "exp:low_search:results" in my template.

Using hardcoded "distance:from" works fine:

{exp:low_search:results
channel="{canales_colegiosdeargentina}"
limit="30"
sort="asc"
orderby="title"
category="278&216"
category_group="28"
paginate="bottom"
dynamic="no"
uncategorized_entries="no"
distance:from="-34.4428|-58.5591"
distance:to="ar_priv_latitud|ar_priv_longitud"
distance:unit="km"
distance:radius="20"
cache="no"
refresh="60"
}


However, when I try this I don't get any result:

distance:from="{lv_pref_distancefrom}"

{lv_pref_distancefrom} is equal to:

{exp:zoo_visitor:details}{visitor:latitude}|{visitor:longitude}{/exp:zoo_visitor:details}

Where both fields are set to decimal.

LV is set to early parse. When outside results tag, it shows "-34.4428|-58.5591" OK.

Replies

  1. Low 7 Jun 2016 11:34

    This is a parse order issue.

    Your variable {lv_pref_distancefrom} is set to parse early, but that doesn't mean the contents of the variable will be parsed before it actually hits the template. It just means the variable name/marker will be replaced with its content in time for the native template parser to process it.

    This means the actual opening tag of the Results tag when it is trying to parse, is something like:

    {exp:low_search:results 
    ...
    distance:from="
    {exp:zoo_visitor:details}{visitor:latitude}|{visitor:longitude}{/exp:zoo_visitor:details}"
    ...
    }


    ...which will fail to parse correctly.

    You can try and add parse="inward" to the Low Search Results tag to try and force any tags inside parameter values to be parsed before the outer Results tag, but since it is a tag pair, I'm not certain it will work.

    Preferably, you'd need to set the latitude and longitude as early parsed variables itself rather than tags, as the former is better suitable for parameter values.

  2. Martin Pedemonte 7 Jun 2016 12:09

    Thanks Low, that did the trick!