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
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from ShippingCalculator
#available?, #compute_shipment
Methods inherited from Spree::Calculator
#available?, calculators, #compute, #description, register, #to_s
Methods inherited from Base
Methods included from Preferences::Preferable
#clear_preferences, #default_preferences, #defined_preferences, #get_preference, #has_preference!, #has_preference?, #preference_default, #preference_type, #set_preference
Class Method Details
.description ⇒ Object
11 12 13 |
# File 'app/models/spree/calculator/shipping/price_sack.rb', line 11 def self.description Spree.t(:shipping_price_sack) end |
Instance Method Details
#compute_from_price(price) ⇒ Object
19 20 21 22 23 24 25 |
# File 'app/models/spree/calculator/shipping/price_sack.rb', line 19 def compute_from_price(price) if price < self.preferred_minimal_amount self.preferred_normal_amount else self.preferred_discount_amount end end |
#compute_package(package) ⇒ Object
15 16 17 |
# File 'app/models/spree/calculator/shipping/price_sack.rb', line 15 def compute_package(package) compute_from_price(total(package.contents)) end |