php - Creating a user editable area of a site - adding to a users collection

995

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.

760

Answer

Solution:

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.

Well, for now I can see four tables: users, products, collections, collections_products (association).

A simple example would be: Logged in user - Finds product - clicks add to collection - collection is saved for when they log back on.

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

Add to collections
[ x ] collection one (already associated)
[   ] collection two
[   ] collection ...
[   ] collection ...

[ Save Associations ]

Note: in your checkboxes you have to use a name likecollection[] 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.

People are also looking for solutions to the problem: php - Preventing facebook session hijacking

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.