Sha256: 0d1f9f29dd5aab0f087099123718204d909821d0619a694e9e9fb183e2578a88
Contents?: true
Size: 767 Bytes
Versions: 47
Compression:
Stored size: 767 Bytes
Contents
module ShopifyAPI class Product < Base include Events 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 CustomCollection.find(:all, :params => {:product_id => self.id}) end def smart_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
47 entries across 47 versions & 1 rubygems