Sha256: d1a8e6a6e2404653e3ba81cf548347772b3c3296498849f4efef7d679e9afa49

Contents?: true

Size: 561 Bytes

Versions: 1

Compression:

Stored size: 561 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.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

1 entries across 1 versions & 1 rubygems

Version Path
piggybak_variants-0.0.4 app/helpers/piggybak_variants_helper.rb