Spree Variant Options
Spree Variant Options is a very simple spree extension that groups your variants by option types and values. To get a better idea let's let a few images do the explaining.
When no selection has been made:
After "Medium" is selected, "Medium Blue" is out of stock:
And after "Green" is selected:
To see it in action, follow the steps for "Demo" below.
Spree Variant Options hasn't been released to rubygems so you'll have to install it from the source. Just add the following to your Gemfile:
gem 'spree_variant_options', :git => 'git://github.com/citrus/spree_variant_options.git'
Now, bundle up with:
Spree Variant Options doesn't require any rake tasks or generators, but you'll need include
app/views/products/_variant_options.html.erb in your product show view.
If you don't have a custom version of
_cart_form.html.erb in your application, then don't worry about a thing, spree_variant_options will include the partial for you. Otherwise, just replace the entire
<% if @product.has_variants? %> block with:
<%= render 'variant_options' %>
Spree Variant Options works on Spree 0.30.1 and above... Please let me know if you run into any issues.
Clone this repo to where you develop, bundle up, then run `dummier' to get the show started:
git clone git://github.com/citrus/spree_variant_options.git cd spree_variant_options bundle install bundle exec dummier
This will generate a fresh rails app in test/dummy, install spree & spree_variant_options, then migrate the test database. Sweet.
Spork + Cucumber
To run the cucumber features, boot spork like this:
bundle exec spork
Then, in another window, run:
Spork + Test::Unit
If you want to run shoulda tests, start spork with:
bundle exec spork TestUnit #or bundle exec spork t
In another window, run all tests:
Or just a specific test:
If you don't want to spork, just use rake:
# cucumber/capybara rake cucumber # test/unit rake test # both rake
You can easily use the test/dummy app as a demo of spree_variant_options. Just
cd to where you develop and run:
git clone git://github.com/citrus/spree_variant_options.git cd spree_variant_options mv lib/dummy_hooks/after_migrate.rb.sample lib/dummy_hooks/after_migrate.rb bundle install bundle exec dummier cd test/dummy rails s
So far it's just me; Spencer Steffen.
If you'd like to help out feel free to fork and send me pull requests!
Copyright (c) 2011 Spencer Steffen and Citrus, released under the New BSD License All rights reserved.