Forum OpenACS Q&A: Re: Ecommerce 4.6.3+, new users lose basket contents on sign-up
The problem persists..
The Bartt's above suggestion is part of the solution. user_id's are no longer forced to 0, and thus retain shopping cart contents if a user_id other than 0 exists, such as from a previous session.
However, new-users start with user_id = 0.
My earlier tests should have caught this, but I was not deleting cookies. Due to a small fixed screen and an over-sized cookie-manager window in browser, I was inadvertently clicking "cancel" instead of "ok" button! =/
New users start with user_id of 0. As soon as new-user gets a non-zero user_id, a new user_session_id is granted, and the contents are lost.
This following example shows the progression of a user who puts something in the shopping-cart, then tries to checkout. (abridged error log, ns_log notices added)
file references have base pathname service0/packages/ecommerce/www/ .. [19/Apr/2004:08:14:00][58837.146861056][-conn1-] Notice: Security: 1082362440 sec_generate_session_id_cookie setting 1150026, 0. [19/Apr/2004:08:14:04][58837.146861056][-conn1-] Notice: Huh? redirecting: http://dekka.com:8000/ecommerce/?usca%5fp=t .. [19/Apr/2004:08:14:59][58837.146377728][-conn4-] Notice: Huh? redirecting: http://dekka.com:8000/ecommerce/shopping-cart?product%5fid=1231 [19/Apr/2004:08:15:00][58837.144527360][-conn2-] Notice: shopping-cart.tcl line40 initial user_id: 0 [19/Apr/2004:08:15:00][58837.144527360][-conn2-] Notice: shopping-cart.tcl line48 initial from ad_conn user_id: 0 [19/Apr/2004:08:15:00][58837.144527360][-conn2-] Notice: shopping-cart.tcl line50 user_session_id: 399 [19/Apr/2004:08:15:00][58837.144527360][-conn2-] Notice: shopping-cart.tcl line53 user_session_id: 399 [19/Apr/2004:08:15:00][58837.144527360][-conn2-] Notice: LARS: counter = 0 ; this_row? 0 ;next_row? 0 [19/Apr/2004:08:15:06][58837.144527360][-conn2-] Notice: checkout.tcl line15 initial from ad_conn user_id: 0 [19/Apr/2004:08:15:06][58837.144527360][-conn2-] Notice: checkout.tcl line17 initial from ec_get_user_session_id: 399 [19/Apr/2004:08:15:06][58837.144527360][-conn2-] Notice: Huh? redirecting: https://dekka.com:8443/ecommerce/register/index?return_url=https%3a%2f%2fdekka%2ecom%3a8443%2fecommerce%2fc heckout&http_id=0&user_session_id=399 [19/Apr/2004:08:15:06][58837.146861056][-conn1-] Notice: Security: 1082362506 sec_generate_session_id_cookie setting 1150027, 0. [19/Apr/2004:08:15:06][58837.146861056][-conn1-] Notice: register/index.tcl line23 user_session_id: 399 .. [19/Apr/2004:08:15:25][58837.146861056][-conn1-] Notice: user-login.tcl line27 user_session_id: 399 .. [19/Apr/2004:08:15:26][58837.146861056][-conn1-] Notice: Huh? redirecting: https://dekka.com:8443/ecommerce/register/user-new?email=user84%40dekka%2enet&persistent%5fcookie%5fp=1&ret urn%5furl=https%3a%2f%2fdekka%2ecom%3a8443%2fecommerce%2fcheckout .. [19/Apr/2004:08:15:58][58837.146375680][-conn3-] Notice: Security: 1082362558 sec_generate_session_id_cookie setting 1150027, 6823. [19/Apr/2004:08:15:58][58837.146375680][-conn3-] Notice: Huh? redirecting: https://dekka.com:8443/ecommerce/checkout [19/Apr/2004:08:15:59][58837.140103680][-conn0-] Notice: checkout.tcl line15 initial from ad_conn user_id: 6823 [19/Apr/2004:08:15:59][58837.140103680][-conn0-] Notice: checkout.tcl line17 initial from ec_get_user_session_id: 0 [19/Apr/2004:08:15:59][58837.140103680][-conn0-] Notice: user_id from ad_verify_and_get_user_id: 6823 [19/Apr/2004:08:15:59][58837.140103680][-conn0-] Notice: user_session_id from ec_get_user_session_id: 0 [19/Apr/2004:08:15:59][58837.140103680][-conn0-] Notice: Huh? redirecting: https://dekka.com:8443/ecommerce/checkout?usca%5fp=t [19/Apr/2004:08:16:00][58837.146377728][-conn4-] Notice: checkout.tcl line15 initial from ad_conn user_id: 6823 [19/Apr/2004:08:16:00][58837.146377728][-conn4-] Notice: checkout.tcl line17 initial from ec_get_user_session_id: 400 [19/Apr/2004:08:16:00][58837.146377728][-conn4-] Notice: user_id from ad_verify_and_get_user_id: 6823 [19/Apr/2004:08:16:00][58837.146377728][-conn4-] Notice: user_session_id from ec_get_user_session_id: 400 [19/Apr/2004:08:16:00][58837.146377728][-conn4-] Error: shopping cart order has been lost,checkout.tcl line31 [19/Apr/2004:08:16:00][58837.146377728][-conn4-] Notice: Huh? redirecting: https://dekka.com:8443/ecommerce/index
How to preserve the new-user basket? Pass the user_session_id through user-new? Transfer the basket contents (in db) to new-user's user_id and new user_session_id? other??