I have posted this on the prestashop forum, but this seems a more active community. So I apologise for the double posting. Original here - http://www.prestashop.com/forums/topic/300434-how-to-use-an-or-statement-in-category-id-x/
This should be quite simple, but I am stumped and can't understand why this isn't working.
I have a link that appears on all category pages, but I need to list a few categories where it doesn't appear.
I have tried;
{if $category->id != 1433 OR $category->id != 6100}
and
{if $category->id != 1433 | $category->id != 6100}
and
{if $category->id != 1433 || $category->id != 6100}
None of those actually work, it seems the if statement is ignored as the link appears on both those category pages.
But
{if $category->id != 1433}
Does work.
So how can I list the category IDs in the if statement to include all categories I need to?
Thanks
It should be with AND not with OR.
{if $category->id != 1433 && $category->id != 6100}
If you have more category IDs you can consider using in_array() function like:
{if !in_array($category->id, $banned_categories)}
and you can define that array in the template (worst case), asign it from the Controller directly (better case) or do a UI for setting which categories to be "banned" (best case)