Spree Commerce

Try It Now

Order Numbers Now Used in URL

Posted on February 08, 2009 by Sean Schofield

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.