Line 59 in version 2:
global $context, $scripturl, $settings, $txt, $de_prefix, $eggSelect, $item_info;
Shouldn't that be $db_prefix? what's $de_prefix?
Though actually, you don't use any of those globals in that function so you only need:
global $item_info, $eggSelect;