Sha256: d232272221396f79c334f0a399d8f713066f8e0e42853d665c07a9c5b2646bfb
Contents?: true
Size: 977 Bytes
Versions: 15
Compression:
Stored size: 977 Bytes
Contents
require_dependency 'spree/shipping_calculator' # For #to_d method on Ruby 1.8 require 'bigdecimal/util' module Spree module Calculator::Shipping class PriceSack < ShippingCalculator preference :minimal_amount, :decimal, :default => 0 preference :normal_amount, :decimal, :default => 0 preference :discount_amount, :decimal, :default => 0 preference :currency, :string, :default => Spree::Config[:currency] attr_accessible :preferred_minimal_amount, :preferred_normal_amount, :preferred_discount_amount, :preferred_currency def self.description Spree.t(:shipping_price_sack) end 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 end end end
Version data entries
15 entries across 15 versions & 1 rubygems