Jump to content

Tree design question, really simple.


mendoz

Recommended Posts

Hey freaks.

 

I'm working on a products catalog application.

 

Every product has a parent category.

 

The categories are organized nicely in a tree,

Only the leaves have products associated with them.

 

I hope you understood because now comes the questions:

 

1. What to do with the products associated with a leaf after it has been deleted?

    Should I delete the products as well? Put them in a trash bin?

 

2. What happens with the children of a node after it's deletion?

    Do they become the children of the node's parent?

 

3. Why do I like this site?

    Because the people are nice and answer fast and accurate !

Link to comment
Share on other sites

1. What to do with the products associated with a leaf after it has been deleted?

    Should I delete the products as well? Put them in a trash bin?

 

This is entirely up to yourself (or your client), I would ask them what they want to happen.  Personally

we usually have a separate products manager, a category manager, and a products to category manager.

 

If a category was deleted it would orphan the products in it, but we would leave the products available in

the products table, but perhaps use an icon to show they are not assigned to a category.

 

2. What happens with the children of a node after it's deletion?

    Do they become the children of the node's parent?

 

Again, down to how you want it to work and up to you to code.  Typically we would warn the user

that deleting a parent node will remove all children.

 

3. Why do I like this site?

    Because the people are nice and answer fast and accurate !

 

Hope it was quick enough ;-)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.