One line of code missing in my previous version - full package here.
This was tested with RC2.2a store on *nix server with PHP 5.2.14 and MySQL 5.1.47

More...