I'm trying to get this if statement to work, not sure what I'm doing wrong. This is my code:

{categories}{if remaining_places_available<1 && category_id==259}<p><strong>Fully booked</strong></p>{/if}{/categories}

This is within the channel entries tag. the remaining_places_available is a field. Replacing && with AND doesn't work either. It's just outputting {categories} {/categories} on the front end.

Would really appreciate some help.

Thanks, Julie

EDIT: This is my channel entries tag:

{exp:channel:entries channel="choices_events" show_future_entries="yes" show_expired="no" disable="trackbacks" orderby="date_time" sort="asc" paginate="bottom" status="open" dynamic="no" parse="inward"}

This works fine in my code, and outputs '259' on the correct entries:

    {if category_id == "259"}259{/if}

I just can't get it to work within the other if statement :

{categories}{if remaining_places_available<1 && category_id==259}<p><strong>Fully booked</strong></p>{/if}{/categories}
  • Can you post your code? You may have the categories disabled in your channel:entries tag
    – Siebird
    Jun 8 '13 at 15:54

First, let me say that "trackbacks" isn't a value of the parameter disable anymore.

Now, let's make your conditionals to work.

I didn't realize until see your code, but looks like just the variables related to the {categories} tag pair are available inside it.

Since, your conditional uses an "AND", we can break it into two parts:

{if remaining_places_available < 1}
        {if category_id == 259}<p><strong>Fully booked</strong></p>{/if}

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.