It's not as easy as it sounds, since you will use Spree::OptionValue instead of options, and at some point you will need to go back to the options to add them to your cart. Combinations may not be possible and / or out of stock, so working with option_values ββis extremely impractical.
But, nevertheless, you wanted to know how I configured the following:
@options = Spree::OptionValue.joins(:option_value_variants).where(spree_option_value_variants: { variant_id: @product.variant_ids }).group_by(&:option_type)
This will give you a hash with hash keys, which are option_types (Size, Color, Length parameters in your case), and the values ββare arrays of option_values ββparameters.
You can easily configure this in a radio station as follows:
<% @options.each do |option_type, option_values| %> <%= content_tag :h2, option_type.presentation %> <% option_values.each do |option_value| %> <%= radio_button_tag option_type.name, option_value.id %> <%= label_tag option_value.presentation %> <% end %> <% end %>
Or for drop down menus:
<% @options.each do |option_type, option_values| %> <%= content_tag :h2, option_type.presentation %> <%= collection_select :variants, option_type.name, option_values, :id, :presentation %> <% end %>
And in your controller you want to find an option that meets these three criteria, check if it in_stock , backorderable or track_inventory? false and respond with errors or an updated cart :)
I hope this helps