Spree 1.2.0 introduces some fairly major changes in the basic architecture of Spree, as well as minor alterations and bugfixes.
Due to the long development cycle of Spree 1.2 in parallel with continuing development of the 1.1 branch, there may be features released in 1.2 that are already present in 1.1.
Summary
There were two major topics addressed within this release of Spree: custom authentication and better checkout customization.
The first was the ability to use Spree in conjunction with an application that already provided its own way to authenticate users. Due to how Spree was architected in the past, this was not as easy as it could have been. In this release of Spree, the auth component of Spree has been removed completely and placed into a separate extension called spree_auth_devise. If you wish to continue using this component of Spree, you will need to specify this extension as a dependency in your Gemfile. See Issue #1512 for more detail about the customization.
The checkout process has always been hard to customize within Spree, and that has generated complaints in the past. We are pleased to report in the 1.2 release of Spree that this has been substaintially easier with a new checkout DSL that allows you to re-define the checkout steps in a simple manner. For more information about this, please see Issue #1418 and Issue #1743.
Along with these two major issues, there were also a ton of minor improvements and bug fixes, explained in detail below.
Major changes (backwards incompatibility)
spree_auth removal
Authentication is disabled by default within Spree as of this release, with the application supposed to be providing its own authentication. If you are upgrading an existing Spree installation or just want it to work, you can achieve the behaviour of a 1.1 installation by adding “spree_auth_devise” to your Gemfile.
gem 'spree_auth_devise', :git => "git://github.com/spree/spree_auth_devise"
For more information on how to customize authentication, please see the Authentication guide.
State machine customizations
Customizing the state machine within Spree now does not require you to override the entire state_machine definition within Spree’s Order model. Instead, you are provided with the ability to define the “next” events for Order objects like this:
Spree::Order.class_eval do checkout_flow do go_to_state :address go_to_state :delivery go_to_state :payment, :if => lambda { payment_required? } go_to_state :confirm, :if => lambda { confirmation_required? } go_to_state :complete remove_transition :from => :delivery, :to => :confirm end end
For more information about customizing the checkout process within Spree, please see the Checkout guide.
Minor changes
has_role?, api_key and roles methods now namespaced
On a usr object, the has_role? method is now called has_spree_role?, the api_key method is called spree_api_key and the roles association is now called spree_roles. This allows for applications to define their own has_role?, api_key and roles methods without them conflicting with the methods defined within Spree.
Introduce Spree::Product#master_images and Spree::Product#variant_images
Spree::Product#master_images and its alias Spree::Product#images only returns images belongs to master variant.
Spree::Product#variant_images behaviour is changed, it is no longer return only images belongs to master variants but now also include all variants’ images.
Spree::Zone#country_list renamed to #zone_member_list
Please be noted that the underlying logics remain intact.
Spree::Creditcard renamed to Spree::CreditCard
All occurences of Creditcard are changed to CreditCard to better follow Rails naming conventions.
Assert that ImageMagick is installed during Spree installation
When installing Spree, if the ImageMagick library was not installed on the system, then the identify command that Paperclip uses would fail and sample product images would not appear.
There is now a check in place to ensure that ImageMagick is installed before Spree is.
Sass variables can now be overriden
The variable definitions for the sass files of Spree have been moved to a separate file within Core called app/assets/stylesheets/store/variables.css.scss. You can override this file within your application in order to re-define the colors and other variables that Spree uses for its stylesheets.
Added support for serialized preferences
Preferences can now be defined as serialized. See 7415323 for more information.
New UI for defining taxons and option types for a product
Rather than having the taxons and option types related to a product on two completely separate pages, they are now included on the product edit form. This functionality is provided by the Select2 JavaScript plugin, and will fall back to a typical select box if JavaScript is not available.
Using the Money gem to display currencies
In earlier versions of Spree, we used number_to_currency to display prices for products. This caused a problem when somebody selected a different I18n locale, as the prices would be displayed in their currency: 20 Japanese Yen, rather than 20 American Dollars, for instance.
To fix this problem, we’re now parsing the prices through the Money gem which will display prices consistently across all I18n locales. To now change the currency for your site, go to Admin, then Configuration, then General Settings. Changing the currency will only change the currency symbol across all prices of your store.
Note: After the 1.2.0 release, more options to format the currency output have been introduced. Specifically the position of the currency symbol which is fixed to :before in 1.2.0 can be adjusted. To achieve this in the 1.2.0, you may wish to override the Spree::Money.to_s function.
Tiny changes / bugfixes
General
- Replaced uses of deprecated jQuery method live with on (273987d)
API
- Added ability to make shipments ready and declare them shipped (e933f36)
- Added payments and shipments information to order data returned from the API (8c2aaef)
- Add ability to credit payments through the order (320599a)
- Added the ability to update an order (ab1e23b)
- Added the ability to search for products (024b22a)
- Added zones (b522703 #1615)
- Allow orders to be paginated (873e9f8)
Core
- Added more products in sample data (6b66b3a)
- Sample products now have product properties associated with them (c71ef3a)
- Product images are now sorted by their position (5115377)
- The configuration menu/sidebar will now display on /admin/shipping_categories/index (459b5d0)
- Datepickers are now localized in the admin backend (e5f1680)
- You can now click on a product name in /admin/products/ list to go to that product (f2e9cc3)
- Defining of Spree::Image helper methods is done on the fly now (ff0c837)
- Account for purchased units in stock validation (7c4cd77)
- Sort all order adjustments by their created_at timestamp (aef2fd9)
- Use ransack method on classes rather than search, as this may be defined by an extension (4fabc52)
- Fix issue where redeeming a coupon code for a free product did not apply the coupon (2459f75 #1589)
- Specify class name for all belongs_to associations (94a6859)
- Don’t rename users table if User constant is defined (c77c822)
- Removed all references to link_to_function throughout Spree, replace with 100% JavaScript
- Moved get_taxonomies helper method out of Spree::Core::ControllerHelpers into Spree::ProductsHelper (980348a)