hello,

we are running ubercart 7.x-3.6. i do not have any login/auth modules installed, except for the SMTP auth module (which would seem completely unrelated). we allow anonymous checkout.

an anonymous user can add items to their cart, and checkout anonymously fine. but if they add items to their cart, and then log in before checking out,. they lose all their cart contents.

i have seen this issue mentioned on earlier versions of drupal/ubercart, but none of those solutions seem to apply to us, and i have not found this issue for drupal7/ubercart3. i did not see it in this list of issues.

it would appear to be a session issue, but without debugging the code i am not sure how to fix it. is this a known issue? is there a workaround or fix? or do i need to hack some core code to make it work?

thanks for any thoughts or guidance.

Comments

longwave’s picture

Priority: Major » Minor
Status: Active » Postponed (maintainer needs more info)
Issue tags: -login, -lose cart

No, this is not a known issue, in fact we have automated tests which cover this scenario to ensure that it does work on an out of the box install of Ubercart. SMTP authentication would seem to be unrelated as you say.

uc_cart_user_login() and the subsequent call to uc_cart_login_update() are responsible for merging the anonymous cart with the authenticated cart, you should start any debugging investigations there.

longwave’s picture

Priority: Minor » Major

Didn't mean to change priority.

laz0rama’s picture

thanks longwave, i will start my research there.

laz0rama’s picture

thanks indeed. initial debugging has determined that hook_user_login is not being called, either on uc_cart or on my own custom module. i will look into what might be causing that.

laz0rama’s picture

wow, from what i can tell, the only module whose hook_user_login() hook is actually getting called is system (system_user_login). not even the hook_user_login() in user.api.php! i imagine there is some module conflict at play. uggg....

laz0rama’s picture

ok, i figured it out. there was an action (triggered by login) sending the user to the site's home page upon login. much of what i read in researching this said that if any module did a redirect (in hook_user_login), then additional hook_user_logins would not fire (which totally makes sense, since the drupal_goto() or whatever would be immediate). although no modules i could find was doing any redirect, i thought to check the actions/rules/triggers. and sure enough...

issue resolved.

thanks again to longwave for setting me in the right direction to figure it out.

longwave’s picture

Category: Bug report » Support request
Priority: Major » Normal
Status: Postponed (maintainer needs more info) » Fixed

Glad to help.

Also note that user.api.php (and all other *.api.php files) is for documentation only, and will never be executed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.