Low Search Result Conditional
I'm having issues with the conditional below.
I only want to add default:category="{segment_3_category_id} when type-1 or type-3 are not in segment_3 of the url.
It works when I remove the OR type-3 line but adding extra OR logic breaks the tag..
{exp:low_search:results collection="product" {if segment_3 != "type-1" || segment_3 != "type-3"}default:category="{segment_3_category_id}"{/if}}
Replies
Low 4 Nov 2014 14:22
First of all, the logic in the IF statement will always return TRUE. If segment_3 is "type-1", the second half of the query is true. If it's "type-1", the first half is true. You'd need to combine the two halves with AND, not OR.
Then, only when you're using EE 2.9+, the conditional will be parsed in time before parsing tags. But, in general, I recommend against using conditionals in opening tags anyway. Try using Preload Replace variables instead. Something like:
Jemes 4 Nov 2014 15:17
The Preload Replace work great, thanks.