James James - 3 months ago 39
Smarty Question

PHP Smarty condition - if Y or if Y condition

I have two variables that either pass back N or Y but only want to show something either either one of those is set to Y but think I'm doing it wrong. Any ideas?

{if $product.bean_bag_filling_150 == "Y" || $product.bean_bag_filling_300 == "Y"}

I'm assuming that would show the contents inside that condition if at least one of those has a value of "Y"?

Answer Source

Try this:

{if (strtolower($product.bean_bag_filling_150) == "y" || strtolower($product.bean_bag_filling_300) == "y")}

Read: http://php.net/manual/en/function.strtolower.php

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download