Sha256: 22eb9fcdc1dc89ee236c34259b6f62b9a8789a76863a1ce1a5132ec81f6cb969
Contents?: true
Size: 638 Bytes
Versions: 4
Compression:
Stored size: 638 Bytes
Contents
module PiggybakVariantsHelper def variant_cart_form(object, options = {:controls => 'radio_buttons'}) render "piggybak_variants/cart/#{options[:controls]}_form", :object => object end def options_for_klass(klass) options = ::PiggybakVariants::OptionConfiguration.find_all_by_klass(klass).collect { |oc| oc.option } end def variant_map(object) map = {} object.variants.available.each do |variant| map[variant.option_values.hash_ordered.map { |ov| ov.id }.join('_')] = { :id => variant.piggybak_sellable.id, :price => number_to_currency(variant.piggybak_sellable.price) } end map.to_json end end
Version data entries
4 entries across 4 versions & 1 rubygems