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
2012-06-23 19:29:21 -04:00
parent 71340444c1
commit 049770056d
9 changed files with 64 additions and 72 deletions
+4 -5
View File
@@ -4,14 +4,13 @@ module SpreeDigital
config.autoload_paths += %W(#{config.root}/lib)
# Use RSpec for tests
config.generators do |g|
g.test_framework :rspec
end
initializer "spree.spree_digital.preferences", :after => "spree.environment" do |app|
Spree::DigitalConfiguration = Spree::SpreeDigitalConfiguration.new
end
initializer "spree.register.digital_shipping", :after => 'spree.register.calculators' do |app|
app.config.spree.calculators.shipping_methods << Spree::Calculator::DigitalDelivery
end
def self.activate
Dir.glob(File.join(File.dirname(__FILE__), "../../app/**/*_decorator*.rb")) do |c|