1

I have a strange problem for a new template. I'm trying to retrieve some data from database based on query params.

My query looks like:

{exp:low_search:results channel="channel_name" status="active" disable="categories|member_data|pagination|trackbacks" dynamic="no"
  {if '{get:trip_group}' != ''} 
    child:trips_race_trip_group='{get:trip_group}'
  {if:elseif '{get:trip_type}' != ''} 
    child:trips_trip_type='{get:trip_type}'
  {/if}
} 

My problem is that every times the both conditions are added to query and I get an error result for each iteration result. For example if {get:trip_group} is empty

child:trips_race_trip_group='' } child:trips_race_trip_group='' } child:trips_race_trip_group='' child:trips_trip_type='tbt-camps' }

But it works perfectly if I do it without if conditions, the results are correct; something like:

{exp:low_search:results channel="channel_name" status="active" disable="categories|member_data|pagination|trackbacks" dynamic="no" 
  child:trips_race_trip_group='{get:trip_group}'
} 

or

{exp:low_search:results channel="channel_name" status="active" disable="categories|member_data|pagination|trackbacks" dynamic="no"
  child:trips_trip_type='{get:trip_type}'
} 

Do you have any ideas what is happening here ?

  • The only solution founded is this: {if "{get:trip_group}" != ""} {exp:low_search:results channel="channel_name" status="active" disable="categories|member_data|pagination|trackbacks" dynamic="no" child:trips_race_trip_group="{get:trip_group}" } {if:elseif '{get:trip_type}' != ''} {exp:low_search:results channel="channel_name" status="active" disable="categories|member_data|pagination|trackbacks" dynamic="no" child:trips_trip_type='{get:trip_type}' } {if:else} {exp:low_search:results channel="channel_name" status="active"} {/if} – Bogdan Alexandru Militaru Aug 10 '17 at 11:30
1

If you're using the Low Search form and GET vars, then you don't need to add those parameters to the Results tag -- they'll get picked up and are applied automatically, as long as the name is correct in your input elements, ie:

<select name="child:trips_trip_type">

and not

<select name="trip_type">
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.