Class: Spree::Calculator::Shipping::PriceSack

Inherits:
ShippingCalculator show all
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

Class Method Details

.descriptionObject



13
14
15
# File 'app/models/spree/calculator/shipping/price_sack.rb', line 13

def self.description
  Spree.t(:shipping_price_sack)
end

Instance Method Details

#compute_package(package) ⇒ Object



17
18
19
20
21
22
23
24
# File 'app/models/spree/calculator/shipping/price_sack.rb', line 17

def compute_package(package)
  content_items = package.contents
  if total(content_items) < self.preferred_minimal_amount
    self.preferred_normal_amount
  else
    self.preferred_discount_amount
  end
end