smallroomsoftware.com

Shopping carts on Rails

Posted on October 10, 2008

For a while now I've been looking at options for changing the software on my Dad's online store. We've been using LiteCommerce for a few years and although it's generally worked well, (and I would still recommend it) it's been hacked on quite a bit to add features and modify the way it behaves. Fiddling with partially encrypted PHP code isn't my idea of fun and upgrading is also a real pain. Also, for a PHP application, it isn't particularly fast. It's coded in a clever object oriented way but I would say the per request overhead is quite high. I looked at some other PHP shopping carts but nothing looked much more compelling that LiteCommerce. It might be nice to have someone else worry about the whole problem but I couldn't find a good hosted solution (and what's the fun in that!) I looked at Shopify for a while and then realised it was pretty underpowered and kind of expensive.

Ideally I'd like a Rails based shopping cart and I've been following the progress of Spree for a while now. Spree seems to gaining momentum but it's still missing a lot of features that I need. Also, I suspect that a lot of effort is going to go into building user interface for store configuration. Things like, configuring of shipping, tax, payment gateways etc. I actually think this is the wrong approach for Spree. Spree is almost exclusively going to be used by Rails programmers and Rails programmers are a lot happier configuring these kind of thing in code. I mean, that's just normal practice in Rubyland. Actually, I would count being able to configure my shipping rules with a bit of Ruby code a feature! Same goes for tax calculations. So I guess I would actually like Spree not to be a finished product in itself. Well maybe a finished product when you add some basic extensions. The extension system does seem really good and I hope that they use extensions for more core components (permutations, inventory control). For anything that might not quite fit a potential user's needs (like me!), so they can swap the default out and code their own.

(Update: Sean points out below that Spree's tax and shipping calculation to plug in as Ruby code. I think it's great that Spree is taking this developer-centric approach and not aiming to be a turnkey solution. Just to be clear, I think Spree is by far the most promising shopping cart system I've seen for a programmer to pick up and adapt for their client.)

So in the end, I realised that in the long-run, building a custom cart is going to be less of a hassle and more of a benefit than migrating to some other software that has it's own quirks and distinctive way of viewing the world. Actually, it has turned out not be as much work as I had expected. As I mentioned above, lots of the complexity of reusable cart software comes from having to provide enough flexibility and configuration UI. I get to ignore all this and essentially hard-code things like shipping rules and tax calculations. So I can quickly code up a shipping exceptions for certain products. I also don't need a sand-boxed template editor - I just use normal erb templates.

So I've probably put about 6 weeks of work into this and I already have the new site running. I think that's a pretty good advertisement for how fast you can build a fairly non-trivial application with Rails. I haven't implemented all of the features I have planned but it effectively does everything for my dad's business that Litecommerce did and a bit more. Building and deploying a Rails app from scratch is certainly a smoother process than it was a couple of years ago (more on that later).

Here are some screenshots:



Comments
  1. EliOctober 14, 2008 @ 05:16 PM
    That's pretty good for a cart built from scratch, I'd say. I'd heard of RoR before, but I didn't know it was robust enough to do all that (especially after only 6 weeks with presumably a single-person development team). Way to go Tom. Also, thanks for the link to Noam Chomsky's site, I really enjoyed some stuff I read there.
  2. James SchorrOctober 30, 2008 @ 05:52 PM
    This looks great- way to go. I really, really like the layout.
  3. Sean SchofieldNovember 10, 2008 @ 10:51 PM
    I agree that Spree is missing some features but we're making good progress in addressing the more serious omissions. Spree is definitely not intended to be a finished product. We fully anticipate users needing to customize the front end and we do expect the developer to know Rails well enough to do some coding. Most of the tax and shipping logic does in fact need to be written by the developer in code. We just provide a basic framework to make it easier to plug this code in. The shipping and tax zones can be configured by UI as you mention but even that is not required. Its cool that you wrote your own cart. I just don't want potential Spree users to be confused about the configuration aspect. By the way, I noticed your site is using Google Checkout. I'd love to pick your brain about that sometime. Please drop by the spree-user list so we can talk. I'd also like to hear more specific feedback about missing features if you're willing to share. (I suspect we'll have a few of the same items on our list.)
Post a comment
Comment



If you can read this, you don't use a typical webbrowser that plays nice with CSS.
Please do not fill in anything here!



Hosting by site5.com