Only look to current users addresses when possible. Such as in conjunction with spree_address_book extension. [fix #101]
This commit is contained in:
parent
e7f3e3f4ad
commit
c7f55c4941
|
@ -337,8 +337,8 @@ module Spree
|
||||||
end
|
end
|
||||||
|
|
||||||
def shipping_options
|
def shipping_options
|
||||||
#Uses users address if exists, if not uses first shipping method
|
# Uses users address if exists (from spree_address_book or custom implementation), if not uses first shipping method.
|
||||||
if (current_user.present? && current_user.addresses.present?)
|
if spree_current_user.present? && spree_current_user.respond_to?(:addresses) && spree_current_user.addresses.present?
|
||||||
estimate_shipping_for_user
|
estimate_shipping_for_user
|
||||||
shipping_default = @rate_hash_user.map.with_index do |shipping_method, idx|
|
shipping_default = @rate_hash_user.map.with_index do |shipping_method, idx|
|
||||||
{ :default => (idx == 0 ? true : false),
|
{ :default => (idx == 0 ? true : false),
|
||||||
|
@ -469,8 +469,8 @@ module Spree
|
||||||
end
|
end
|
||||||
|
|
||||||
def estimate_shipping_for_user
|
def estimate_shipping_for_user
|
||||||
zipcode = current_user.addresses.first.zipcode
|
zipcode = spree_current_user.addresses.first.zipcode
|
||||||
country = current_user.addresses.first.country.iso
|
country = spree_current_user.addresses.first.country.iso
|
||||||
shipping_methods = Spree::ShippingMethod.all
|
shipping_methods = Spree::ShippingMethod.all
|
||||||
#TODO remove hard coded shipping
|
#TODO remove hard coded shipping
|
||||||
#Make a deep copy of the order object then stub out the parts required to get a shipping quote
|
#Make a deep copy of the order object then stub out the parts required to get a shipping quote
|
||||||
|
|
Loading…
Reference in New Issue