Permalink
Browse files

Check for spree_user_signup in CheckoutController

This is now the event that will trigger spree.user.signup notification for FirstOrder promotion

This leads to a shorter syntax in authentication extension gems, while still preserving all of the same functionality. i.e. User signs up, gets credited with the promotion.
  • Loading branch information...
radar committed May 30, 2012
1 parent 5fe4ce7 commit c04759ac4fdbc245aa752d6d25bcb593764b313e
Showing with 8 additions and 0 deletions.
  1. +8 −0 core/app/controllers/spree/checkout_controller.rb
@@ -52,6 +52,14 @@ def associate_user
@order.associate_user!(spree_current_user)
end
end
+
+ # This will trigger any "first order" promotions to be triggered
+ # Assuming of course that this session variable was set correctly in
+ # the authentication provider's registrations controller
+ if session[:spree_user_signup]
+ fire_event('spree.user.signup', :user => @user, :order => current_order(true))
+ end
+
session[:guest_token] = nil
end

0 comments on commit c04759a

Please sign in to comment.