New WooCommerce site now live

The website was launched over Christmas. It is my first foray into WooCommerce, the free WordPress e-commerce plugin from WooThemes.

Although this free shop is designed to hook you into purchasing themes and plugins, it really is a complete product just as it is, and functions well out of the box.

I wanted to offer downloadable MP3s as products on the shop, and hit a few snags with the download functionality. With a bit of work I managed to get that working, and fed it back to the WooCommerce developers, expecting some kind of argument about whether any fixes were needed. Within two days the fixes were all incorporated into WooCommerce (on github) along with a few additional suggestions, and will be in the next release. Now that is a product that is really going places 🙂

For those interested in the technical details, the issue concerned downloading large files using the mod_xsendfile module for Apache. First I needed to install the module onto the web server, which was a cinch using yum and rpmforge.

Now, what mod_xsendfile is supposed to do, is inspect outgoing pages and look for the X_SendFile header in the outgoing HTTP page. If it sees it, then it dumps the rest of the page, looks for a file that the X_SendFile header points at, then streams it out. It does this without tying up database connections, PHP processes, eating into memory etc.

Where it was failing for me, was a security feature of Apache. WooCommerce was passing full path of the file for streaming to mod_xsendfile, but the module was then treating that full path as an error, because some parts of the path sit outside the webs root. Now, it should not behave like this, as the file is still under the web root, and so the web process has full access to the file, but it simply wasn’t having it. I suspect the real problem lies in Apache, or assumptions that the module was making, but I couldn’t see a solution there.

The working fix was to ensure mod_xsendfile was passed only a relative path to the file for streaming, relative to the website entry point (index.php). This worked fine for me, and this is the fix that WooCommerce incorporated.

That aside, the one niggle I have for WooCommerce is its complexity. Now, I know e-commerce is not going to be simple to implement, but I was hoping for a theme that could easily be modified. This is probably more a reflection of the structure of WordPress, but it seems that the WordPress theme has lots of functionality absolutely necessary for proper formatting of the shop components, so the two are very closely coupled. It means the whole site – the shop area at least – must use a WooCommerce-enabled theme, and those themes are not easy to mound into your own style.

What I think would have worked better, for a developer at least, is to limit the commerce theme elements to standalone templates that insert shop elements into any theme of your choice. You can kind of run it like this now, but an awful lot of the shop functionality is missing if you don’t run it under an enabled theme with a tonne of functionality in it. I’m sure this situation will improve over time, having seen the rapid pace of development of this plugin.

The Relax Timeout site has been designed to sell just one relaxation CD, so does not have a large inventory at present, but it is still going to be a great test-bed to see how easy it is going to be to customise WooCommerce.


No comments yet.

Leave a Reply