Sha256: 0f6544df94c4c5048e668293aef605b24c81347f128b6de9d2ef5717bedc5c62
Contents?: true
Size: 1.04 KB
Versions: 3
Compression:
Stored size: 1.04 KB
Contents
module Spree module ProductsHelper # returns the formatted change in price (from the master price) for the specified variant (or simply return # the variant price if no master price was supplied) def variant_price_diff(variant) diff = variant.price - variant.product.price return nil if diff == 0 if diff > 0 "(#{t(:add)}: #{number_to_currency diff.abs})" else "(#{t(:subtract)}: #{number_to_currency diff.abs})" end end # converts line breaks in product description into <p> tags (for html display purposes) def product_description(product) raw(product.description.gsub(/(.*?)\r?\n\r?\n/m, '<p>\1</p>')) end def line_item_description(variant) description = variant.product.description if description.present? truncate(strip_tags(description.gsub(' ', ' ')), :length => 100) else t(:product_has_no_description) end end def get_taxonomies @taxonomies ||= Spree::Taxonomy.includes(:root => :children) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
spree_core-1.1.6 | app/helpers/spree/products_helper.rb |
spree_core-1.1.5 | app/helpers/spree/products_helper.rb |
spree_core-1.1.4 | app/helpers/spree/products_helper.rb |