Storing user data and retrieving it can be a bit of a pain to manage, especially for small implementations where you only need to store a value or two. Fortunately, if you are writing a plugin for Shopp, you can stand on its giant shoulders and utilize their automatic session storage.
This allows you to register your class instance properties with Shopp and let it take care of managing the data.
It’s easier to demonstrate with code than explain, so here’s a quick example:
Basically, at the end of each page request Shopp will save
in the session data. And at the beginning of each page request, it will automatically restore
to the value in the session.
Weird right? It doesn’t feel like it should be that easy.
You can also use Shopp’s session data as a key / value store, but I find this is normally the most practical way to store user data when working in the context of a plugin.