Sha256: 673deb0fdd2dfaf1a94a31cde24753bbf6a7026de2d7eaea69dc97e2437ab8f7

Contents?: true

Size: 574 Bytes

Versions: 8

Compression:

Stored size: 574 Bytes

Contents

module PiggybakVariantsHelper
  def variant_cart_form(object)
    render "piggybak_variants/cart/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

8 entries across 8 versions & 1 rubygems

Version Path
piggybak_variants-0.0.13 app/helpers/piggybak_variants_helper.rb
piggybak_variants-0.0.12 app/helpers/piggybak_variants_helper.rb
piggybak_variants-0.0.11 app/helpers/piggybak_variants_helper.rb
piggybak_variants-0.0.10 app/helpers/piggybak_variants_helper.rb
piggybak_variants-0.0.9 app/helpers/piggybak_variants_helper.rb
piggybak_variants-0.0.8 app/helpers/piggybak_variants_helper.rb
piggybak_variants-0.0.7 app/helpers/piggybak_variants_helper.rb
piggybak_variants-0.0.6 app/helpers/piggybak_variants_helper.rb