Class: Spree::Calculator::Shipping::PriceSack
- Inherits:
-
ShippingCalculator
- Object
- ActiveRecord::Base
- Base
- Spree::Calculator
- ShippingCalculator
- Spree::Calculator::Shipping::PriceSack
- Defined in:
- app/models/spree/calculator/shipping/price_sack.rb
Instance Method Summary collapse
Methods inherited from ShippingCalculator
Methods inherited from Spree::Calculator
#available?, #compute, description, #description, #to_s
Methods inherited from Base
Methods included from Spree::Core::Permalinks
#generate_permalink, #save_permalink
Instance Method Details
#compute_from_price(price) ⇒ Object
18 19 20 21 22 23 24 |
# File 'app/models/spree/calculator/shipping/price_sack.rb', line 18 def compute_from_price(price) if price < preferred_minimal_amount preferred_normal_amount else preferred_discount_amount end end |
#compute_package(package) ⇒ Object
14 15 16 |
# File 'app/models/spree/calculator/shipping/price_sack.rb', line 14 def compute_package(package) compute_from_price(total(package.contents)) end |