0

I'm trying to create a conditional to determine if the structure entry url is the same as the global {current_url}. I created a structure field called, {product_category}. For some reason I cannot get conditional below to evaluate to true. Any idea what the issue is?

When callinng in template {product_category} I get the following output:

http://localsite.com/index.php/online-store/business-compliance-materials/

When calling in template {current_url} I get the following output:

http://localsite.com/index.php/online-store/business-compliance-materials

Here's my conditional:

{if product_category == current_url . '/'} True {if:else} False {/if}

1

If I read your question correct (the links aren't working) you're trying to check if {product_category} is equal to {current_url} if so you need the following.

{if '{product_category}' == '{current_url}'} 
    True 
{if:else} 
     False 
{/if}
| improve this answer | |
  • That worked, however I ended up using Playa instead to categorize products. Thanks for the help, Chris! – frshjb373 Apr 14 '15 at 17:09

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.