diff --git a/app/controllers/spree/checkout_controller_decorator.rb b/app/controllers/spree/checkout_controller_decorator.rb index b3bf90b..46ee3bc 100644 --- a/app/controllers/spree/checkout_controller_decorator.rb +++ b/app/controllers/spree/checkout_controller_decorator.rb @@ -96,8 +96,10 @@ module Spree end order_ship_address.save! - @order.ship_address = order_ship_address - @order.bill_address ||= order_ship_address + @order.sysmocom_paypal_ship_address = order_ship_address + #No need to replace the EUVAT and others we already have from the shipping address + #@order.ship_address = order_ship_address + #@order.bill_address ||= order_ship_address #Add Instant Update Shipping if payment_method.preferred_cart_checkout diff --git a/app/models/spree/order_decorator.rb b/app/models/spree/order_decorator.rb new file mode 100644 index 0000000..bde17fc --- /dev/null +++ b/app/models/spree/order_decorator.rb @@ -0,0 +1,3 @@ +Spree::Order.class_eval do + belongs_to :sysmocom_paypal_ship_address, :foreign_key => "sysmocom_paypal_ship_address_id", :class_name => "Address" +end diff --git a/db/migrate/20111024125404_order_pay_pal_address_field.rb b/db/migrate/20111024125404_order_pay_pal_address_field.rb new file mode 100644 index 0000000..d094d97 --- /dev/null +++ b/db/migrate/20111024125404_order_pay_pal_address_field.rb @@ -0,0 +1,13 @@ +class OrderPayPalAddressField < ActiveRecord::Migration + def self.up + change_table :orders do |t| + t.integer :paypal_ship_address_id + end + end + + def self.down + change_table :orers do |t| + t.remove :paypal_ship_address_id + end + end +end diff --git a/db/migrate/20130130182351_rename_sysmocom_pay_pal_ship_address.rb b/db/migrate/20130130182351_rename_sysmocom_pay_pal_ship_address.rb new file mode 100644 index 0000000..09f3359 --- /dev/null +++ b/db/migrate/20130130182351_rename_sysmocom_pay_pal_ship_address.rb @@ -0,0 +1,9 @@ +class RenameSysmocomPayPalShipAddress < ActiveRecord::Migration + def up + rename_column :spree_orders, :paypal_ship_address_id, :sysmocom_paypal_ship_address_id + end + + def down + rename_column :spree_orders, :sysmocom_paypal_ship_address_id, :paypal_ship_address_id + end +end