Sha256: 6c6ee4d4a6c7d28c5206c633f0da361a4d4c2ae53a5ed08a8d143a916b2b104d
Contents?: true
Size: 751 Bytes
Versions: 8
Compression:
Stored size: 751 Bytes
Contents
module ShopifyAPI class Product < Base include Events include Metafields # compute the price range def price_range prices = variants.collect(&:price) 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
8 entries across 8 versions & 2 rubygems