What's the best way to implement the favorites feature? (e.g. favorite products on a data driven website)
I wrote a dynamically database based object oriented website with an admin interface, etc. etc. I would like to add a feature where customers can save items as "favorites" without having to create an account and login to come back to them later, but I don't know exactly how to do this ... I see three options:
- Block favorites based on IP address and then change them to log into the account if the customer then creates an account;
- Get customers to create an account to be able to use this functionality;
- Choose favorites based on IP address, but let users save their favorites under the name they specify.
The problem with option 1 is that I don't know much about IP addresses - my dad considers them unique, but I know people have had problems with such systems.
The problem with 1 and 2 is that accounts are not open to clients yet - only administrators can log in at the moment. This should be easy to change (no more than morning or afternoon work), but I would also have to do work with user groups as well.
The problem with option 3 is that if user A saves a favorites list with the name "My favorites" and then user B tries to save the list under that name and is denied, user B will be able to access the list saved by user A, since they now they know that it already exists. The solution to this is to password protect the lists, but to accomplish all this effort, I can also implement option 2.
Of course, I could always use option 4; use an alternative if someone can suggest a better solution than any of the above options.
So has anyone ever done something like this before? If so, how did you do it? What do you recommend (or don't recommend)?
Thank you very much in advance,
Hello,
Richard
a source to share
The problem with using an IP solution is that IP addresses are not necessarily unique. A router allows multiple users to access the Internet using a single "external" IP address that your website will display, and gives each user a unique "internal" address that you do not have access to. Routers are used in companies, schools, homes, places that offer Internet access, like cafes, as you call it. So an IP based solution won't work for everyone - for example, both my roommate and I connect to the internet using a router and thus exchange one external IP address and get one favorites list which both can see.
A better solution would be to store some GUID in a cookie on the client machine when they try to add a favorite. Then, in your database, you bind favorites to that GUID until the user creates an account on your system. But this is not without problems; if a user deletes a cookie from their machine, they will lose access to their favorites.
The best option would be to create them accounts on the system and after logging in, they can create favorites associated with their accounts. So option 2 would be the preferred solution, especially for data that needs to persist until the user wants to delete it.
a source to share