Refactoring digital shipping calculation and display

* removed the deface override that modified the checkout/_delivery partial
* created custom digital delivery calculator
* removed digital_shipping_method from Spree::Order. Moved logic to available_shipping_methods monkey patch

The main goal was to eliminate the shipping method detection logic from the _delivery partial.
This was a bit of a hack all along and didn't really present the correct information to the underlying
order logic (i.e. rate_hash.blank? would return true when there was no shipping options available).
This should be more future proof and make overriding another aspect of the delivery process easier.
This commit is contained in:
Michael Bianco committed 2012-06-23 19:29:21 -04:00
1 parent 71340444c1
commit 049770056d
9 files changed
+64 -72

No files matched your search

@@ -0,0 +1,18 @@
# https://github.com/spree/spree/issues/1439
require_dependency 'spree/calculator'
module Spree
class Calculator::DigitalDelivery < Calculator::FlatRate
def self.description
I18n.t(:digital_delivery)
end
def compute(object=nil)
self.preferred_amount
end
def available?(order)
order.digital?
end
end
end