I keep my discountinued products "hidden". I have an extra field in place and a simple if statement in the templates to show/not message based on if the extra field has value or not. No meesing with php files

trying to keep it simple. If what you did so far works then keep it like this. If you want to apply the condition to products_xxx.tpl you can but if you have these products "hidden" they won;t show in the list anyway