Sha256: 7bbda044367b6d24e082b9724a357ee14b98f6f8a37f2447037e4f8b94788ca7
Contents?: true
Size: 842 Bytes
Versions: 2
Compression:
Stored size: 842 Bytes
Contents
class ProductsWishlist < ActiveRecord::Base belongs_to :product validates_associated :product belongs_to :wishlist validates_associated :wishlist validates :quantity, :presence => true # Return total price of this <i>Product</i> # # ==== Parameters # * <tt>:with_tax</tt> - false by default, returns total price <b>with tax</b> if true # * <tt>:with_currency</tt> - true by defaults. The currency of user is considered if true def total(with_tax=false, with_currency=true) ("%01.2f" % (product.price(with_tax, with_currency) * quantity)).to_f end # Returns total tax for this <i>Product</i> # # ==== Parameters # * <tt>:with_currency</tt> - true by defaults. The currency of user is considered if true def tax(with_currency=true) ("%01.2f" % (total(true, with_currency) - total)).to_f end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
forgeos_commerce-1.9.1.rc1 | app/models/products_wishlist.rb |
forgeos_commerce-1.9.0 | app/models/products_wishlist.rb |