php - Creating a user editable area of a site - adding to a users collection
I'm trying to create a section of a website where users can login and add products to a collections area where they have saved collections of products.
A simple example would be:
Logged in user - Finds product - clicks add to collection - collection is saved for when they log back on.
Also there may be more than one collection eg "add to: Collection 1, Collection 2 etc"
If anyone can help or just point me in the right direction it would be great.
Additional info: I'm a good front end developer with some php knowledge.
Answer
Solution:
Well, for now I can see four tables: users, products, collections, collections_products (association).
Login - verify if the user and password exists in the table and store the user data in the session.
Page 1: provide a form with fields that the user can filter to return products
Page 2: show the filters and the products with a link to add to collections.
When the user clicks in the link to add to collections, you can provide a modal dialog with a list of collections and every collection with one checkbox. The list can have the checkbox of a collection already selected if the association already exists.
Example:
Product: My Procuct
Note: in your checkboxes you have to use a name like
collection[]
so the php will handle as an array.To save the association of the product and the collections, you can delete all associations for the user product and insert just those that return checked.
Well I think that's a start.