Sha256: 4a7b869a56b2aec56cb22e1710117be8655606ff92c9d64db0475960f3589539
Contents?: true
Size: 739 Bytes
Versions: 2
Compression:
Stored size: 739 Bytes
Contents
module SpiffyStoresAPI class Product < Base include Metafields # compute the price range def price_range prices = variants.collect(&:price).collect(&:to_f) format = "%0.2f" if prices.min != prices.max "#{format % prices.min} - #{format % prices.max}" else format % prices.min end end def collections StandardCollection.find(:all, :params => {:product_id => self.id}) end def super_collections SmartCollection.find(:all, :params => {:product_id => self.id}) end def add_to_collection(collection) collection.add_product(self) end def remove_from_collection(collection) collection.remove_product(self) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
spiffy_stores_api-4.11.1 | lib/spiffy_stores_api/resources/product.rb |
spiffy_stores_api-4.11.0 | lib/spiffy_stores_api/resources/product.rb |