vinpkl Posted April 28, 2015 Share Posted April 28, 2015 HiI have an old ecommerce website in which all queries are based on LOGIN ID. select * from user_table where user login id = '$loginid' Now i have a requirement of creating "CHECKOUT AS GUEST" feature.So should I create TWO separate database tables for Member and Guest.OR Single table for both.And Then on what basis shall i do the queries.So that my queries should work in both case, whether user is a MEMBER or a GUEST.ThanksVineet Quote Link to comment Share on other sites More sharing options...
nik_jain Posted May 1, 2015 Share Posted May 1, 2015 One option might be to add a boolean column - 'is_guest' ? Set default value to false and work from there.. Quote Link to comment Share on other sites More sharing options...
mac_gyver Posted May 1, 2015 Share Posted May 1, 2015 each guest visitor should have a unique id generated for it and used in place of the user_id. if the guest logs in, just replace the unique id with the actual user_id. 1 Quote Link to comment Share on other sites More sharing options...
gizmola Posted May 1, 2015 Share Posted May 1, 2015 To add to mac's answer, your user table should allow for several different types of users ('member', 'guest') and at that point all you have to focus on is the differences in things like login/logout and checkout behavior between the types, and methods to convert guests to members. You will find that you generate many basically empty guest accounts, but a cron job that looks for accounts with incomplete orders older than a certain age, which then deletes the cart and guest account is easy enough to code. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.