Updating cart address at login
Posted: 30 Nov 2015, 04:52
I would like to adapt the basket such that when a customer authenticates, the address in the basket is automatically updated if the customer has an address set (which they should since we require it at registration). Conversely, it'd be nice if I could add a hook such that if customer logs out, basket gets wiped.
Example scenario:
Customer in Australia is browsing as guest. We don't know they're from Canada so we are using a US address to estimate shipping.
Customer decides to log in. Clicks on basket to see if they like the order and are ready to check out. Basket still shows estimated shipping for US address because basket address didn't change when customer logged in.
Customer gets excited and rushes to checkout. Shipping is wrong.
Scenario 2 (likely to never happen but could on a shared machine):
Customer A is logged in and shopping. Abandons cart. Logs out.
Customer B later uses same machine to start shopping. All of customer A's items are still in cart. Further, Customer A's mailing info, etc. is still set in basket when Customer B clicks on basket. Minor security issue.
I was going to add the code for updating the basket to the AuthController in an authenticated() method so that it would run on successful authentication but I can't seem to figure out how to get access to the proper Aimeos objects to get the basket and update the address. I'm likely overlooking something after staring at it too long...
Is there a configuration setting where we could "timeout" session stuff after a while? I can load up the cart, shut the browser, and 3 days later the stuff is still in the cart when I go back. Sometimes useful, sometimes not. Definitely not useful for a shared computer situation. A large number of our customer are in university so the shared computer thing is a bit of a hassle.
We launched today. 2 days late and without a couple key pieces we need to work on but it's live. Finally
Example scenario:
Customer in Australia is browsing as guest. We don't know they're from Canada so we are using a US address to estimate shipping.
Customer decides to log in. Clicks on basket to see if they like the order and are ready to check out. Basket still shows estimated shipping for US address because basket address didn't change when customer logged in.
Customer gets excited and rushes to checkout. Shipping is wrong.
Scenario 2 (likely to never happen but could on a shared machine):
Customer A is logged in and shopping. Abandons cart. Logs out.
Customer B later uses same machine to start shopping. All of customer A's items are still in cart. Further, Customer A's mailing info, etc. is still set in basket when Customer B clicks on basket. Minor security issue.
I was going to add the code for updating the basket to the AuthController in an authenticated() method so that it would run on successful authentication but I can't seem to figure out how to get access to the proper Aimeos objects to get the basket and update the address. I'm likely overlooking something after staring at it too long...
Is there a configuration setting where we could "timeout" session stuff after a while? I can load up the cart, shut the browser, and 3 days later the stuff is still in the cart when I go back. Sometimes useful, sometimes not. Definitely not useful for a shared computer situation. A large number of our customer are in university so the shared computer thing is a bit of a hassle.
We launched today. 2 days late and without a couple key pieces we need to work on but it's live. Finally