Surprisingly can’t find anything on this… basically I call my custom product attributes on the product view page like this:
Men / Women: <?php echo $this->htmlEscape($_product->getmenwomen()) ?>
This displays the men/women attribute fine, but these are optional values, so if a product doesn’t have a value for this particular attribute, the line is still displayed, just with no value:
Men / Women:
I’d like that line to not show at all if there is indeed, no value for a product. Any ideas?
You have to check if the value of getmenwomen() really contains something you expect it to contain (eg men/women) before printing it. In this example i presume that anything but whitespace is a valid value.