First, see my previous article about PostgreSQL functions at sive.rs/pg. That article gave tiny examples, but no finished working code.
This week, I wrote a shopping cart to sell my books directly from my own site.
So I took a couple extra hours today to put my code into public view, so anyone can play around with it. See github.com/sivers/store, to browse, download, and try it.
If you have any questions, or want to tell me how stupid I am for doing this, email me.