|
From: Ruediger H. <hae...@us...> - 2005-10-06 23:57:34
|
Update of /cvsroot/pn-commerce/pn-commerce In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26354 Modified Files: pnuser.php Log Message: Fix: after a successful login of an anonymous user in the checkout function, move its cart content to the registered username instead of showing an empty cart. Index: pnuser.php =================================================================== RCS file: /cvsroot/pn-commerce/pn-commerce/pnuser.php,v retrieving revision 1.281 retrieving revision 1.282 diff -C2 -d -r1.281 -r1.282 *** pnuser.php 21 Aug 2005 13:28:04 -0000 1.281 --- pnuser.php 6 Oct 2005 23:57:26 -0000 1.282 *************** *** 851,858 **** --- 851,883 ---- if( !isset( $anonshopping ) ) { + // we might need the anonymous KID for moving cart data to a + // registered user after he logged in. + pnSessionSetVar('anonKID', $KID); addlogmessage( _PNC_LOG_USERWARNING, "user forced to login" ); + // pncommerce_user_login() will call this function + // again. After a successfull login with a new username. return pncommerce_user_login(); } } + else + { + $input = pnVarCheckFromInput( 'login' ); + $submit = $input['values']['submit']; + if ($submit) + { + // login is successful, we now have to make sure that the cart is still as it was before + $olduser = pnSessionGetVar( 'anonKID' ); + pnSessionDelVar('anonKID'); + $newuser = pncommerce_user_useridcheck(); + // update ownership in the cart now + if ( pnModAPIFunc( 'pncommerce', 'user', 'updateCartOwnership', + array( 'oldowner' => $olduser, + 'newowner' => $newuser ) ) == false ) + { + return showerrorpage( _PNC_FAILEDTOCHANGECARTOWNERSHIP, __FILE__, __LINE__ ); + } + + } + } // check for logon logoff issue *************** *** 860,864 **** if ($userindb == false) { ! $newuser = true; } else --- 885,889 ---- if ($userindb == false) { ! $newuser = true; } else *************** *** 2241,2243 **** } ! ?> \ No newline at end of file --- 2266,2268 ---- } ! ?> |