Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BaseController does not attempt to merge incomplete and current order…
…s when they have differing distributors
- Loading branch information
Showing
2 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
module Spree | ||
BaseController.class_eval do | ||
|
||
# Override definition in spree/auth/app/controllers/spree/base_controller_decorator.rb | ||
# Do not attempt to merge incomplete and current orders when they have differing distributors | ||
def set_current_order | ||
if current_user | ||
if current_user.respond_to?(:last_incomplete_order) | ||
last_incomplete_order = current_user.last_incomplete_order | ||
if session[:order_id].nil? && last_incomplete_order | ||
session[:order_id] = last_incomplete_order.id | ||
elsif current_order && last_incomplete_order && current_order != last_incomplete_order && | ||
(current_order.distributor.nil? || current_order.distributor == last_incomplete_order.distributor) | ||
current_order.merge!(last_incomplete_order) | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters