Browse Source

address: Do not use the paypal shipping address to override things

This extension overrides the shipping address with the one supplied
by paypal. It is not what we want! Store the paypal address in a dedicated
field in case we will ever need it.
1-2-stable-sysmocom
Holger Hans Peter Freyther 10 years ago
parent
commit
dec84157ba
  1. 6
      app/controllers/spree/checkout_controller_decorator.rb
  2. 3
      app/models/spree/order_decorator.rb
  3. 13
      db/migrate/20111024125404_order_pay_pal_address_field.rb
  4. 9
      db/migrate/20130130182351_rename_sysmocom_pay_pal_ship_address.rb

6
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

3
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

13
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

9
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
Loading…
Cancel
Save