Related message shows even when there are no related items (v. 2.9 - 2.91)

The related item message (storeadmin -> Administration -> Catalog Setup -> Related Msg) is appearing under all products in the single, double or triple layout, whether there are related items or not. To correct this issue and only show the message when there are related items, open the products_variables.php file in the /enc/ folder, and change the following code (around line 860) from:

return "
$relatedmsg
" . $relatedlinks;

to:

$rellnkmsg = (!empty($relatedlinks)) ? "
$relatedmsg
" . $relatedlinks : ""; return $rellnkmsg;