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.
This commit is contained in:
Holger Hans Peter Freyther 2011-10-24 15:06:52 +02:00
parent a272ee6df7
commit dec84157ba
4 changed files with 29 additions and 2 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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