Sha256: cac41bfd13373eb3ad219555d128faa0a4ed5c3560e7c34591440cdd6e378861

Contents?: true

Size: 565 Bytes

Versions: 2

Compression:

Stored size: 565 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.collect { |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

2 entries across 2 versions & 1 rubygems

Version Path
piggybak_variants-0.0.2 app/helpers/piggybak_variants_helper.rb
piggybak_variants-0.0.1 app/helpers/piggybak_variants_helper.rb