Archive for February, 2009

February 21 2009

New Availablity Check for Shipping Calculatorsby railsdog

Edge Spree now supports a new is_available? method for shipping calculators. This allows calculators to deny the availability of the associated shipping option based on the details of the order. I recently needed this for a client selling consumer electronics.

The requiremens were that for customers buying large screen televisions, freight shipping should be the only option. The freight shipping option should not be available for an order that does not include a television.

Here’s an example of code that I used in the base shipping calculator class of all the standard calculators.

def available?(order)
  special_categories = ShippingCategory.find(:all, :conditions => ["name IN ('TV', 'Medium Size TV', 'Oversized TV')"])        
  order.line_items.each do |line_item|
    product = line_item.variant.product
    return false if special_categories.include?(product.shipping_category)

This code will make the shipping method unavailable if any of the line items in the order contains a television. Note how the calculator makes use of the Shipping Category in performing its check. This is optional. Shipping calculators can make their determination based on any aspect of the order, including its contents or the shipment address.

February 10 2009

Product Lightbox Extensionby railsdog

Steph Powell has written a great little extension that adds a “lightbox” effect to the product thumbnails. Remember, its easy to install extensions in your Spree project directly from git.

script/extension install git://

We’ve actually incorporated this extension in the online demo. The online demo is its own github project now. Our goal is to build this demo up to make it look more like a professional store. So in the future, we’ll be adding some fancy artwork and showing off what some of the Spree extensions can do. You can also clone this project yourself and run it locally if you wanted to do an offline demo for a potential client.

February 08 2009

Order Numbers Now Used in URLby railsdog

Spree now uses the order number in the URL instead of the primary key for lookups. This avoids potential confusion between the order id and the order number. The order id is now essentially hidden from all parties. Previous to this change the default installation of Spree used order numbers and ids that were very similar to one another.

There is a legacy migration that will add an “R” in front of your existing order numbers. This helps the resource controller from becoming confused about whether or not your id param represents the number or id. If you already have order numbers that contain at least one non numeric character, then your existing order numbers will be left alone.

We’ve also made a minor upgrade to the find_by_param plugin used by Spree to implement permalinks. Please report any difficulties with either the order or product links (although we’re not necessarily expecting problems.) You can also veiw this new functionality in the online demo.

February 03 2009

Spree 0.6.0 Releasedby railsdog

Spree 0.6.0 is now released. The primary feature of this release is Rails 2.2.2 support. Normally upgrading to the latest Rails version is not too tough but this version was much more complicated due to the i18n features. Thanks to Brian Quinn for doing the tedious work of replacing all of the Globalite stuff with the new Rails 2.2.2 i18n functionality. You should also read his excellent writeup on this topic.

This release includes several additional fixes and features. Here are some highlights:

  • Support for routes.rb inside extensions instead of using class_eval
  • SEO Friendly URL’s for Taxonomy
  • Switch from attachment_fu to paperclip
  • Paranoid deletion of products
  • Standardized security model
  • Rake tasks for creating new translations and maintaining existing ones

Please report any issues you discover. We’re already hard at work on the next release. We’ll also be working to update the documentation and wiki as we go.