Archive for July, 2008

July 22 2008

Taxation Improvements (VAT now supported)by railsdog

A couple of weeks ago I committed some major improvements to the taxation code. There have been so many new features added to Spree these past few weeks that I haven’t had time to write up this stuff until now.

It is now possible to build highly customizable tax rates. You can control which products get taxed (through the Tax Category) and at what rate. You can also vary the rate based on the Zone the order is being shipped to. This allows you to model traditional U.S. sales tax scenarios and even allows for a different tax rate based on the type of product.

For our international friends (and there are a lot of you now) VAT is now supported. There are a few missing pieces but the basic VAT support is there. Please see the new taxation wiki entry for details.

July 12 2008

Subscription Manager Extensionby railsdog

Gregg Pollack has written a simple Subscription Manager extension for Spree. The extension will allow you to ask new users if they want to subscribe to a mailing list. While developing this extension Gregg ran into an interesting problem. He needed to add a single field to the existing user form. Of course extensions allow you to override the entire form, but in this case, that’s not very DRY.

Gregg and I discussed the idea of having extensions loading partials which ended up being a great solution to this problem. Its worth a look if you are writing extensions that require similar functionality.

If you’re running into trouble writing your extensions, just pop by the mailing list or the #spree channel and ask for some help. In the future, I imagine we will be making more changes to the core to accomodate unforseen scenarios such as this.

You can install the extension in your project with:

script/extension install git://
July 09 2008

Installing Extensions from Gitby railsdog

It’s now possible to install Spree extensions from Github (or any other git repository.) To install an extension from git simply type:

script/extension install git://path-to-extension.git

There are a few other details (like the ability to force a new install, etc.). Use the --help option for details. Keep in mind that if you have a Spree app that is already deployed you won’t be able to use this until you update your local gem and/or refreeze you vendor/spree directory.

You will recall that you can build the gem locally (using the latest git source of course) using

rake spree:gem:install

Now, let’s get to work and start writing those extensions!

July 08 2008

SEO Permalinks and available_on for Productsby railsdog

A few days ago we received two excellent product related contributions from Gregg Pollack and Jason Seifer. The first new feature is SEO Permalinks for Products. This feature makes use of the excellent find_by_param plugin to automatically generate human readable permalinks for your products. So now instead of a URL of ‘products/12345’ you have something like ‘products/ruby-on-rails-ringer-t-shirt.’

The second feature is an available_on field. This is a date field that can be set to a future date. There is a new named scope called available which helps limit the list of products to only those that should be available according to the current date. As an added bonus, they also refactored all of the product stuff to make it RESTful. Thanks for the great contributions!

July 06 2008

Website Payments Pro Supportby railsdog

Spree now supports Pay Pal’s Website Payments Pro (US only.) This support applies to credit card payments only. Supporting actual PayPal payments will soon be included into Spree as well but that part has not been written yet. For some strange reason, PayPal has made it nearly impossible to effectively test their gateway. Fortunately I had an old test account laying around because I quickly gave up on all of the nonsense required to create a new one. In any event, the support is now there for those that want it.

Thanks to Will Emerson who contributed the code necessary for this implementation. Just a reminder about how gateways work in Spree. By default you will be using the Bogus Gateway when running Spree in development mode. This is regardless of whether you have a real gateway configured in your admin settings. In test mode, you will use whatever gateway you have configured in your admin settings but you will be transmitting to your gateways test server (Active Merchant handles the gateway specific details on how this is done.) When Spree is started in production mode you will be using the live production gateway.

July 04 2008

Introducing Zonesby railsdog

Spree now has a new zone feature. The feature allows you to define geographical areas for various purposes. Zones will initially be used to support highly customizable tax rate calculations. They are essentially a requirement to support sophisticated tax calculations where there are lots of exceptions. The VAT tax calculator in particular will require the use of such zones. Another possible use of zones will be for the upcoming shipping stuff. For more information on zones (and how to build them) you can see the wiki.