Quote from: sottwell at Sep 25, 2006, 12:36 AM
This is exactly what I had in mind when I first came up with the idea. I know my limitations, and this has already really stretched them. Please, please, people, take this and run with it. The potential is there, I tried to set up the skeleton of a real ecommerce system in a clean, modular fashion so that it would be easy to work with, and use the MODx system itself as much as possible. I think I succeeded in that much, anyway.
Indeed, storing the values in the database with a cookie-based key (sort of like a custom session) would be the best way to handle this. I deal with the switch from regular http to https by passing the session_id in the url to the checkout page, then the first thing the checkout document does is run a snippet that gathers the shopx values from the old session and loads them into the new one. But as Zap says, that’s not really very robust.
You’ve done a helluva job, Susan. I don’t see any reason why this can’t mushroom into a complete system capable of handling different people’s needs. I keep learning new MODx tricks as I look over your code.
As far as I know, most carts now store "pseudo-sessions" in the database and pass the id either by cookie or in the query string (as you’re doing). The query string is much more reliable when switching to SSL, since if the secure server has a different domain name it can’t read the cookie. It looks to me as if it would be pretty easy to modify this (we’ll just need a couple new tables).
There are certainly things to learn from other cart systems, and the beauty of ShopX is that we won’t end up with a horribly deformed monster if we create modules that do a lot of these things. People can start with the core scripts and then add in only the modules they need. Less bloat, and less vulnerable to hacks as well.
I’m thinking about creating a "real" inventory system to work with this (depending upon whether the client tells me that they want it). By that I mean that in the back end you enter exactly which items you have in stock (three small blue t-shirts, 1 medium black t-shirt, etc.) and then have the script check actual availabilty of items when it displays them to customers and modify the inventory when items are sold. Does anyone know of another cart that has this feature so I can spec it out?
I guess I need to learn about data grids also - is there a good reference or tutorial that I should start with?