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

Support archive

Low search and parse order

Paul 2 Feb 2013 14:22 problem, rejected

I'm trying to accomplish a search results page where the imformation displayed depends on the membership package of each entry. If statements don't seem to work correctly, perhaps it's the parse order?

I've simplified the query for testing purposes, but basically the IF statement is never true. Any idea of a way to accomplish this?

{exp:low_search:results query="{segment_3}"}

{company_membership_package var_prefix="pkg"}
{if pkg:title == "Premium"}
{snp_company-listings_Premium}
{if:else}
{snp_company-listings}
{/if}
{/company_membership_package}

{/exp:low_search:results}


The alternative doesn't work either:

{exp:low_search:results query="{segment_3}"}

{company_membership_package var_prefix="pkg"}
{snp_company-listings_{pkg:title}}
{/company_membership_package}

{/exp:low_search:results}


Forgot to mention {company_membership_package} is a Playa field, and does correctly return the word "Premium" when used outside the IF statement.

Replies

  1. Low 2 Feb 2013 14:42

    If you switch the low_search:results tag with a native channel:entries tag, but leave the code inside the same, does it work then?

  2. Paul 2 Feb 2013 14:50

    Good point.

    Same result though. :(

  3. Low 2 Feb 2013 14:52

    Well, at least that rules out Low Search...

    Might be a Playa issue, then. Have you tried using the acual {exp:playa:...} tags instead?

  4. Paul 2 Feb 2013 14:55

    Thx, worth a try.

  5. Paul 2 Feb 2013 15:02

    Same result, neither way works:

    {exp:playa:children var_prefix="pkg"}
    {if pkg:title == "Premium"}
    {snp_company-listings_Premium}
    {if:else}
    {snp_company-listings_{pkg:title}}
    {/if}
    {/exp:playa:children}

  6. Low 2 Feb 2013 15:03

    In that case, I suggest you ask Pixel & Tonic, as this issue doesn't seem to be related to Low Search...

  7. Paul 2 Feb 2013 15:04

    Will do, thanks.

  8. Paul 4 Feb 2013 15:31

    Just in case someone comes across this thread, the solution was to write the conditional like this - can't believe I missed trying with the quotes:

    {company_membership_package var_prefix="pkg"}
    {if "{pkg:title}" == "Premium"}
    {snp_company-listings_Premium}
    {/if}
    {/company_membership_package}