开发者

php shopping cart

im doing a shopping cart and everything works well until i realise something. currently im using session to track user's cart items into the database. user can add items to cart without login. however, before checkout, users will need to login to do so. when user login, the session_id() will be re-generated. this means that it will开发者_JS百科 be different from the session_id used to store those cart items b4 login. how am i gonna track user cart items then??


You could define the session_id when logging-in the user - creating the "logged in" session with the same session ID as the "not logged in" session.

http://www.php.net/manual/en/function.session-id.php


There are two ways,

1) You can maintain same session as suggested by matthewh

2) You can maintain shopping details in database with session id

Hope this helps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜