Sha256: a919a158136d87a868058017c1dc07f30d852701c30e19fbdf161b45d4702a12
Contents?: true
Size: 785 Bytes
Versions: 3
Compression:
Stored size: 785 Bytes
Contents
Spree::Product.class_eval do include Spree::ActiveSalesHelper has_many :active_sale_events, :as => :eventable # Find live and active taxons for a product. def find_live_taxons all_sale_events.select{ |sale_event| (sale_event.eventable_type == "Spree::Taxon") && (self.taxons.map(&:id).include?(sale_event.eventable_id)) } end # product.live_active_sale_event gets first active sale event which is live and active def live_active_sale_event get_sale_event(self) end # if there is at least one active sale event which is live and active. def live? !self.live_active_sale_event.nil? || !self.find_live_taxons.blank? end # Check if image is available for this. def image_available? !images.blank? end def image images.first end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
spree_active_sale-2.0.0 | app/models/spree/product_decorator.rb |
spree_active_sale-1.3.2 | app/models/spree/product_decorator.rb |
spree_active_sale-1.3.1 | app/models/spree/product_decorator.rb |