Class: ProductsWishlist

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/products_wishlist.rb

Instance Method Summary collapse

Instance Method Details

#tax(with_currency = true) ⇒ Object

Returns total tax for this Product

Parameters

  • :with_currency - true by defaults. The currency of user is considered if true



22
23
24
# File 'app/models/products_wishlist.rb', line 22

def tax(with_currency=true)
  ("%01.2f" % (total(true, with_currency) - total)).to_f
end

#total(with_tax = false, with_currency = true) ⇒ Object

Return total price of this Product

Parameters

  • :with_tax - false by default, returns total price with tax if true

  • :with_currency - true by defaults. The currency of user is considered if true



14
15
16
# File 'app/models/products_wishlist.rb', line 14

def total(with_tax=false, with_currency=true)
  ("%01.2f" % (product.price(with_tax, with_currency) * quantity)).to_f
end