Undefined variable in custom default.php and query doesn't work

This causes error while opening deal detail. I'll return it back in my future pull request.