A more reliable implementation would be to have a temporary orders table you can save selections to this table up until the "check out" procedure. A vistior comes, you check for a cookie (shopper=1234), if they have the cookie you can query the temp table for previous orders, if they don't have the cookie, tag them with one. Any selection is saved to the temp table using the shopper id from the cookie. Once at check out, their cart would have items from the temp table, push these items to the real store/basket table. Once the order has been processed - do whatever.. removing the entries from the temp table. Once a month, once a week or every 24 hours, purge the temporary table to relieve bloating. Something like that should work and it would be more reliable. Relying on session or cache is never a good idea - both can expire unexpectedly.
My Personal Site