To interact with the session you'll want to make use of the Session class:
Here is some more of the example fleshed out.
$data = Session:get('productfilter');
$savedfilter = "\"ParentID\" IN (".implode(",",$data["Categories"]).")"; //where $data["Categories"] is an array
The limiting is done by passing the savedfilter to ProductsShowable, which makes sure the products it retrieves only belong to the given categories (Product Groups).
This is far from complete, and you'd need to somehow get the ids of subcategories if you wanted to include products from those.
I will be devoting some time to improving the ability to browse / search products in the future sometime.
Here's a ticket I made: https://github.com/burnbright/silverstripe-shop/issues/36